fill_rectangle#

rlemasklib.RLEMask.fill_rectangle(rect, value=1, inplace=False)[source]#

Fill a rectangle in the mask.

Parameters:
  • rect (ndarray) – a rectangle, in the format [x_start, y_start, width, height]

  • value (int) – the value to fill with (0 or 1)

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

Returns:

An RLEMask object with the rectangle filled (self if inplace=True)

Return type:

RLEMask

Examples

Fill a rectangle with ones:

.fill_rectangle([2, 1, 4, 2], value=1) ==

Clear a rectangle by filling with zeros:

.fill_rectangle([2, 1, 4, 2], value=0) ==

See also

fill_circle()