Image Connected Component Analysis
Description
This operator performs connected component analysis on input binary images, identifying all independent white pixel regions in the image as connected components. For each identified connected component, the operator can output its contour, center point, and an independent mask image, and filter results based on area size.
Overview
Identifies connected components in the input binary image, outputting their contours, center points, and independent mask images, with optional filtering by area size.
Scenarios
-
Object Detection and Segmentation: Separating each independent object instance to obtain their positions and contours.
-
Noise Removal: Effectively removing small-area noise points generated after binarization through area filtering.
-
Defect Detection: Detecting defects such as scratches, stains, and pits on product surfaces. Defects usually form independent connected regions after binarization.
Inputs and Outputs
Inputs |
Binary image: One or more binary images. |
Outputs |
Detection Results: A list of detection results, where each element represents a detected connected component, containing information such as the contour, category, and confidence of the region. Result center point list: A list containing the coordinates [x, y] of the center points of each identified connected component that passed the area filtering. Result mask images: Only when the parameter "Return Mask List" is enabled, this port outputs a list of binary images. Each image in the list corresponds to a detected connected component, where the region is white and the rest is black. |
Parameters
Result Type
Description |
Sets the representation format for the contour of each detected object. |
Tuning Instructions |
|
Parameter Range |
Values/Range:
Default: Minimum bounding rectangle |
Connectivity Type
Description |
Defines the rule used to determine which neighboring pixels are considered "connected" in an image. The two common methods are 4-connectivity and 8-connectivity. |
Tuning Instructions |
|
Parameter Range |
Values/Range:
Default: 8-Connectivity |
Minimum Pixel Area
Description |
Sets an area threshold. All connected components whose pixel count (area) is smaller than this value will be filtered out. |
Tuning Instructions |
After binarization, small white speckles caused by noise frequently appear in the image. By setting an appropriate minimum area, these meaningless noise points can be removed. When tuning, observe the approximate pixel area of normal targets in the binary image, and set this parameter to a value smaller than the smallest normal target but larger than most noise. For example, if the area of normal targets is always above 200 pixels and noise points are generally below 50 pixels, this value can be set to 100. |
Parameter Range |
[5, 1000000], default value: 100 |
Parameter Range |
Values/Range: [5, 1000000] Default: 100 |
Maximum Pixel Area
Description |
Sets an area threshold. All connected components whose pixel count (area) is larger than this value will be filtered out. |
Tuning Instructions |
This parameter can be used to exclude abnormally large regions. For example, if improper lighting or threshold settings cause a large portion of the background to be incorrectly identified as a white region, this parameter can be used to filter it out. Typically, this value can be set to something considerably larger than the maximum area that a normal target could possibly occupy. |
Parameter Range |
[5, 10000000], default value: 300000 |
Parameter Range |
Values/Range: [5, 10000000] Default: 300000 |
Return Mask List
Description |
Controls whether to generate and output an independent mask image for each detected connected component. |
Tuning Instructions |
|
Parameter Range |
Default: False |