Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Template generation for pattern matching using Vision Assistant

Does anyone know how Vision Assistant (7.0) generates its templates for pattern matching? Any info on how it selects its parameters would be much appreciated.

I've read the paper on Advanced Pattern Matching Concepts, and the pattern matching itself (in LabVIEW 7.0) works fine, but I cannot seem to generate templates that work as good as those generated by Vision Assistant. My templates are greyscale and down to 100x100 pixels in size. We need to sense 360deg rotation _and_ get reliable score, position and angle for a subsequent XOR operation. I use the Advanced IMAQ Setup Learn Pattern 2.vi but can't seem to get the parameters right. I've increased the sample size and improved the angular resolution, but s
till the templates generated by Vision Assistant yield better (read: the only acceptable) pattern matching performance.

Best regards,
Michael Hansson
MH Consulting, Inc.
0 Kudos
Message 1 of 8
(6,707 Views)
Hello Michael.

This is an interesting predicament. I have done a little digging on this issue, and to the best of my (and a couple of other engineers') knowledge, creating a template in Vision Assistant simply calls the standard template setup (IMAQ Setup Learn Pattern 2) and then the IMAQ Learn Pattern 2 functions. I have done a little experimentation, and have received similar results from both implementations. Not that this means much, the file sizes for creating the templates both from Vision Assistant and from LabVIEW using the 'defaults' are nearly identical.

I would try to save an example image to file, and then use both LabVIEW and Vision Assistant to create an identical template in both. Then, take a look at the differences in the files as well as the
performance of each of these templates. As I mentioned, in my case they were nearly identical, but it sounds like they may be a little different in your case!

Regards,
Colin C.
Applications Engineering
Colin Christofferson
Community Web Marketing
Blog
0 Kudos
Message 2 of 8
(6,707 Views)

Hello guys,

I'm still having a very similar problem as Michael. I have to make a "Pattern Matching application".

I have to save a template image after having used "IMAQ Rotate", "IMAQ Shift", "IMAQ Find Circular Edge" on a image (pixel res.1280x960).After this elaboration the image is right extract the sub-image that I want to save as a template. To do that I use "IMAQ Extract" function and the image becomes 280x370, then I process the results with "IMAQ Clear Overlay ", "IMAQ Setup Learn Pattern 2" and "IMAQ Learn Pattern 2", before to save the image with "IMAQ Write PNG File". When a test my program with the template images saved in this way the "Pattern Matching" doesn't recognize them. 

I tried to save template images using Vision Assistant and using these ones the  "Pattern Matching algorithm" works ok and I have the results that I want.

Please explain me a way to save template images in LabView (I'm using 7.1.1 version for this application).

Best regards.

Michele Rossi

AUROS

Software e Tecnologie per Automazione

0 Kudos
Message 3 of 8
(6,481 Views)

Try using "IMAQ Write Image and Vision Info" instead of writing a PNG file.  This includes all the pattern training information along with the image.

Bruce

Bruce Ammons
Ammons Engineering
Message 4 of 8
(6,478 Views)

Thank you Bruce,

I have already tried your suggestion, but if I use "IMAQ Write Image and Vision Info" in my LabView PC program and “IMAQ Read Image And Vision Info” in the real-time target program, the CVS answers me with this error code: “-1074395989 --> IMAQ Vision:  (Hex 0xBFF604AB) Unable to read data” and I can’t have the results that I would.

I tried to simulate the situation with a test program that works with off-line “png images” (in other words, loading images previously taken and saved on PC) and the template images that I save with my program.

I found that the same functions used in LabView under Window XP operating system works well and recognizes the template in the bigger image but its give me error under Phar-Lap operating system if I try to use them in NI-CVS 1455.

Thank you in advance for your suggestion.

Best regards.

 

Michele

 

AUROS

Software e Tecnologie per Automazione

 

0 Kudos
Message 5 of 8
(6,462 Views)
Hello Michele,

First, try checking if the file path of the image is correctly defined for the Read Image and Vision Info function.

I believe using the IMAQ Write/Read Image and Vision Info is the way to go.  If the file path is not the problem, could you post a small VI that uses the IMAQ Write/Read Image and Vision Info and shows your described behavior?  The VI should work under Windows XP, but not work when you use it on the CVS (gives error -1074395989) like you described.

Allen H.
0 Kudos
Message 6 of 8
(6,445 Views)

Hi Allen,

Thank you for your suggestion.

I have tested the file path and it’s right, so , my conclusions after much more tests are that:

 

1) In LabView 7.1.1 something is different in saving "png" images vs. NI Vision Assistant 7.1.1  (“IMAQ Write Image” and  “IMAQ Write Image And Vision Info” doesn’t save the images with all peculiarity like the function used inside the NI Vision Assistant 7.1.1)

2) There is a problem in IMAQ Vision RT 7.1.1 and, also in IMAQ Vision RT 7.1.2, in reading image files (“IMAQ Read Image And Vision Info" doesn’t works correctly, so, I’m obliged to use ” IMAQ Read Image” to compare an image with a template but loosing all the information in the template images).

 

I’m very busy in this time because I’m doing tests on the machine where I have to install this vision software and I’m late in making other software control code result of the time that I lost in trying to solve this problem but I will try to send you my VI’s in a shortest time, give me a little time to make some modification to simplified them.

 

Michele

AUROS

Software e Tecnologie per Automazione

0 Kudos
Message 7 of 8
(6,434 Views)
Hi Allen,
in "zip" file attached at this message you can find the simplified VI's.
You can test the saving function
1) running "SaveTemplate.vi",
2) loading a "png" image previously acquired.
3) defining a rectangle to extract the template image
4) Inserting the path of the template
5) Optionally you can calibrate the image using, for instance, a grid image.
 
The TCP function are a modification of the TCPIP communication function
that are present in LabView VI's exemples.
You can find more information opening the relative VI's.
I hope that my programming way could be enough easy to understand,
write me back if you need more information.
I "truly" hope that you could find an error in my program and, so,
you could suggest me a solution.
 
Bye
 

Michele

AUROS

Software e Tecnologie per Automazione

0 Kudos
Message 8 of 8
(6,423 Views)