Comparing Two Frames

3 次查看(过去 30 天)
Yigit
Yigit 2011-5-27
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 ?

采纳的回答

Walter Roberson
Walter Roberson 2011-5-27
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.
  2 个评论
Yigit
Yigit 2011-5-27
It returns a constant value '47'.Is this means 47 elements of these matrices are different ?
I guess the reason you mention; that's why I capture in very low resolution and grayscale. Any recommendations for eliminating/lowering this error ?
Walter Roberson
Walter Roberson 2011-5-27
If the max() is 47, it means that the quantization difference is as 47 units at some pixel. If you are using 16 bit grayscale, that is pretty low, but as you are likely using 8 bit grayscale, that is really quite high.
I would suggest that you try
imagesc(double(test1)-double(test2))
as that will show you where your image is most different. If the result comes out a solid color then the implication would be that the entire image arrays were constant but different.
If the imagesc() does _not_ show a constant image, then I suggest you take several frames and imagesc() the differences side by side (subplot() perhaps); that will give you an idea of whether the difficulties are uniform or not. If the sensors are merely suffering from normal thermal noise effects, there should not be any pattern to where the differences occur.
If you collect a series of images, you could cat(3) them all together in to one array, and std(TheAggregateArray,3) and imagesc() that result. That should show you whether there are particular pixels that are real outliers, varying a great deal. A bit of variance is expected everywhere, but if you were to find (e.g.) a circular pattern, or a hot spot at some particular point area, then you would know there was equipment problems. A literal "hot spot" is possible, such as on the side of sensor closest to the power intake.

请先登录,再进行评论。

更多回答(1 个)

Florin Neacsu
Florin Neacsu 2011-5-27
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

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by