2D Template Editor

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

■ If you're unsure about the version of the product you are using, please contact Mech-Mind Technical Support for assistance.

In Mech-Vision,use the 2D template editor to define 2D regions of interest (ROIs) on the image. Data within the ROI is used to extract edge features for generating a 2D matching template.

The extracted edge features should meet the following requirements:

  • Common to all images: If the extracted edge features are not present in all images, matching between the images and the template may fail.

  • Representative: Extracted edge features must be representative to ensure unique and accurate matching; otherwise, matching results may be incorrect.

  • Moderate quantity: In general, more extracted edge features improve matching accuracy. However, an excessive number may reduce matching speed.

Start the Feature

Under Parameters in the parameter configuration panel of the Step, click the Edit Template button to open the 2D Template Editor.

Matching templates cannot be used across scenarios.

Preparations

  1. Ensure that the Step has proper input.

  2. Under Parameters in the parameter configuration panel of the Step, click the Edit Template button to open the 2D Template Editor. This tool will automatically obtain the input image of the Step.

  • Click the Get Step input button in the editor’s parameter panel on the right to update the input image.

  • When the X-axis resolution and the Y-axis resolution of an image differ, the software will automatically adjust the image so that its resolution ratio is 1:1. After returning to the home interface, you can view the normal image.

resolution change for image

Workflow

  1. Rename the default template or click the + New button to create a new template.

    After selecting a template from the template list, right-click and select the Rename option, enter a custom name, and click the OK button to rename the template.
    2d template rename 1
  2. Select an ROI. Ensure that the edge features in the ROI are representative and not excessive.

    Instruction: Click the icon on the toolbar to the right of the tool list to select the appropriate ROI Tools and create ROIs to select feature points in the image. Note that the extracted edge features will only take effect when a feature region or ROI is used in the Step. Otherwise, the generated matching template will lead to matching failure.

    • In the ROI list section at the bottom left of the interface, right-click an ROI and select Enable, Disable, etc., to set the drawn ROI.

    • For overlapping areas, Disable has priority over Enable. In other words, when one region is set to Enabled and an overlapping region to Disabled, the overlapping area is effectively Disabled; edge features within it are ignored and not used for template generation.

      overlap region status
  1. Set the center point. The template rotates around the center point within a specified angle range to accommodate different angle variations of the target in the image.

    If the center point is changed after the template is generated, you must click the Generate template button again to update the template for the center point setting to take effect.
  2. Set Feature parameters.

  3. Click the Generate template button in the lower-right corner to generate and preview the template.

    generated model
  4. Click the Save button in the lower-right corner to save the generated template.

    If you only clicked the Save button in the lower-right corner and did not generate a template, the edited template would be saved but would not work.

After configuration, close the editor. Click under the Edit template button in the Parameters section of the Step and then select the corresponding template in the drop-down menu.

ROI Drawing Tools

The usage instructions on ROI drawing tools are shown in the table below.

Icon Tool Instructions

circle roi

Circle ROI Tool

Use the Circle ROI Tool to draw a circular ROI.

  1. Click the Circle ROI Tool icon on the toolbar to the right of the Template Listcircle roi.

  2. Press and hold the left mouse button and drag the crosshair cursor in the drawing area to draw a circle.

  3. Release the left mouse button to finish the drawing.

rectangle roi

Rectangle ROI Tool

Use the Rectangle ROI Tool to draw a rectangular ROI.

  1. Click the Rectangle ROI Tool icon on the toolbar to the right of the Template Listrectangle roi.

  2. Press and hold the left mouse button and drag the crosshair cursor in the drawing area to draw a rectangle.

  3. Release the left mouse button to finish the drawing.

polygon roi

Polygon ROI Tool

Use the Polygon ROI Tool to draw a polygonal ROI.

  1. Click the Polygon ROI Tool icon on the toolbar to the right of the Template Listpolygon roi.

  2. Click the first position (vertex) in the drawing area, then click the second one, etc., to draw the polygon. (At least three vertices are required.)

  3. Right-click to finish.

roi eraser

ROI Eraser Tool

Use the ROI Eraser Tool to erase the drawn ROI, and the points in the erased parts will not be used to generate the template.

  1. Click the ROI Eraser Tool icon on the toolbar to the right of the Template Listroi eraser.

  2. In the upper-left corner of the ROI drawing area, drag the slider or change the pixel value to adjust the eraser size.

  3. Press and hold the left mouse button and drag in any direction in the drawing area to determine the drawn regions to be erased.

  4. Release the left mouse button to finish the drawing.

select tool

Select Tool

Use the Select Tool to select and edit the drawn ROI.

  1. Click Select Tool icon on the toolbar to the right of the Template listselect tool.

  2. Select an ROI from ROI list, or click an ROI in the drawing area. At this point, vertices appear on the edges of the ROI, and the mouse cursor changes to an open-hand cursor when positioned over the ROI hand icon .

  3. Press and hold the left mouse button and drag the ROI in any direction. The open-hand cursor hand iconchanges to a closed-hand cursorfist icon. Release the left mouse button to complete the move.

  4. Hover the cursor over a vertex. When the cursor changes to a hand pointerpoint icon, press and hold the left mouse button and drag the vertex to change the shape or size of the ROI. Release the left mouse button to finish.

  • After drawing an ROI, click the Select Tool select tool on the toolbar to edit the ROI.

  • The Select Tool cannot be used to edit the regions erased by the ROI Eraser Tool.

Feature Parameters

Parameter Description

Search scale

The downsampling scale applied to the template image during the fast search phase. Higher scales increase search speed at the cost of feature resolution. In the Auto Mode, the system will select the optimal search scale based on the image content.

Rough edge threshold

Points with gradient magnitudes smaller than this value are considered rough edge features, which are used to quickly estimate the approximate position of the target.

Fine edge threshold

Points with gradient magnitudes smaller than this value are considered fine edge features, which are used to accurately locate the target based on fast estimation.

Search step

The search step size (sub-pixel) for fine matching. The smaller the step size, the higher the search accuracy, but the calculation workload increases.

Min chain length

After grouping extracted continuous edge features into chains, any chain with a length (number of consecutive points) below this threshold is considered noise and discarded. Used to filter out scattered and meaningless edges.

Angle search range

Set the possible rotation angle range of the target to be matched. This range should be as narrow as possible to ensure matching speed.

Scale search range

Set the possible scaling range of the target to be matched relative to the template. This range should be as narrow as possible to ensure matching speed.

After confirming that the edge features in the ROI are stable and representative, you can quickly adjust the feature parameters along the following steps:

  • Search Scale is set to Auto Mode first.

  • Slow matching speed: Reduce the Angle Search Range and Scale Search Range first; if it is still slow, try increasing the Search Scale again.

  • Frequent missed inspections: Reduce Rough Edge Threshold, Fine Edge Threshold, or Min Chain Length appropriately.

  • Multiple false positives: Increase Rough Edge Threshold, Fine Edge Threshold or Min Chain Length appropriately.

  • Inaccurate positioning: Reduce the Search Step appropriately.

It is recommended to adjust only one parameter at a time and then observe the effect after the template is regenerated.

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.