When a basic pattern location (X/Y coordinates) needs to be determined within the ROI, the Pattern XY Position recognition method can be used. When a predefined template image is found, the transform returns values for the X and Y positions.

To set up XY position recognition, create a full image that shows the pattern for which the position is to be determined, and measure the length of some distinct feature or attach something of known length near-by. Create a new directory for every signal under the RecoImages directory in the project folder. Place the full images under the Full_Image directory inside that folder.

1.Make sure the Camera transform is set up.

2.In MxTransIt, add the Image Recognition Transform by selecting it from the Toolbox.

3.Configure transform properties: Change the Transform name from the default name to the Signal name you would like to see in the MxVDev TestCase. This is the Signal name that is added to the Signal dictionary.


4.Under Image Recognition Properties, set the Image Recognition Mode to Pattern XY Position.

5.Also in properties, set the Base Directory Path. The name of the folder should be the name of the Signal.

6.Click the 3dots_button button in Configure Image Recognition to bring up the configuration form for this signal.

7.The first page of the configuration form shows images found in the Full_Image directory under the Base Directory for this signal. If no images are shown, click cancel and make sure that the directory points to the right Base Directory and that Full_Image folder contains your full images.

Select the desired Full Image in the list box on the left and draw a rectangle for the Region of Interest around the pattern that will be used for Pattern Recognition. Alternatively, you can input the ROI pixel coordinates manually into the fields on the right. In general, the ROI should contain all possible locations for your whole pattern/template. Using the toolbar under the image, you can Zoom In, Zoom Out, and Pan the Image. The Rectangle ROI tool is used to draw or modify the ROI rectangle on the image, You can move the rectangle by clicking in the middle, or drag bounding lines or corners. The pattern XY location is determined on the location of the Top Left corner of the ROI.

8.After the ROI is selected, create a Sample image by clicking the Add button. A sample image is a version of the full image cropped to the selected ROI. Sample images are used for testing the search algorithm and Pattern creation. You can add a couple different Samples or click 'Add All' to create a Sample image out of all full images (useful to test the XY position in different locations).
Note: Do not click OK. Proceed to the next step.

9.Select the next tab to see the just created sample images. Now draw the rectangle around just the pattern you would like to search for, leaving out as much of the background as possible. Click  the Add button to create a pattern image.

10.Select the Test Pattern Match tab to test the recognition algorithm. First, calibrate physical world units to pixels on the image using the provided 'ruler'. Drag the green line, change its length to match a known length of some feature on the image. Edit the line length in search options. (For example, if the drawn line is 2 inches long, type in: 2). Click the Run Test button. Results are shown, and if pattern is recognized in a sample image, a bounding box is drawn. The score indicates how closely the template image (pattern image) matches the image tested (sample image). The XY position shown is measured from the Top Left corner based on the length of the calibration line. If the position information seems erroneous, review the value for the length of the drawn line.

11.Select the Signal Port Properties tab to specify what values are returned during the test. Mainly this is used to set up the position signal Min and Max values and specify which units are used for length measurement.

12.Click OK when done. Now you can export the transform ports and connect the SourceImage port to the SourceImage port on the camera transform.


Related Topics:

Recognition Modes

Camera Transform

Image Recognition Overview