largest_interior_rectangle_around#
- rlemasklib.RLEMask.largest_interior_rectangle_around(center_point, aspect_ratio=None)[source]#
The largest axis-aligned foreground rectangle with a given center point.
Without aspect_ratio, the rectangle will have odd height and odd width and have the pixel at position center_point as its central pixel. When aspect_ratio is given, the rectangle may have non-integer dimensions.
If the output is r, the following will hold:
center_point[0] == r[0] + (r[2]-1) / 2center_point[1] == r[1] + (r[3]-1) / 2r[2] / r[3] == aspect_ratiothe region defined by
ris entirely inside the foreground
- Parameters:
- Returns:
An array (x, y, width, height) of the top-left corner and dimensions of the rectangle.
See also
largest_interior_rectangle()for the largest rectangle without specifying the center point.