from_bbox#

rlemasklib.from_bbox(bbox, imshape=None, imsize=None)[source]#

Connvert a bounding box to an RLE mask of the given size.

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 RLE mask corresponding to the input bounding box, i.e., a mask with all zeros except

for 1s within the bounding box.