fill_small_holes#

rlemasklib.RLEMask.fill_small_holes(min_size=1, connectivity=4, inplace=False)[source]#

Fill small holes (i.e., connected components of the background) in the mask.

Parameters:
  • min_size (int) – the minimum size of a hole to keep. Smaller holes are filled.

  • connectivity (int) – 4 or 8, the neighborhood connectivity of the components

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

Returns:

A new RLEMask object with small holes filled.

Return type:

RLEMask

Examples

Fill holes smaller than 2 pixels (1-pixel holes get filled, 3-pixel hole stays):

.fill_small_holes(min_size=2) ==