Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

bugs in IMAQ correlate

Solved!
Go to solution

So, I've identified two major bugs in IMAQ correlate which make it unusable for my application (see post at http://forums.ni.com/ni/board/message?board.id=170&message.id=401078#M401078 for details concerning the bugs in IMAQ Correlate). Does anyone have a dll or C++ source code for normalized cross correlation that I could use instead? 

 

-root


global variables make robots angry


0 Kudos
Message 1 of 12
(8,353 Views)

Have you tried using the CrossCorrelation VI under Signal Processing?  Alternatively it may not be too hard to roll your own based on IMAQ FFTs, for example:

 

 IMAQ CC

 

You'll obviously need to zero-pad your images if they're not the same size already.

 

Cheers ~ Greg

 

 

Message Edited by GregS on 04-20-2009 09:27 AM
Message Edited by GregS on 04-20-2009 09:29 AM
0 Kudos
Message 2 of 12
(8,331 Views)

Unfortunately, I need the normalized cross correlation. Although cross correlation can be efficiently implemented in the transform domain, the normalized
form of cross correlation preferred for image feature matching does not have a simple frequency domain expression. Oddly, it appears that the CrossCorrelation VI in the signal processing palette does not contain the functionality to produce a normalized cross correlation for a 2D array.

 

-root


global variables make robots angry


0 Kudos
Message 3 of 12
(8,314 Views)
Solution
Accepted by topic author Root_Canal

Sorry, I misunderstood.  I haven't needed Normalized CC in the past, but I had a quick look at what might be required.  The best reference I found was Lewis (1995) "Fast Normalized Cross-Correlation" (PDF link) which implements it using Sum Tables.  If I get a chance, I'll see if I can code it up (doesn't look too difficult) - but probably using arrays rather than images so that it's reusable for 3D images.  It appears that the numerator of the NormCC can still be computed in the frequency domain, and the sum tables speed up the computation of the denominator.

 

Cheers ~ Greg

 

Message 4 of 12
(8,284 Views)
As it turns out, that's the exact paper I was plagiarizing in my previous post. I think I was just being stupid about needing a normalized cross correlation for fast image registration- I can do just as well with a non-normalized cross correlation of two giant binary feature maps. Sadly, this revelation doesn't appear to do me that much good as far as optimizing processing speed. While it's obvious how to reduce the "search window" of the direct cross correlation method, I haven't the foggiest idea how to do that with the frequency domain method. It doesn't seem like you'd be able to. Maybe use wavelets instead? I dunno.
 
After timing the FFT method of computing the cross correlation and a direct method, I have a strange feeling that the IMAQ correlation VI is using the method identified in that paper, or a similar FFT based technique. The IMAQ correlation computation time is very close to the FFT based method that you posted (it's actually quite fast). The IMAQ correlation computation time with a template larger than the optional search window input seems to be larger than, but on the order of a direct cross correlation method. This also goes a long way toward explaining the glitch of the correlation map going black (all zeros) when the search window is small and happens to overlay a black area in the source image.
 
The obvious solution to the glitch in the IMAQ correlation VI is for NI to put in a simple conditional statement to test their assumption about the relative size of the template image and the search window, and then search over a window equal to or greater than the size of the template if they are indeed using an FFT based method. I'm quite irritated that they have the gall to trivialize the erratic behavior of their VI instead of just implementing an obvious and easy fix. Typical, really. Makes me suspect that they are understaffed.
 
As far as a Fast Normalized Cross Correlation for 3D images- are you doing hyperspectral image work? That sounds like it might be useful for registering images on one of those scanning hyperspectral imaging systems if it happens to be moving. What kind of speed do you think you could get off of a modest voxel resolution?
Message Edited by Root Canal on 04-22-2009 07:16 PM
Message Edited by Root Canal on 04-22-2009 07:16 PM

global variables make robots angry


0 Kudos
Message 5 of 12
(8,278 Views)

I've coded the Normalized Cross-Correlation anyway - here it is if you're interested.  It's not much slower to compute the normalization using this method.  If it seems useful, you're welcome to use it.  Extending it to 3D would be straightforward as well. With 3D, I'm not doing hyperspectral imaging, just 3D confocal imaging.

 

Cheers ~ Greg

 

Message 6 of 12
(8,271 Views)

Nicely done! It seems that for large images and templates, the only reasonably efficient technique is one such as this.

 

-root

global variables make robots angry


0 Kudos
Message 7 of 12
(8,243 Views)

Hello Folks,

 

I am working on a project to determine strain measurements for Biaxial Tension sytem for any given sheet metals. Using labview, I have written a simple application for calculating stress-strain curves from images taken on our Biaxial system. And now I would like to extend my work to two camera system (sterioscopic).  I was reading about Digital Image Correlation techniques, but couldn't progress much and I also think my basic understanding of Cross-Correlation techniques is not that good. I would really appreciate if you folks can point me to some right direction i.e. basic concept, articles, some examples using image analysis etc. The idea is to where I should start and which path of learning to follow?

Thanks.

 

Hansa

0 Kudos
Message 8 of 12
(7,861 Views)

Hello Hansa,

 

For explanation of the concept of normalized cross-correlation using NI's algorithms, I would look at the Vision Concepts Manual (\Program Files\National Instruments\Vision\Documentation). Page 12-5 to 12-7 might have some information of interest to you. There are no built-in functions for stereoscopy in NI Vision, but you should be able to implement a custom algorithm in LabVIEW. 

 

Here is a developer zone article that explains general image analysis and processing techniques:

Image Analysis and Processing

 

I hope this helps.

Vivek Nath
National Instruments
Applications Engineer
Machine Vision
0 Kudos
Message 9 of 12
(7,837 Views)

Hello Vivek,

 

Thanks for the reply. But the enclosed reference to Image processing does not work. Kindly post the link again.

Thanks.

 

Hansa

 

 

0 Kudos
Message 10 of 12
(7,833 Views)