2D Target Object Counting

You are currently viewing the documentation for the latest version (2.2.0). To access a different version, click the "Switch version" button located in the upper-right corner of the page.

■ If you are not sure which version of the product you are currently using, please feel free to contact Mech-Mind Technical Support.

Function

This Step is used to detect and count target objects in an image using 2D template matching. It compares the objects in the image with the template, automatically counts the number of matches, and determines whether the count falls within the specified range.

Usage Scenario

This Step is suitable for scenarios where target objects need to be counted.

Input and Output

Input

Input port Data type Description

Image

Image

Image to be inspected.

2D Alignment Parameter Group

Pose2D

Used to adjust the ROI’s pose in sync with the target object’s pose changes.

Output

Output port Data type Description

Count Judgment Result

String

Used to indicate whether the number of matching results is within the specified range, OK or NG.

Count Check

Bool

Used to indicate whether the match count falls within the specified range. True indicates the count meets the requirement, and false indicates it does not.

Matching Score

Number[]

Used to evaluate the match quality.

Match Count

Number

The number of matching results.

Parameter Description

Parameter Description

ROI Setting

Parameter description: This parameter is used to limit the image processing area. When ROI is not set, the Step processes the entire image.
Tuning instructions: Click the icon, then hold down the left mouse button and drag in the data visualization area to draw an ROI of the corresponding shape.

Mask Setting

Parameter description: This parameter is used to set one or more masks so that image areas covered by the masks are ignored during matching.
Tuning instructions: Click the icon, then left-click in the data visualization area to add anchor points and draw a polygon mask.

Template Settings

Parameter Description

Select Template

Parameter description: This parameter is used to set the matching template.
Tuning instructions: Open the 2D Template Editor and edit the template used for matching in this tool. After the template is configured and saved, click to select the template from the drop-down list. For instructions on using the 2D Template Editor, refer to 2D Template Editor.

Matching Settings

Parameter Description

Edge Polarity Sensitive

Parameter description: This parameter controls whether edge polarity must match the template. The polarity indicates the direction of intensity changes along the edges, e.g., light-to-dark or dark-to-light.
Default value: Enabled
Tuning instructions: If there is not a large disparity in the data acquisition scenarios, enable this option to ensure matching accuracy. If there is a large disparity, disable this option to enhance the matching generalization ability.

Min Matching Score

Parameter description: This parameter is used to determine whether a matching result is valid. Any result whose score is below this value will be discarded.
Default value: 50.0

Valid Matching Threshold

Parameter description: In the target image, points with gradient magnitudes greater than or equal to this threshold are considered valid edge points and participate in matching score calculation.
Default value: 10

Min Valid Match Ratio

Parameter description: The minimum ratio of valid matched edge points to the total number of edge points in the template.
Default value: 50%

Search Radius

Parameter description: The radius of the circular search area for finding corresponding matching points of each template feature point in the target image during pose refinement.

Default value: 8

When the matching effect is poor, you can appropriately increase this value.

Max Overlap Ratio

Parameter description: This parameter is used to filter out duplicate matching results. If there is an overlap between two matching results and the overlap ratio exceeds this value, only the result with the higher matching score will be retained.
Default value: 50%

Padding Ratio

Parameter description: This parameter specifies the ratio of allowed padded size to template size when the target object may be partially outside the image. Padding can recover edge matches that would otherwise fail, but generally increases computation.

When a part of the object to be matched is outside the image, padding is required. If the proportion of the template outside the image after matching exceeds this threshold, a matching failure will occur.

Default value: 0%

Count Threshold Settings

Parameter Description

Min Number of Matching Results

Parameter description: This parameter is used to specify the minimum expected number of matching results. If the actual number of matching results is less than this value, the result is judged as NG.
Default value: 0
Tuning instructions: Set this parameter according to actual conditions.

Max Number of Matching Results

Parameter description: This parameter is used to specify the maximum allowed number of matching results. If the actual number of matching results is greater than this value, the result is judged as NG.
Default value: 9999
Tuning instructions: Set this parameter according to actual conditions.

Is this page helpful?

You can give a feedback in any of the following ways:

We Value Your Privacy

We use cookies to provide you with the best possible experience on our website. By continuing to use the site, you acknowledge that you agree to the use of cookies. If you decline, a single cookie will be used to ensure you're not tracked or remembered when you visit this website.