Tracking Motion in NI Vison Assistant

by brianjp93 in Circuits > Software

4176 Views, 10 Favorites, 0 Comments

Tracking Motion in NI Vison Assistant

11.png
12.png

This tutorial is assuming that you have already saved a series of images that you would like to track.

Once you have NI Vision Assistant up and running, click on "Browse Images" in the upper right, and then click on the file icon to open up files.

Find Your Files and Choose All

13.png

Go to the folder where you saved your images and mark the "Select all files" box. Open them.

Process Images

14.png

You will now want to "process images". Do this by clicking the process images button in the upper right, next to the browse images button.

Creating a Script

15.png

You must create a script in the program. This is basically a very simplified version of coding. First we must calibrate the image and give the program a conversion rate from pixels to micrometers. Do this by hitting the "Image Calibration" option in the left menu.

Image Calibration

16.png
17.png
18.png
19.png
20.png
21.png
22.png

Once you have clicked the "Image Calibration" option, you need to go through a few steps that are mostly self-explanatory, but I'll walk you through them anyway.

1. If this is a new calibration, choose "new calibration". If you have done a calibration in the past that will work for this one, you may click on the file button to search for that calibration data.

2. Assuming you chose "New Calibration", you will be given a pop-up. Choose the first option, "Point Distance Calibration" and hit Next.

3. On the next page, select an image which contains the object you wish to track and go on.

4. You will want to zoom in on the object until it takes up a good portion of the screen. This is so you can see more easily when you choose edge points on the sphere.

5. Click once on one edge of the object, and again on the opposite edge. Then, provide information for what that distance is in the "Real World".

6. Skip the lens correction. Now you are given the option to specify a calibration axis. Go ahead and do so. I chose the center of the ball to be the origin, more or less.

7. Now you should be finished with the calibration. Hit OK, at the bottom of the left menu.

Pattern Matching

23.png
24.png
25.png
26.png
27.png
28.png

There are a few different ways to track an object in Vision Assistant, but in this case we are using Pattern Matching.

1. In the left menu, click on the 5th option which is a magnifying glass and some cross-hairs. This will give you a new menu. From this menu, choose "pattern matching".

2. Make a new template.

3. Draw a box around the object you want to track and click next.

4. If there are superfluous pixels, you can highlight them out. Hit finish.

5. Constrain the large green box the area that your object will be during the entire series of images.

6. You will be asked to save the pattern matching data. Do so. You may offset the center so that the cross-hairs are at the center of your object. When you are done, hit OK at the bottom of the left menu.

Save Your Script

29.png

Now your script is done. Save it by hitting the save icon in the bottom menu.

Batch Processing

30.png
34.png
32.png
31.png
33.png

To make the script run for many images, we need to do a batch process.

1. Select "Batch Processing" under "tools" in the top menu bar.

2. Specify a path to your images. Find the folder in which your images are located and choose "Current Folder".

3. You will need to select the Pattern Matching step, and mark the "save results" box. Then click "setup".

4. From here, you will be asked to choose a save location. Be sure to choose a folder that ALREADY EXISTS. Vision Assistant will not create anything if the folder isn't already there. Now run the script!

5. The program will run the script for every image in the folder that you specified. Data will be saved to a new file in the folder that you specified in sub-step 4. You will need to parse this data to get only the information that you want eg. position data. This can be done with filters in microsoft excel.

All done!