LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pattern Matching Generates No Score

I've been trying to pattern matching to identify images, but I am not receiving any scores for certain images.  I used Vision Assistant to generate a vi to match templates to images.  I used the Vision Assistant to create templates to attempt to match to certain images.  When I match the specific template I generated for the specific image, I will receive a score of 1000, which is a perfect match.  However, when I attempt to match a different image to the same template, I will not receieve a score at all.  I don't even get a 0 for score, the results are just empty.

 

Here's an example of my problem:

I have images A, B, and C.

I generated templates a, b, and c to match their corresponding images.

Ideally, if I input image C, the code should iterate through each template to attempt to match until c is found.  

So it will match "a" with C first and get a score of 0, then match "b" with C and get another 0, and finally "c" with C, which gets 1000.

 

What actually happens is that, when my code attempts to match "a" or "b" with C, the score is nothing (not even 0), and when it gets to "c" I get a perfect score.  

 

The problem with this is that I have many more images (like D, E, ..., Z) which should also match to template "c".  However, because it was not the template I generated from the original image from Vision Assistant, even though D is supposed to match with template "c", I don't get a score at all.

 

Why is this happening?

0 Kudos
Message 1 of 14
(4,309 Views)

Hello EE_CS,

When you try to match pattern c with image D, E, F, etc, how similar the template image with the images? If you can post the template image and D image, we may be able to respond better why the patterm matching doesn't give you any matching score.

 

Another thing would be in Pattern Matching algorithm, you can lower down the minimum match score parameter in the function so that the algorithm can report pattern with lower score match. Normally, the minimum match score in Vision Assistant is set to 800 points.By lowering the minimum match score, you could check the result of the template against other images containing the patterns.

 

You can try these first and let me know what is the outcome.

 

- Meadow -
LabVIEW 7.0 - 2011, Vision, RT, FPGA
TestStand 3.0 - 4.5
0 Kudos
Message 2 of 14
(4,298 Views)

Hi EE_CS,

 

You mentioned that you generated the LabVIEW code from Vision Assistant. Did the pattern matching work in Vision Assistant?

 

As the poster above mentioned, it will be helpful if you post more details or include your code or a screenshot of your code as well.

Matt
NI Community Team
National Instruments
0 Kudos
Message 3 of 14
(4,265 Views)

Here is an example attached.  If you look at the two images, they seem fairly similar enough to know they should be the same thing.  However, I don't even get a low score for pattern matching, I just don't get a score at all.  

0 Kudos
Message 4 of 14
(4,240 Views)

Hello EE_CS,

I understand your application better now on why you didn't get any score. First picture isn't exactly the same object from the second picture. If you take the second picture (smooth one) as a pattern to match, it is highly unlikely you will get any pattern and vice versa. the difference between the images may cause patterm matching algorithm to miss pattern in the template.

 

What is the lowest score of pattern matching minimum match score value that you have tried to find the pattern? Once again if you keep the value at 800 (default), any pattern lower than that won't be considered as a find.

 

Additional question to you, what are you trying to find between the two images? There may be better algoritm for you to use based on your usage.

 

regards,

 

 

 

 

- Meadow -
LabVIEW 7.0 - 2011, Vision, RT, FPGA
TestStand 3.0 - 4.5
0 Kudos
Message 5 of 14
(4,225 Views)

I guess I may be using the wrong thing to do what I want to do.  I have an image source that I want to identify what it is.  The example I gave looks like a "2", and I just called that image "zig zag".  What I want, is to go through a list of images I have to attempt to match the correct one to the image source.  So say my image source was "zig zag".  I want my program to check with a list of images to match "zig zag" and identify the image as "zig zag".  The list goes through a bunch of other patterns until the "zig zag" pattern is found.  The image source "zig zag" won't always look exactly the same, but it's supposed to be identified as "zig zag" regardless.  So essentially, I'm comparing an entire image to attempt to match.  Hopefully I explained it well enough for you to understand.

0 Kudos
Message 6 of 14
(4,209 Views)

EE_CS,

What you like to do is a case for pattern matching. You may want to try to edit adjust the template file that you have to ignore certain area of the template which contains the growth in Vision Assistant or in Template Editor. There is a tool to ignore certain area of the template and ensure that pattern matching only try to match the S area of the zigzag

The issue that you have is difference in the template and the image that you are inspecting because there is some "growth" over the object. By ignoring the area where the possible "growth" located, the pattern matching algorithm should give you a higher finding value and more consistent finding.

 

EE_CS, what is the value of your "Minimum Match Score" in the Pattern matching?

- Meadow -
LabVIEW 7.0 - 2011, Vision, RT, FPGA
TestStand 3.0 - 4.5
Message 7 of 14
(4,182 Views)

I played around with a few images, to alter them slightly, and I'll get a score in the range of 900s when I do that.  But for the example I posted earlier, I don't get a score at all, regardless how low I set the minimum score match.  I don't get a score of 0 either.

0 Kudos
Message 8 of 14
(4,148 Views)

Hi EE_CS,

 

Is it just this one image that returns no score or is it any image? Is the pattern matching being performed in Vision Assistant or is it LabVIEW code that you have built from Vision Assistant. If so, can you include a copy or screenshot of your code?

 

Thanks,

Matt
NI Community Team
National Instruments
0 Kudos
Message 9 of 14
(4,128 Views)

From my experience, it's any image that is not close to what I am attempting to match will get a "non-score".  My code is rather messy, but I can try to explain what I am trying to do.  I used Vision Assistant to generate a vi code to experiment with the images, but the rest is done by Labview code.  

 

In my block diagram, you can ignore the code in the  beginning up until the big loop towards the end.  In the big loop, I am looping several templates until pattern matching matches the appropriate figure (image) to the template.  In the front panel, just load the same sample image through both the "reference" and "target".  On the right, "template matching" are the different templates you can use to attempt to match the image.  If it matches at any time, it will exit the loop and display the "shape type".

 

The template I am currently using is an older template, and looks slightly different from the finished result of using Vision Assistant.  But a score is still not given.  It would be great if you could locate what's wrong.  If my explanation was not very clear, please feel free to ask for more detail.

Download All
0 Kudos
Message 10 of 14
(4,109 Views)