Pattern Finding II

By Chris Walkowicz on Fri, Jun 03, 2011

  As I promised in an earlier blog posting, here is a tip for increasing the robustness and decreasing the process time of the Pinpoint Pattern Find® tool. The goal here is to search for the white box which encapsulates the data matrix code in the sample images.

Please note that I am using images from the IMPACT Software Suite sample programs. These images have names starting with “Sample 1D 2D code.”


There are a number of ways to find the white box surrounding the data matrix code. In this example I will use a pattern find tool to locate the white square and ignore the actual data matrix code. Since the data matrix code changes from part to part, it is helpful to ignore it during the locate. Also, this method of finding is less susceptible to noise and is quite fast in comparison with most other methods.

Below, I explain the steps needed to set up this example using IMPACT’s Vision Program Manager.

1. Load the designated images into the file camera

2. Open a new vision program.

3. Open the Locating tool box and drag and drop the Pinpoint Pattern Find tool into the program.

4. Trigger the camera to load an image into the program.

5. At the top of the Image Window, find the radio button labeled “2. ROI” and click it. Note that Step 1 was completed automatically

6. On the image, find the yellow ROI (region of interest). Click the upper left corner and drag it to the position on the image shown below. To resize the ROI, click one of the edges and drag it to the desired size. Try to position it to exclude the dark letters below the white square.

7. With the ROI still selected, click the rectangle ROI button in the menu on the left side of the Image Window and select Create Rectangle ROI.

8. Drop the new ROI inside of the existing ROI. This will subtract the small ROI from the larger ROI, creating a mask as shown in the image below.

9. Reposition and resize the interior ROI as shown in the image below. The idea is to include the white edge of the white box and exclude the data matrix code.

10. In the Search Limits box, click the drop down menu Possible Rotations and select + - A Few Degrees. This tells the tool to search for that shape even it rotates a few degrees. You can define “a few degrees” in the Start and End boxes. See the image below.

11. Click the Train button.  As you can see in the image below, only the perimeter of the white box is trained.

12. At the top of the Image Window, find the radio button labeled “3. Search ROI and Pass/Fail” and click it. Position the green ROI on the image as seen below. This defines the area where the tool will search for the pattern you just trained.

And that’s it! Here are some images showing the Pinpoint Pattern Find® tool in action.


An innovative leader in machine vision and laser integration deploying systems using advanced sensor technologies servicing industrial automation, scientific and military partners.