09-16-2008 02:29 PM
I am working with the pattern matching in the machine vision package. When I enable subpixel matching, I get
x-y locations to 2 decimal places (and not just 1/4 or 1/2 pixel offsets). I'm trying to understand what the subpixel
resolution is in the matching. In other words, can the matching algorithm measure displacements to 1/100 of a pixel?
TIA
Eric Schell
09-16-2008 08:41 PM
This is a yes and no answer.
When you use sub-pixel analysis in pattern matching, the original pattern is compared to the located pattern. I suspect they used convolution or some similar comparison. If the edges change slightly between the patterns, you can measure sub-pixel changes. These changes are calculated using interpolation to find the best position. Interpolation is a type of estimate, so the number isn't going to be perfect, but it is better than rounding to the nearest pixel.
As an example, let's assume you are looking at the image of a bright white vertical bar. The bar is aligned so the edge pixels transition exactly from black to white with no gray pixels. Now let's shift the bar 1/4 pixel to the right. The edge pixels will be different shades of gray. Using these differences, it is possible to estimate the shift of the bar using interpolation. Pattern matching does the same thing.
So here is the answer: Yes, the sub-pixel algorithm estimates position changes down to 1/100 of a pixel, but these values may not be accurate down to that level. I would estimate accuracy to about 1/10 of a pixel in ideal cases, and 1/2 to 1/4 in most cases.
Bruce
09-17-2008 10:48 AM - edited 09-17-2008 10:48 AM
Thanks Bruce!
The one thing that I'll add is that the Vision Concepts Manual (found in <Program Files>\National Instruments\Vision\Documentation\Concepts_Manual.pdf) discusses subpixel accuracy on page 11-9. An estimate of the accuracy can be found on page 11-11:
With the imaging system components and software tools currently available, you can reliably estimate 1/25 subpixel accuracy.
09-17-2008 12:53 PM
I would still say 1/25 subpixel accuracy is an optimistic estimate. Perhaps using really good lighting, really good lens, really good camera, etc. and having very crisp, distinct edges in your image you could achieve that sort of accuracy.
In any case, it is way better than the nearest pixel accuracy!!
Bruce
09-17-2008 05:02 PM
Thanks. Next question: do I have to use the edge detection functions to get this kind of accuracy, or does this
description (in the manual) apply to the pattern matching functions as well. I am using IMAQ Match Pattern 2
block in LV 8.5.1.
09-17-2008 08:50 PM
Pattern matching will do it automatically. Just put a true constant on the sub-pixel input.
Bruce
09-18-2008 07:49 AM
Thanks!
Eric