tight_crop#

rlemasklib.RLEMask.tight_crop(inplace=False)[source]#

Crop the mask to the bounding box of the foreground.

Parameters:

inplace (bool) – whether to perform the operation in place or to return a new object

Returns:

A tuple consisting of the cropped mask and the box.

Return type:

tuple[RLEMask, ndarray]

Examples

.tight_crop() == (, np.array([3, 1, 3, 3]))

See also

crop()