Information Reading (1D/2D Barcode Recognition)
This section introduces the target object recognition configuration workflow for the 1D/2D barcode recognition scenario. This method is used to read 1D or 2D barcode information on target objects to obtain identification data such as material codes and serial numbers.
Click Config wizard, select the Information Reading scenario, and select the 1D/2D barcode recognition method to enter this configuration workflow.
Usage Workflow
The overall recognition workflow includes four steps:
-
Image preprocessing: Perform color conversion, enhancement, denoising, morphological transformations, and other preprocessing on the input image to improve image quality, highlight target object features, and reduce background interference, providing a reliable data foundation for subsequent 1D/2D barcode recognition.
-
Pose correction: Set the recognition region and align the recognition target with the template through alignment operations. Select an appropriate correction method based on recognition target features, flexibly configure parameters, eliminate position and angle deviations, and improve recognition accuracy and result reliability.
-
Information reading: Based on actual requirements, set the target area for detection in the aligned image, and set judgment rules to accurately read and parse 1D/2D barcode content and verify its content accuracy.
-
General settings: Configure output ports to output recognition results and key information, meeting production line automated detection and data traceability requirements.
Image Preprocessing
Before recognizing target objects, you can choose to enable Convert color space or Image preprocessing based on the input image quality, and adjust the corresponding parameters to make image features clearer, thereby improving recognition accuracy and efficiency.
Convert Color Space
Converting the image color space can transform the input image from one color space to another, for example, from BGR to grayscale, BGR to HSV, etc. Through color space conversion, image features can be better highlighted to facilitate subsequent image processing.
For detailed parameter description and tuning examples, please read Convert Color Space.
Image Preprocessing
In image preprocessing, you can perform enhancement, denoising, morphological transformations, grayscale inversion, edge extraction, and other preprocessing operations on the input image.
For detailed parameter description and tuning examples, please read Image Preprocessing.
Pose Correction
After completing image preprocessing, configure the pose correction settings. By setting the recognition region and correction parameters, the pose of the recognition target in the current image is corrected to align with the template, ensuring the accuracy and reliability of subsequent recognition.
Add Correction Settings
After entering the pose correction workflow, you need to create a new correction parameter group. The system supports creating multiple parameter groups, each of which can independently set recognition regions and parameters without affecting each other.
Click the Add button to enter the new parameter group window. When creating a parameter group, select an appropriate correction method based on image features and configure the corresponding parameters.
Currently, the following three correction methods are supported:
-
No correction: Uses the original input image directly for recognition without any pose correction processing. Suitable for scenarios where the recognition target position is relatively fixed in the image and the correction accuracy requirement is not high.
-
2D alignment: Aligns the recognition target’s pose with the template through translation and rotation operations. This method can extract the edge contour of the recognition target and uses an edge matching algorithm for precise alignment. Suitable for scenarios where the recognition target position is not fixed but has distinct fixed contours. For detailed configuration, read 2D Alignment.
-
2D Blob alignment: Used to detect bright and dark regions (i.e., Blobs) in the image. Filters target Blobs based on geometric features of the Blob (such as area, centroid, etc.) and calculates its minimum bounding rotated rectangle. Then adjusts the image pose so that the target Blob’s centroid aligns with the image center point, and the principal axis of its minimum bounding rotated rectangle aligns with the image coordinate axes. For detailed configuration, read 2D Blob Alignment.
After creating the parameter group, right-click the parameter group name, or directly click the function buttons on its right side to perform operations such as rename, delete, or create a copy.
2D Alignment
2D alignment is a correction method that aligns the recognition target in the input image with the template through translation and rotation operations. It can eliminate recognition errors caused by inconsistent recognition target positions, improving recognition stability. After selecting this method, you need to complete recognition region settings, template settings, and recognition parameter tuning in sequence.
Set Target Region
Used to set the effective range for alignment. When selecting, the recognition target must be fully covered with appropriate margins on all sides to ensure the stability of alignment operations and the accuracy of subsequent recognition. You can select Set all as target region or Customize target region based on actual requirements. After selecting customize, click the "Select" button to manually select the recognition region.
-
Set all as target region: Recognizes the entire image, typically suitable for scenarios where recognition targets are widely distributed.
-
Customize target region: Recognizes only the selected area, typically suitable for scenarios where you only need to focus on a specific part of the image, or want to exclude irrelevant areas (such as background, fixtures, and other interferences), helping to improve recognition efficiency and accuracy.
Recognize Target Object
Set Target Object Template
After setting the recognition region, select or edit the template for subsequent positioning and matching of the recognition target. Click the Edit button to enter the 2D Matching Template Editor.
Select representative and stable edge features from the image to generate the template, so that the system can subsequently search the image automatically and accurately locate target objects that match the template features, while ensuring the uniqueness and stability of matching results. For detailed instructions, please refer to 2D Matching Template Editor.
| After each template editing, click Update to apply the latest configuration. |
Adjust Recognition Parameters
After selecting the template, click Run Step to view the template matching results and recognition performance.
If the recognition performance is not satisfactory, you can adjust other parameters based on the features and requirements of the recognition target for optimization.
For detailed parameter description, please refer to 2D Alignment.
Then, click Next to proceed to the error-proofing check workflow.
2D Blob Alignment
2D Blob alignment is a Blob-based correction method. This method detects all Blobs in the image and filters out the Blob with the most prominent geometric features. It then adjusts the image pose so that the target Blob’s centroid aligns with the image center point, and the principal axis of its minimum bounding rotated rectangle aligns with the image coordinate axes. After selecting 2D Blob alignment, you need to complete recognition region settings and recognition parameter tuning in sequence.
Set Target Region
Used to set the effective range for alignment. When selecting, the recognition target must be fully covered with appropriate margins on all sides to ensure the stability of alignment operations and the accuracy of subsequent recognition. You can customize the settings based on actual requirements.
The system supports rectangle and circle selection modes, and allows mixed addition of multiple regions. That is, on the same image, multiple rectangle or circle recognition regions can exist simultaneously to meet recognition requirements in complex scenarios.
Recognize Target Object
After setting the recognition region, you can adjust other parameters based on the features and requirements of the recognition target for optimization.
For detailed parameter description and tuning suggestions, please refer to 2D Blob Alignment.
You can also learn more about the usage of each parameter through tuning examples.
Information Reading
After aligning the image, begin recognizing 1D or 2D barcodes within the specified image area to output the barcode content and its position in the image.
Set Target Region
Set the effective range for detecting 1D/2D barcodes. When selecting, the 1D/2D barcodes to be detected must be fully covered, excluding irrelevant background interference. You can select Set all as recognition region or Customize recognition region based on actual requirements. After selecting customize, click the "Select" button to manually select the recognition region.
-
Set all as recognition region: Recognizes the entire image, typically suitable for scenarios where 1D or 2D barcodes are distributed over a wide range.
-
Customize recognition region: Recognizes only the selected area, typically suitable for scenarios where you only need to focus on a specific part of the image, or want to exclude irrelevant areas (such as background, fixtures, and other interferences), helping to improve recognition efficiency and accuracy.
Set Judgment Logic
After enabling the judgment logic, you can enter 1D/2D barcode judgment content, supporting content retrieval through global variables or manual input.
| Parameter | Description |
|---|---|
Switch to global variable |
Parameter description: After selecting this parameter, the value in the global variable can be used for content judgment, suitable for scenarios where 1D/2D barcode content changes dynamically. The global variable value can be generated by other Steps or projects. For usage of global variables, please refer to Global Variable. |
Switch to manual input |
Parameter description: This parameter is used to set custom 1D or 2D barcode content for judgment, suitable for scenarios where 1D/2D barcode content remains fixed. |
General Settings
In this workflow, you can configure auxiliary functions beyond visual recognition. Currently, output port configuration is supported.
Configure Output Port
Here, you can select the output ports based on actual requirements. By default, the 1D/2D barcode content is output.
-
1D/2D barcode location: Outputs the location of the 1D/2D barcode in the image.
-
1D/2D barcode verification result: Indicates whether 1D/2D barcode verification is passed. Outputs true if verification passes, false otherwise. This port is only displayed when Judgment logic is enabled.
After checking the port, the 2D Target Object Recognition Step will add the corresponding output port in real time.