Comparing Two Frames
Show older comments
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 (160x120) 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 ?
Accepted Answer
More Answers (1)
Florin Neacsu
on 27 May 2011
0 votes
Hello,
"expression should return '1' for same values of same elements and '0' if different" - yes
"Result is all '0', instead of all '1's" No.
from the documentation of all "Determine whether all array elements are nonzero"
when you call all(test1==test2,2) you are looking at the columns of a logical matrix and ask if they are all equal to 1. The output is 1 if yes, 0 if no. Unless test1=test2 you will not get 1's as you stated. If you are getting all 0's that means that at least one pixel on each column is different.
Regards, Florin
Categories
Find more on Video Formats and Interfaces in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!