| Cv2ConnectedComponents Method (InputArray, Int32, PixelConnectivity) |
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.
Namespace:
OpenCvSharp
Assembly:
OpenCvSharp (in OpenCvSharp.dll) Version: 1.0.0
Syntax public static int ConnectedComponents(
InputArray image,
out int[,] labels,
PixelConnectivity connectivity
)
Public Shared Function ConnectedComponents (
image As InputArray,
<OutAttribute> ByRef labels As Integer(,),
connectivity As PixelConnectivity
) As Integer
public:
static int ConnectedComponents(
InputArray^ image,
[OutAttribute] array<int,2>^% labels,
PixelConnectivity connectivity
)
static member ConnectedComponents :
image : InputArray *
labels : int[,] byref *
connectivity : PixelConnectivity -> int
Parameters
- image
- Type: OpenCvSharpInputArray
the image to be labeled - labels
- Type: SystemInt32
destination labeled rectangular array - connectivity
- Type: OpenCvSharpPixelConnectivity
8 or 4 for 8-way or 4-way connectivity respectively
Return Value
Type:
Int32The number of labels
See Also