MATLAB: Comparing Two Frames

compareframeimage

Hi all,
I am using Matlab 2009a for experimental purposes. I am using Image Acquisiton Toolbox for capturing and then comparing the captured items.
I am using an external webcam (2.0MP) for input, recording 2 frames and exporting them to workspace for comparison. I am shooting at the lowest possible resolution (160×120) and grayscale. Camera is still, connected to a tripod – capturing a constant frame.
When I ran;
all(test1 == test2,2)
where test1 being the first captured frame and test2 the second. Result is all '0', instead of all '1's because above expression should return '1' for same values of same elements and '0' if different. Since camera is still I would expect it to return all '1's instead of '0's.
What do you think is happening ?

Best Answer

I would not expect the images to be exactly the same. CCD and CMOS type cameras always have quantization noise. Also, illumination can change even between adjacent frames. Furthermore, a tripod does not necessarily isolate from vibration well enough to expect pixel-level accuracy.
I would suggest you find max(test1(:)-test2(:)) to get an idea of how different the images are.