Table of Contents

Method ConnectedComponentsEx

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

ConnectedComponentsEx(InputArray, PixelConnectivity, ConnectedComponentsAlgorithmsTypes, MatType?)

computes the connected components labeled image of boolean image. image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image.

public static ConnectedComponents ConnectedComponentsEx(InputArray image, PixelConnectivity connectivity = PixelConnectivity.Connectivity8, ConnectedComponentsAlgorithmsTypes ccltype = ConnectedComponentsAlgorithmsTypes.Default, MatType? ltype = null)

Parameters

image InputArray

the image to be labeled

connectivity PixelConnectivity

8 or 4 for 8-way or 4-way connectivity respectively

ccltype ConnectedComponentsAlgorithmsTypes
ltype MatType?

output label image type. Currently CV_32S (default) and CV_16U are supported. CV_16U halves the native label image's memory footprint, at the cost of a 65535 label limit.

Returns

ConnectedComponents