コード例 #1
0
ファイル: RectUtil.py プロジェクト: wudi00/pixtoapp
def convertToParentCorrdinate(rectView, childBound):
    rect = Rect()
    rect.x = childBound.x - rectView.x
    rect.y = childBound.y - rectView.y
    rect.height = childBound.height
    rect.width = childBound.width

    #		Point[] ap = new Point[listPoints.size()];
    #		listPoints.toArray(ap);
    #		contour = new MatOfPoint(ap);
    return rect
コード例 #2
0
ファイル: RectUtil.py プロジェクト: wudi00/pixtoapp
def findBoundOfRects(iRects):
    rect = Rect()
    if (len(iRects) == 0):
        return rect
    top = sys.maxsize
    left = sys.maxsize
    right = -sys.maxsize
    bottom = -sys.maxsize
    for e in iRects:
        left = min(left, e.x)
        top = min(top, e.y)
        right = max(right, e.x + e.width)
        bottom = max(bottom, e.y + e.height)

    rect.x = left
    rect.y = top
    rect.width = right - left
    rect.height = bottom - top
    return rect