03-07-2011 05:01 AM
Hi
In order to determine how fast a sample of ice is sliding past a USB camera (approx rate of 30mm/min) I have in mind to snap an image every 5~10 sec and then compare the two images. I am struggling to get a robust method of determining the displacement. The main displacement will be only in one direction however the ice may shift a few pixel widths in the other direction as it slides past the camera.
Currently I am comparing the two images by taking a large ROI (400x800 pixels) of the second image, then taking the average pixel values from all the columns of both images which subsequently allows me to subtract the resulting 1D arrays and find the position where the difference is minimal.
This works very well for 'perfect' images but stops working reliably with less then perfect images.
Because the images are of ice samples with very little 'features' (besides the odd are bubble) and low contrast I feel I have to rely on the average grayscale profiles rather then tracking a 'feature' or detecting an edge etc.
The average grayscale arrays of the ROI's plotted in graph show clear peaks and valleys so another method would be to match the data but I do not know how to do that as yet.
Any suggestions on how I can best determine the displacement between images? The method will have to relatively fast as it has to be done in 'real time' ie within seconds.
Many thanks as always for all your help.
Jack
Solved! Go to Solution.
03-07-2011 05:07 AM
Hi Jack,
you can subtract two images. The last and the new one, to get the differences.
Hope it helps.
Mike
03-07-2011 05:13 AM
Hi Mike
Thanks for the speedy reply. I have come across the 'subtracting of images' in the forums but not sure how to go about it. Is there a specific IMAQ function to do so?
Thanks again!
Jack
03-07-2011 09:40 AM
Hi again
Follwing Mike's advice of subtracting the images I have played around with this feature and now have the principle working well.
In case somebody else would like to try something similar please see attached the VI and two example images that I used to experiment.
What does not seem to work well yet is the peak/valley detection method. No matter what width I set it can not find the valley...suggestions welcome!
Have a great day.
Jack