2D Blob Analysis
Function
This Step is used to detect blobs in an image and filter them based on specified geometric features (e.g., area, circularity).
Input Description
| Input item | Description |
|---|---|
Image |
This port inputs the image that will be used for blob analysis. |
Alignment Parameter Group |
Optional input. Used to adjust the ROI’s pose in sync with the target object’s pose changes. |
Parameter Description
| Parameter | Description |
|---|---|
ROI Settings |
Parameter description: This parameter is used to limit the image processing region. If no ROI is set, the Step will process the entire image.
|
Mask Settings |
Parameter description: This parameter is used to set one or more masks so that image areas covered by the masks are ignored during blob detection.
|
Detection Settings
| Parameter | Description |
|---|---|
Blob Polarity |
Parameter description: This parameter defines which pixel regions are identified as blobs based on their contrast to the background. Value list:
|
Threshold Type |
Parameter description: This parameter specifies the method for calculating the binarization threshold. Pixels with gray values above the threshold are classified as foreground; those below are classified as background. Value list:
|
Neighborhood |
Parameter description: This parameter specifies the connectivity rule between pixels, determining which pixels are grouped into a single blob. Value list:
|
Contour Retrieval Mode |
Parameter description: This parameter specifies the retrieval method for blob contour extraction. Value list:
|
Filter Settings
This parameter is used to set filter conditions to select blobs that match specific geometric features. Click the Open the editor button to set the relevant parameters in the "Filter Settings" window.
| Parameter | Description |
|---|---|
Logic Between Conditions |
Parameter description: This parameter specifies the logical filtering rule. It is used to set the logic (AND/OR) between multiple filter conditions (e.g., area, aspect ratio of bounding rectangle, circularity). Different condition items are combined by the "Logic Between Conditions" setting (AND/OR); when the same condition item is added multiple times, it is always combined with OR logic, regardless of the "Logic Between Conditions" setting.
Tuning instructions: Click the Add condition button and select the condition to filter from the drop-down list, then set the logic between conditions. For definitions and descriptions of conditions, see Filter Condition Descriptions. You can set the "Filter value range" based on the "Reference value range". Additionally, each condition can be individually enabled/disabled or deleted. |
Sorting Settings
| Parameter | Description |
|---|---|
Sort By |
Parameter description: This parameter specifies the sorting criterion for the detected blobs.
|
Sort Order |
Parameter description: This parameter specifies the sorting direction.
|
Primary Sorting Direction |
Parameter description: This parameter specifies the primary sorting direction for Z-shape sorting. Value list:
|
Secondary Sorting Direction |
Parameter description: This parameter specifies the secondary sorting direction (cross-row or cross-column) for Z-shape sorting. Value list:
|
Layer Interval |
Parameter description: This parameter divides blobs into layers based on the specified interval. When the sorting method is row-first, this parameter indicates the row interval; when column-first, it indicates the column interval. |
Reference Position |
Parameter description: This parameter specifies the starting position used for layering. For example, when sorting row-first, the system places the first row at this reference position, and then arranges subsequent rows above or below it based on the specified layer interval. |
Output Settings
| Parameter | Description |
|---|---|
Max Number of Output Results |
Parameter description: When selected, the Step outputs the merged Blob mask image. |
Output Merged Mask |
Parameter description: This parameter specifies the maximum number of Blobs that can be output. Only the top N Blobs after sorting are output (N is the value of this parameter). If the actual number of Blobs is less than N, all Blobs are output. |
Output True If Blob Is Detected |
Parameter description: This parameter specifies the Boolean result output when blobs are detected.
|
Output Description
| Output item | Description |
|---|---|
Blob Detected |
Boolean result of the Blob detection. The specific Boolean result depends on the setting of the "Output True If Blob Is Detected" parameter. |
Blob Count |
Number of detected blobs. |
Blob Masks |
The mask image of the detected blobs. |
Blob(n) pose |
The position and orientation of the blob(n) in the image. |
Bounding Rectangle |
The bounding rectangle of the blob. |
Bounding Rectangle Center X |
The X coordinate of the blob’s bounding rectangle center. |
Bounding Rectangle Center Y |
The Y coordinate of the blob’s bounding rectangle center. |
Principal Axis Angle |
The rotation angle of the blob’s principal axis relative to the horizontal axis, in degrees (°). |
Area |
The area of the blob in pixels. |
Total area |
The total area of the Blobs. |
Bounding Rectangle Width |
The width of the blob’s bounding rectangle. |
Bounding Rectangle Height |
The height of the blob’s bounding rectangle. |
Aspect Ratio of Bounding Rectangle |
Aspect ratio of bounding rectangle = Bounding rectangle width / Bounding rectangle height |
Circularity |
Circularity = Blob area / Area of a circle with the same perimeter as the blob. |
Inradius |
The inradius of the blob. |
Circumradius |
The circumradius of the blob. |
Inscribed Rectangle Width |
The width of the blob’s inscribed rectangle. |
Inscribed Rectangle Height |
The height of the blob’s inscribed rectangle. |
Centroid X |
The X coordinate of the blob’s centroid. The centroid is the geometric center of the blob, represented as a point whose coordinates indicate its position in the image. |
Centroid Y |
The Y coordinate of the blob’s centroid. The centroid is the geometric center of the blob, represented as a point whose coordinates indicate its position in the image. |
Bounding Rectangle Top-Left X |
The X coordinate of the blob’s bounding rectangle top-left corner. |
Bounding Rectangle Top-Left Y |
The Y coordinate of the blob’s bounding rectangle top-left corner. |
Bounding Rectangle Bottom-Right X |
The X coordinate of the blob’s bounding rectangle bottom-right corner. |
Bounding Rectangle Bottom-Right Y |
The Y coordinate of the blob’s bounding rectangle bottom-right corner. |
Rotated Bounding Rectangle Width |
The width of the blob’s rotated bounding rectangle. |
Rotated Bounding Rectangle Height |
The height of the blob’s rotated bounding rectangle. |
Parameter Tuning Examples
Case 1: Detecting Circular Parts
-
Scenario: Detect circular parts (e.g., washers, bearings), with a clean background, focusing on filtering circular targets.
-
Tuning approach:
-
First determine the Blob polarity by selecting "Light on dark" or "Dark on light" based on the brightness relationship between the part and the background.
-
Manually set the threshold range to effectively segment the target objects.
-
Add a circularity filter condition to select approximately circular blobs.
-
Add an area filter condition to exclude noise and overly large interference.
-
Sort by area in descending order to prioritize processing larger parts.
-
-
Parameter settings:
Parameter Setting Blob Polarity
Light on dark
Threshold Type
Manual
Threshold Range
100 ~ 255
Neighborhood
8-neighbor
Contour Retrieval Mode
External contours
Filter Condition (Condition 1)
Circularity ≥ 0.75
Filter Condition (Condition 2)
Area ≥ 500 and ≤ 10000
Logic Between Conditions
AND
Sort By
Area
Sort Order
Descending
Case 2: Detecting Rectangular Parts
-
Scenario: Detect rectangular or square parts (e.g., chips, circuit boards, cards), requiring precise filtering of targets with near-rectangular shapes, with possible lighting variations.
-
Tuning approach:
-
Use auto threshold to quickly adapt to different lighting conditions.
-
Use 4-neighbor connectivity to ensure clear rectangular boundaries.
-
Filter by aspect ratio of bounding rectangle to select rectangular objects.
-
Set a minimum area to exclude tiny noise.
-
Sort by X coordinate for orderly left-to-right processing.
-
-
Parameter settings:
Parameter Setting Blob Polarity
Dark on light
Threshold Type
Auto
Neighborhood
4-neighbor
Contour Retrieval Mode
External contours
Filter Condition (Condition 1)
Aspect ratio of bounding rectangle ≥ 0.8 and ≤ 1.2
Filter Condition (Condition 2)
Area ≥ 1000
Logic Between Conditions
AND
Sort By
Bounding Rectangle Center X
Sort Order
Ascending
Case 3: Detecting Small Objects
-
Scenario: Detect small-sized objects (e.g., screws, bolts, small parts), requiring noise avoidance to ensure detection reliability.
-
Tuning approach:
-
Set the appropriate Blob polarity based on background brightness.
-
Increase the lower threshold limit to effectively separate small targets from the dark background.
-
Use 8-neighbor connectivity to ensure the contour connectivity of small targets.
-
Use both area and circumradius conditions for constraint to improve filtering accuracy.
-
Sort by Y coordinate to suit top-to-bottom processing scenarios.
-
-
Parameter settings:
Parameter Setting Blob Polarity
Light on dark
Threshold Type
Manual
Threshold Range
150 ~ 255
Neighborhood
8-neighbor
Contour Retrieval Mode
External contours
Filter Condition (Condition 1)
Area ≥ 50 and ≤ 500
Filter Condition (Condition 2)
Circumradius ≥ 3 and ≤ 15
Logic Between Conditions
AND
Sort By
Centroid Y
Sort Order
Ascending
Max Number of Output Results
Selected (set the output result count)
Case 4: Target Detection in Complex Backgrounds
-
Scenario: Complex or changing backgrounds (stacked materials, mixed items, etc.) where target objects may have holes, requiring ROI and masks to limit the detection range.
-
Tuning approach:
-
Use ROI settings to limit the detection region and reduce subsequent processing complexity.
-
Draw masks to cover obvious interfering regions (e.g., strong reflections, shadow areas).
-
Use the "All contours" mode to detect targets with holes.
-
Set a wider threshold range to adapt to lighting variations.
-
Use AND logic to combine multiple conditions for strict filtering of qualifying blobs.
-
Use Z-shape sorting to suit regularly arranged items.
-
-
Parameter settings:
Parameter Setting ROI Settings
Set (limit the processing region)
Mask Settings
Set (cover interfering regions)
Blob Polarity
Light on dark
Threshold Type
Manual
Threshold Range
80 ~ 200
Neighborhood
8-neighbor
Contour Retrieval Mode
All contours
Filter Condition (Condition 1)
Area ≥ 800
Filter Condition (Condition 2)
Circularity ≥ 0.6
Logic Between Conditions
AND
Sort By
Z shape
Primary Sorting Direction
Row-first, left to right
Secondary Sorting Direction
Top to bottom
Layer Interval
50
Case 5: High-Contrast Background with Precise Control of Detection Results
-
Scenario: High contrast between the target and background, but the number and quality of output results need to be strictly controlled, e.g., only the top N largest blobs are needed.
-
Tuning approach:
-
Use auto threshold to quickly obtain basic segmentation results.
-
Set contour retrieval to "External contours" to improve processing efficiency.
-
Exclude abnormal shapes using a combination of aspect ratio of bounding rectangle and circularity conditions.
-
Select "Max Number of Output Results" to control the output count.
-
Sort by area in descending order to ensure the largest targets are output.
-
Select "Output True If Blob Is Detected" to enable logic-based judgment.
-
-
Parameter settings:
Parameter Setting Blob Polarity
Light on dark
Threshold Type
Auto
Neighborhood
8-neighbor
Contour Retrieval Mode
External contours
Filter Condition (Condition 1)
Aspect ratio of bounding rectangle ≥ 0.5 and ≤ 2.0
Filter Condition (Condition 2)
Circularity ≥ 0.5
Logic Between Conditions
OR
Sort By
Area
Sort Order
Descending
Max Number of Output Results
Selected
Output Result Count
10
Output True If Blob Is Detected
Selected