I am trying to utilize "IMAQ Correlation" VI to correlate two near identical images. But this VI takes more than 5 minutes just to process two images of size (1280 x 1024). I need to track the position/location of various particles in an image during the course of my experiment (about 300 ~400 images).
Any help or suggestion will be greatly appreciated. Thanks.
You need to input values into the Optional Rectangle input to reduce the size of the area where the cross correlation occurs. The only other option is to reduce the resolution of the image. Otherwise you are probably out of luck.
Thanks for the reply. I did use the optional rectangle option, which was faster and resulted in all "white" pixels in that rectangle in final image (out). Generally, in mathematical expression - Normalized correlation gives the output between -1 to 1. So how should I intrepret the white pixels as? Will it be a right approach, if I make a template size of 50 x 50 pixel and peform the correlation analysis for a whole image using a loop? Any suggestion !!!
Basically, I am trying to understand how this IMAQ Correlation VI is working. I couldn't find much explation other than whatever is given in general help or IMAQ concept manual, which is not very clear.
Your program seemed to work fine for me. For your image, the point of maximum correlation should be near the center, so I change the optional rectangle to that area and then extracted those pixels to look for the location of the maximum. I have attached it with a few changes.
Also, there are ways to parallelize the correlation function and tile them together for a larger image. How effective this is will depend on the PC being used. The first step is to open up the IMAQ Correlate function and go to its properties and make it reentrant in the Execution tab. I will try to past a parallelized version based on your images over the next couple days.
Thanks again for your help. The intensity graph is a better way to understand this. Now, if you look at the mathematical formulation of Normalized Cross-Correlation (as also given in Chapter-12 of Vision Concept Manual), the output should be in the range of (-1 to +1), where +1 value shows the highest correlation. Is this similar to the results of LabView VI, which gives the result in the range from 0 to 255, where 255 being the highest correlation?
The parallel execution method you had mentioned is new to me. So I am curious to know about this and will wait for your reply. In my experiment of the strain measurement, I will be looking at the material under observation using a rectangular mask. I have to correlate all the area witin the mask probably using a tile/facet of 30 x 30 pixel area or more depending on the speckel pattern (spray paint) size on the specimen under test. Now to speed up this process, parallel execution will be great asset. Any more suggestion/direction !!
Thanks again for all your help and will wait for your next code.
Attached is some files to compare a parallelized version versus the regular one. I have a quad processor machine and get the following results:
32x32 575 ms 4x4 matrix of 8x8 pixel elements 64x64 2088 ms 4x4 matrix of 16x16 pixel elements 128x128 8439 ms 4x4 matrix of 323x32 pixel elements
32x32 952 ms 32x32 pixel element 64x64 3335 ms 64x64 pixel element 128x128 13829 ms 128x128 pixel element
The parallel program returns the full optional rectangle that you can then copy to the regular program to compare times on your machine. Make sure to make all IMAQ vis that are used in these programs Reentrant in the VI properties.