connection — Compute connected components of a region.
connection determines the connected components of the
input regions given in
Region. The neighborhood used for
this can be set via
The default is 8-neighborhood, which is useful for determining the
connected components of the foreground. The maximum number of
connected components that is returned by
connection can be
set_system('max_connection',<Num>). The default
value of 0 causes all connected components to be returned.
The inverse operator of
read_image(Image,'clip') dev_set_colored(12) threshold(Image,Dark,0,150) count_obj(Dark,NumThresholded) dev_display (Dark) connection(Dark,ConnectedRegions) count_obj(ConnectedRegions,NumConnected) dev_display (ConnectedRegions)
Let F be the area of the input region and N be the number of generated connected components. Then the runtime complexity is O(sqrt(F) * sqrt(N)).
connection always returns the value 2 (H_MSG_TRUE). The
behavior in case of empty input (no regions given) can be set via
and the behavior in case of an empty input region via
If necessary, an exception is raised.