remove_small_components#

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

Remove small connected components from the mask.

Parameters:
  • min_size (int) – the minimum size of a component to keep. Small components are removed.

  • 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:

An RLEMask object with small components removed.

Return type:

RLEMask

Examples

Remove components smaller than 4 pixels:

.remove_small_components(min_size=4) ==