Capture Video and Analyze Frames

10 views (last 30 days)
Yigit
Yigit on 29 May 2011
Hi all,
I am capturing video by the aid of Image Acquisition Toolbox but it records the video to workspace as one element. I would like to look for pixel changes in frames of the recorded video. I am capturing 640x480 24bitRGB@30fps. I am seeking for guidance and recommendations.
Thank you
  2 Comments
Yigit
Yigit on 29 May 2011
I managed to hold it at a reasonable level. max() between two frames return between 10-20, which is negligible for me.
I lowered brightness and contrast, also gamma and exposure. Even if ADC didn't introduce quantization noise there would still be difference between two identical frames because there is no such thing as ideal monochromatic light source. I am positive that there is no light other than my light source (experiment conducting in a dark box).

Sign in to comment.

Answers (1)

praveen
praveen on 29 May 2011
You mean you want to compare ("pixel changes") different frames of the " recorded video" ?
Then, supposing vidobj be the video input object that you are using,
(according to you, vidobj is the "one element" in the workspace to which the video is recorded.
after you start the imaq(image acquition) by using this : start(vidobj);
The video acquired is stored in this object. If you want to acces a single frame of it, which is an image, you can do it by using * getsnapshot(vidobj)* or getdata(vidobj,no_of_frames)
(as always learn about those functions using MATLAB help documents)
im=getsnapshot(vidobj);
%now im is like any ordinary image.The same old matrix with pixel intensity values. You can use them.
If you want to compare any two frames, (not being specific about which two frames) you can do it by, -------------------------------------------------------------- vidobj=videoinput('your_adaptor_name',device_id,'resolution(optional)');
start(vidobj);
frm1=getsnapshot(vidobj); pause(2); %just passing for some time for the frames to be updated
frm2=getsnapshot(vidobj);
%similarly you can play with any no. of frames.
----------------------------------------------------------
Or
for i=1:5 fr=[fr getsnapshot(vidobj)]; end
Hope that's Helpful.... Or need anything else?
  2 Comments
Walter Roberson
Walter Roberson on 30 May 2011
By grabbing a number of black frames, you should be able to calculate the standard deviation of the quantization noise. Then when you go live, say that image1 and image2 are "provisionally the same" at a pixel if the pixel difference is less than N times the standard deviation (the lower the N, the more false differences you find; the higher the N, the more true differences you let through.)
If you do this, though, do be careful because "pixel difference is less than N times the standard deviation" is not transitive. If the standard deviation is (say) 15 and you let N = 2, then if image2 has a pixel that is 25 different than image1, you would provisionally declare them to be the same pixel as 25 < 2*15. But suppose image3 takes the pixel another 25 in the same direction: that would be a difference of 50 from the original pixel, 50 > 2*15, so a true pixel change took place between the first and third -- but that change of 25 relative to the second image would be within the margin if you are only comparing image2 and image3 and so would go unnoticed. But you can't just keep comparing to the first image: if a pixel "truly" changed at step T and then wandered around merely due to quantum noise, then sometimes the noise might take it below the limit relative to the first pixel and sometimes it would be above, but the "real" situation would be to register a change at some point and then use that point as the new baseline.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by