2D Blob Alignment
Function
This Step is used to detect blobs in an image, filter them based on specified geometric features (e.g., area, circularity), and align the image so that the blob centroid coincides with the original image center.
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. |
| Parameter | Description |
|---|---|
Principal Axis Angle Range |
Parameter description: This parameter specifies the normalized angular range used to determine the Blob’s principal axis.
|
Align and Crop |
Parameter description: This parameter sets the image processing mode. When this parameter is selected, the system will align the image so that the blob centroid coincides with the original image center, and crop the image to the blob’s minimum bounding rectangle. If it is not selected, no alignment is performed, and areas outside the blob are filled with black.
|
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: Aligning Circular Parts for Subsequent Dimensional Measurement
-
Scenario: Detect circular parts (e.g., washers, bearings) with a clean background. The target object needs to be translated to the image center for consistent subsequent measurement and display.
-
Tuning approach:
-
First select the appropriate Blob polarity based on the brightness relationship between the part and the background.
-
Use manual threshold to stably segment the target region, then combine circularity and area filters to select the target blob.
-
Since circular parts are insensitive to rotation direction, the default Principal Axis Angle Range can be kept.
-
If subsequent Steps only need to process the target region, it is recommended to select Align and Crop to reduce the influence of irrelevant background.
-
-
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
Principal Axis Angle Range
±90°
Align and Crop
Selected
Case 2: Aligning Rectangular Parts to a Uniform Orientation for Recognition
-
Scenario: Detect rectangular or square parts (e.g., chips, circuit boards, cards). The goal is to rotate all targets to a uniform orientation for subsequent character recognition, dimensional comparison, or template matching.
-
Tuning approach:
-
Use auto threshold to quickly adapt to on-site lighting variations.
-
Filter out non-target regions using aspect ratio of bounding rectangle and area.
-
For rectangular targets with an obvious long-edge direction, focus on adjusting the Principal Axis Angle Range to ensure stable principal axis direction output.
-
If subsequent Steps only need to process the target region, it is recommended to select Align and Crop to reduce the influence of irrelevant background. If the full original image needs to be preserved, deselect this option.
-
-
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
Principal Axis Angle Range
±45°
Align and Crop
Selected
Case 3: Aligning Elongated Workpieces to Avoid Angle Jumps
-
Scenario: Detect elongated targets (e.g., strips, connecting rods, slender labels) with a clear principal axis, but the angle may jump across different images, affecting alignment consistency in subsequent processing.
-
Tuning approach:
-
First stably detect the unique target using threshold and area range.
-
For elongated targets, further constrain the target shape using the aspect ratio of bounding rectangle.
-
Focus on checking the Principal Axis Angle Range setting to ensure the target’s principal axis angle remains consistent after normalization, avoiding a 180° rotation difference of the same target across different images.
-
If only the target body image needs to be extracted for subsequent processing, select Align and cropto reduce background interference.
-
-
Parameter settings:
Parameter Setting Blob Polarity
Light on dark
Threshold Type
Manual
Threshold Range
120 ~ 255
Neighborhood
8-neighbor
Contour Retrieval Mode
External contours
Filter Condition (Condition 1)
Aspect ratio of bounding rectangle ≥ 3.0
Filter Condition (Condition 2)
Area ≥ 300
Logic between Conditions
AND
Principal Axis Angle Range
±45°
Align and Crop
Selected
Case 4: Aligning Targets in Complex Backgrounds While Preserving the Original Image Range
-
Scenario: Multiple interfering regions exist in a complex or changing background. The target needs to be located and aligned first, but subsequent Steps still require reference to the surrounding area information in the original image.
-
Tuning approach:
-
Use ROI and masks to limit the detection range first, reducing the impact of complex backgrounds on blob detection.
-
Filter out the target blob using conditions such as area, circularity, or aspect ratio.
-
If the target direction determination is stable, the default **Principal Axis Angle Range** can be kept; if the direction is unstable, adjust it based on the actual distribution.
-
In this scenario, it is recommended to unselect Align and Crop to align only the target position and keep the full image range, so that the context information can be used in subsequent steps.
-
-
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
Principal Axis Angle Range
±90°
Align and Crop
Not selected