count_connected_components#

rlemasklib.RLEMask.count_connected_components(connectivity=4, min_size=1)[source][C source]#

Count connected components without extracting them.

This is the fastest way to count components when you don’t need the actual masks or statistics.

Parameters:
  • connectivity (int) – 4 or 8, the connectivity of the components.

  • min_size (int) – the minimum size of a component to count.

Returns:

The number of connected components.

Return type:

int