Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Instability in pattern matching

The geometric matching is even wieder.

 

Geometric_bug.png

0 Kudos
Message 51 of 117
(1,152 Views)
Hello Muks, As I wrote previously, there seem to be problems with Pattern matching and geometric matching. But, to my misfortune, our project is based on this functions. Therefore we are unable to continue and unable to deliver our project to the customer. You wrote that you have contacted NI. How can we speed up the process?
0 Kudos
Message 52 of 117
(1,133 Views)

Have you tried contacting your local rep?

0 Kudos
Message 53 of 117
(1,125 Views)

Because this image is so large, you can try a few different things depending on what you're looking for:

1. For accurate position/angle, use PM with the pyramid algorithm. This will reduce the size of the image where the initial matches are found. See PM Full Size for an example of this. With the smaller initial sample size and the larger reduction factor, it takes about 1 second on my machine.

 

2. For slightly less accurate results, I did a threshold, and then a binary operation to remove some of the edge details since small differences in the edges of this huge part can compound to produce widely varying scores. See the Binary GPM script. This takes about 600ms on my machine.

 

3. You could also try the Shape Matching algorithm, but it doesn't return angle information and it takes a little over 1 second on my machine.

 

4. You can reduce the size of the image if you don't care about position/angle and just want to count the parts. See the Small GPM example. This only takes about 100ms on my machine.

 

Hope this helps,

Brad

0 Kudos
Message 54 of 117
(1,112 Views)

I had trouble attaching everything at once, so here are the other scripts:

Download All
0 Kudos
Message 55 of 117
(1,111 Views)

Here are the templates I used (I used your template for the PM Full Size script.

Download All
0 Kudos
Message 56 of 117
(1,110 Views)

Brad,

 

Thanks for responding and having a look at this thread.  Even if the template is big shouldnt the master image get detected? Dont you think it is a bug?

0 Kudos
Message 57 of 117
(1,105 Views)
Hello Brad, thank you for your answers. But that was not my question and problem. My problem is instability in pattern matching and geometric matching. As muks also asks: "Even if the template is big shouldnt the master image get detected? Don't you think it is a bug?" Why would i use now another methods? If Pattern matching and/or geometric matching should have worked as they should be i would have not any problem. Who can guarantee one hundred percent that these new methods stabil works? I need most accurate position/angle because after matching use i golden template to detect defects. P.S.: i can't open "PM Full Size.vascr"
0 Kudos
Message 58 of 117
(1,100 Views)

I think the instability could be due to the combination of algorithm settings and the image size/content. Here's what the help says about Low Discrepancy Sampling for the Pattern Matching step in Vision Assistant:

  • Low Discrepancy Sampling—Extracts the most significant information to represent an image. If the template is very small, has a wide aspect ratio, or contains large regions of similar grayscale information, use one of the pyramidal matching algorithms instead.

Since your image has all white or black, I don't think this is a good algorithm to use with this image. I also saw that the GPM algorithm didn't find the same object that was used for learning, until I increased the number of objects to find. Instead of using the existing PM template in the GPM step, if I relearn a new template, than it works fine. I did notice that in the PM step if I turn on rotation it finds all the objects except the one I learned (which seems wrong, so I will CAR this), but the algorithm developers may say that the algorithm is expecting more grayscale variations since this is what is used for matching and since there is only black or white, the algorithm isn't expected to do well with this type of image. That's why I was recomending other ways to find your parts that will be more stable/accurate.The Grayscale Value Pyramid value I modified to get good results and relatively fast response time was the Match List Reduction Factor = 10.Sorry the algorithms aren't always stable/reliable for any image...good idea to read help in this case. The concepts manual goes into much more details about the algorithms and the types of features/images that work best for the different algorithms.Hope this helps,Brad

Message 59 of 117
(1,095 Views)

 I did notice that in the PM step if I turn on rotation it finds all the objects except the one I learned (which seems wrong, so I will CAR this

 


 

 

 

 

Of all the above explanation i wanted to hear this. Thanks

Message 60 of 117
(1,087 Views)