def BoundingRect(*points):
    xs = []
    ys = []
    for each in points:
        if type(each) == list or type(each) == tuple:
            # if the first argument is a list of points
            rect = BoundingRect(*each)
            xs.append(rect.x)
            xs.append(rect.x+rect.w)
            ys.append(rect.y)
            ys.append(rect.y+rect.h)
        elif isinstance(each, pv.Rect):
            # If this is a list of rects
            rect = each
            xs.append(rect.x)
            xs.append(rect.x+rect.w)
            ys.append(rect.y)
            ys.append(rect.y+rect.h)
        elif isinstance(each,pv.Point):
            # if it is a pv point
            xs.append(each.X())
            ys.append(each.Y())
        else:
            raise TypeError("Cannot create bounding rect for geometry of type: %s"%each.__class__)
    
    # Find the mins an maxs
    assert len(xs) > 0
    minx = min(*xs)
    maxx = max(*xs)
    miny = min(*ys)
    maxy = max(*ys)
    
    # Create the rect
    return Rect(minx,miny,maxx-minx,maxy-miny)
Create a rectangle that includes all of the points or rectangles.
dataset/ETHPy150Open bolme/pyvision/src/pyvision/types/Rect.py/BoundingRect