Labview: Template Recogntion

Hi, I am from team 3006, and our software section has been trying to work on taking an image from the AXIS camera and recognize a black and white template image, and finding the location of all matches above a score, for example of 800.

First thing we tried was to work in NI Vision Assistant with static images. We realized that in NI Vision, the best script was one that ran a color-plane extraction: Value plane, the doing a Color Threshold, and then using the shape matching option from the Binary Image section. We then created several more static images with the template and added some “noise”, ran these through the script, and found that it successfully recognized all sizes of the template.

Logically, from here we used the tool to create the VI, from there I ftp’ed our template image onto the robot and fixed the file path for the template. From here we ran the robot and used probes, shocked to find that the template image was only black. However, after a day or so, I saw that in the code, the automatically-created VI grabs the template on the first call, and uses whatever it gets as the template forever. I instead removed the case structure and had it continuously take in the template, and voila, the image was now there.

That was the least of our problems, from there we began to analyze the image from the camera, the color plane extraction worked perfectly, however the threshold turned the image black no matter what values I gave it. Thus, I removed the Threshold form the code, went back to Vision Assistant, removed the Color Threshold there, ran the recognition tests again, and found that it worked. Thus, the final code which we tested, read the template continuously, and only used a Value-plane extraction.

From here, all the inputs to the Shape matching VI seemed to all be correct when probed, the template was there, as was the black and white image, yet no matter what sort of shape matching, template matching VI we switched in, none of them recognized the template.

Anyone have any ideas how to proceed from here, sorry for the long explanation, but I find it helps people to understand a problem if they have some background.

As I was reading, I was wondering if you were really doing a color threshold on a grayscale image. I can’t get vision asst to let me do that immediately following a plane extraction. If you have the original script and/or any idea of how you got it to do that, could you send that to technical support?

I’m also curious what the ultimate code looked like as doing a color threshold on a monochrome image will produce a runtime error. If it doesn’t change the image, perhaps that would explain some of what you saw.

You shouldn’t need to reload the template image. You may want to check that the operations downstream don’t modify the image. If an image VI takes the template in as source and you don’t wire up a fresh destination image, most blocks will modify the source. Another way this can happen is if the image names are not unique. IMAQ in LV is one of those old odd birds that aren’t really dataflow. The image must be created, and the name makes it unique. I’m pretty sure that multiple creates named “fred” will then reference the same image and will affect each other.

If you go back to image asst and build the simpler script with just the plane extraction and template finding and generate code, do things work? I wonder if most of the issues aren’t from an invalid script in the first place.

Greg McKaskle