from_bbox#
- static rlemasklib.RLEMask.from_bbox(bbox, imshape=None, imsize=None)[source]#
Create an RLEMask object from a bounding box.
- Parameters:
bbox – a bounding box, in the format [x_start, y_start, width, height]
imshape – [height, width] of the desired mask (either this or imsize must be provided)
imsize – [width, height] of the desired mask (either this or imshape must be provided)
- Returns:
An RLEMask object where the area of the provided bounding box has the value 1, and the rest is 0.
- Return type:
Examples
Create a 3x4 rectangle at position (2, 1) in an 6x8 image:
RLEMask.from_bbox([2, 1, 4, 3], imshape=(6, 8)) ==