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:

RLEMask