Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Instability in pattern matching

Hi, i need some advice on this. I use Imaq pattern matching to check the components of a pcb board. Presence and orientation of components. I am close enough to complete the program and i'm testing it on my table with natural, but not direct, light.

By now i have obtained good, but not stable, results. From time to time i get a collapse on the matching score, even to zero. Without moving the board under my camera. So i think that the problem is the natural light and his minimum changing during the testing. Reading the documentation from NI i found that the pattern matching should be resistant to light changing in the ambient, so i dont really understand the problem.
Should i not to trust the pattern matching and using it only on stable lighting condition? Or maybe there are some problems in the code?

0 Kudos
Message 1 of 117
(6,192 Views)

Please make the lighitng stable. You will not get repeatable results in pattern matching and for that matter you will find difficulty in all image processing functions

0 Kudos
Message 2 of 117
(6,137 Views)

Thank you very much, i already had a strongly suspect that the problem is the non stable lighting conditions. Evidently even when the human eye cannot catch the difference, the pattern matching function can.


muks ha scritto:

Please make the lighitng stable. You will not get repeatable results in pattern matching and for that matter you will find difficulty in all image processing functions


 

0 Kudos
Message 3 of 117
(6,133 Views)

 One technique that you can try is use a very high intensity lighting and operate the camera in mimum aperture which will make the ambient lighting have no affect in your system

Message 4 of 117
(6,126 Views)

Good idea, thank you.

0 Kudos
Message 5 of 117
(6,124 Views)

Hello,

 

lighting is very important, but based on what you said, I am not sure that your current matching fails because of the lighting variation. 

 

Normalized cross-correlation is invariant to uniform lighting changes, but not to non-uniform, such as local reflections for example (it is also not invariant to scale changes and occlusions) . You've said that you cannot visually see the difference between the positive and the false/no match, so I  fail to see how the pattern match fails. I have found the Vision Pattern Matching really stable and roboust in various conditions. Are you sure there is no error in your code?

What seems strange to me is that you have the PCB board positioned on the same spot and the matching fails at one time and gives a positive match at the other... This should not happen using the natural lighting, since I don't belive that the intensity variation is non-uniform to such a degree that it would interfere with the correlation score calculation. 

 

Anyway (regardless of the above), try to use constant lighting when finising your application, so you don't need to re-learn the template descriptors. This will also give more accurate results.

 

P.s.: You can post the part of the code that does the matching here, and we can take a look at it. Disregard this, if the lighting is really the issue (I would be suprised that it is in your case!)

 

P.p.s: The type and the direction of the lighting varies from apllication to application. You need to select the most suitable for your application. I will not go into details, but there are a lot of guidlines online. This one is pretty good:A Practical Guide to Machine Vision Lighting - Graftek Imaging. 

 

 

 

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."
0 Kudos
Message 6 of 117
(6,110 Views)

I feel this is definetly because of irregular lighting and i personally feel pattern matching is not "very" stable too.

0 Kudos
Message 7 of 117
(6,099 Views)

Hello,

 

it seems that you hava a valid (and probably the correct) point...

 

What seems strange to me is this part from the first post:

 

"From time to time i get a collapse on the matching score, even to zero. Without moving the board under my camera. So i think that the problem is the natural light and his minimum changing during the testing."

 

The board is not being moved and there is minimal change in light. I have seen pattern matching performing correctly with rotation, shift and quite moderate intensity variation (it failed when trying to match reflective material subjected to motion due to reflectivity shifts). But I am really speculating here, since I do not know what is the object and what is the lighting in this case.

 

Some images of matches/non-matches should be more instructive in order to test the behaviour of the application.

 

Also, if there are problems with the intensity based matching, one could try geometric based matching.

 

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."
0 Kudos
Message 8 of 117
(6,091 Views)

Some images of matches/non-matches should be more instructive in order to test the behaviour of the application.


Very valid

0 Kudos
Message 9 of 117
(6,084 Views)

I think i found the problem, or maybe the bigger one. First of all i have some fiducials on the board and i must find it to recalculate the relative position between the searching area and the board. The first time i had tryed to adapt the searching area and the "template matching function" to the rotated board by using the "rotation invariant" searching. Now i have modified this and i first rotate the image and make it perpendicular again and then use the pattern matching function but in his "shift invariant" form. I hope i explained what i mean.

 

Do you think this can be the problem?

0 Kudos
Message 10 of 117
(6,061 Views)