Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Instability in pattern matching

I agree that the formatting needs work. I will file a CAR for this improvement as well. Sorry for the confusion.

Thanks,

Brad

Message 91 of 117
(886 Views)

Hello Brad, i use GPM with "edge based". I prefer GPM because, as you can follow, PM is for my project at least 4 times slower than GPM.

 

I prefer to use as search strategy "conservative" because i need very accurate results.

 

Yoy have my two images (img001.png & img002.png). I think there's no siqnificant diffrence between this two images. But GPM (edge based, conservative) finds not all parts in second image.

 

may question still remains:

 

Is there a CAR for this instability problem?

 

0 Kudos
Message 92 of 117
(886 Views)

Hello Brad, as i wrote before sometime i must use GPM with conservative search strategy and sometimes i must search GMP with balanced search strategy if i want to find all parts. I will post this images, too.

 

We have an open system, meaning templates are unlimited. For our project speed, accuracy and stability too important. At the beginning our project, we did a long preliminary study and compared all results:

- Pattern Matching (PM) or Geometric Pattern Matching (GPM)

- PM with low discrepancy or one of the pyramidals?

- GPM with edge based or feature based? Conservative or balanced

- and so on...

 

We've tried all the methods. After a long period of analyse we decied that we use GPM (edge based, conservative search strategy). It was going good until the problem here i described before.

 

So, all these solutions are not a real solutions for us. We are thinking that there is a fundamental problem with GPM.

0 Kudos
Message 93 of 117
(879 Views)

If you could provide your library of images, we could take a look and see why some of the images have objects not found and see if tweaking the advanced parameters may help make the algorithm work better for your images.

 

Thanks,

Brad

0 Kudos
Message 94 of 117
(878 Views)

Hello Brad, i will post the images as soon as possible. But you have already have two images (img001.png & img002.png) 🙂

 

First, would you agree that there is no significant diffecence betweet this two images? If yes, can you explain why GPM (edge based, conservative search strategy) can't find all part that we are searching?

 

I think if NI study even just these two images with  GPM (edge based, conservative search strategy) and find all parts with GPM (edge based, conservative search strategy), we will be one step closer to a real solution.

 

What must be done more, so there is a CAR for instability problem?

0 Kudos
Message 95 of 117
(872 Views)

I see the issue you are talking about and I will CAR this to algorithm group as well. I believe this may due to the large number of edges in your parts and the fact that your were using an Edge Filter Size of "Fine". I relearned the template with Extraction Mode: Uniform Regions and Edge Filter Size: Normal and then I used these settings when searching and with a Conservative Search Strategy, it finds all objects in all the images you posted. I would not recommend using the Fine Edge Filter Size since your image is so large and there may be small offsets in the edges that can accumulate over all these edges, so using a Normal Edge Filter works better at filtering out these small variations.

 

I'm not sure how this will work with your other images, but it's a start. I read the following information about GPM in our Vision Concepts Manual:

"

When Not to Use Geometric Matching

The geometric matching algorithm is designed to find objects that have distinct geometric information. The fundamental characteristics of some objects may make other searching algorithms more optimal than geometric matching. For example, the template image in some applications may be defined primarily by the texture of an object, or the template image may contain numerous edges and no distinct geometric information. In these applications, the template image does not have a good set of features for the geometric matching algorithm to model the template. Instead, the pattern matching algorithm described in pattern matching, would be a better choice.

 

In some applications, the template image may contain sufficient geometric information, but the inspection image may contain too many edges. The presence of numerous edges in an inspection image can slow the performance of the geometric matching algorithm because the algorithm tries to extract features using all the edge information in the inspection image. In such cases, if you do not expect template matches to be scaled or occluded, use pattern matching to solve the application.

"

 

I'm not sure if there are too many edges, but hopefully using the Normal Filter will result in more stable results since PM takes much longer for the Pyramid based algorithm.

Hope this helps,

Brad

Message 96 of 117
(862 Views)

Hello Brad,  thank you for help and your answers. But ( a big Smiley Happy):

 

These two images (img001.png & img002.png)  almost the same. We didn't change anything. There is just 3 seconds time difference.Same parts, so same number of edges.

 

I would understand if GPM (edge based, conservative search) didn't find all parts in img001.png, but it did. So, logically i expect that GPM (edge based, conservative search) find all parts in img002.png, too. Because, i far as i see, there is no detectable difference between two images.

 

0 Kudos
Message 97 of 117
(859 Views)

When I talk about edges, I'm referring to the edges the vision algorithm detects. The contour of the edge along your parts will not be exactly the same and there may be small differences that a Fine Edge Filter Size picks up on. I was just hoping you could try relearning the template with Normal Edge Filter and Uniform Regions Extraction Mode and use these for searching as well and see if this works for all your images. I have already filed a CAR about the Fine Edge Extraction mode being too sensitive and we will see what the algorithm engineers come back with. Sorry your parts require some careful selection of parameters, but hopefully we can find the right combination of settings to give you robust and reliable results.

Message 98 of 117
(855 Views)

Hello,

 

in case anybody wants to compare the pattern matching algorithms from Labview and OpenCV, please see here:

 

https://decibel.ni.com/content/blogs/kl3m3n/2014/07/09/labview-vs-opencv-template-matching

 

I have also made some comments based on my (very) brief testing.

 

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
Message 99 of 117
(836 Views)

Hello Klemen,

about speed: As far as i know, with OpenCv it's possible to use GPU-Accerelation (CUDA and/or OpenCL). Thus if we use Template matching in OpenCV with GPU accerelation, then NI Vision  has no advantage over OpenCV.

0 Kudos
Message 100 of 117
(830 Views)