matlab - How to quantify pixel changes in a short video -
In the recent study, I'm using some (20) video excitation material. Now I want to compare the video That's how many movements are in each video.
This is my code so far:
VidObj = VideoReader (video_file); VidFrames = reading (VidObj);
returns 4D matrix of 2D images = 2D array = one xb x c x window frames
VidNoFrames = VidObj.NumberofFrames; VidHeight = VidObj.Height; VidWidth = VidObj.Width; K = 1 for: VidNoFrames k mov (k). Cdata = VidFrames (:,:,:,, k); % 720 x 1280 x 3 end
Now I think the next step will be to create a loop for the correlation / SSD. However, CDAT is still 3D (height x width x 3) I do not know what this is the third dimension and how to compare images ... Thanks for your help!
Thanks a lot! Christine
You may want to use correlation to compare 2 images, or in your case I think computing is the square-intensity difference, which tells you in a more quantitative way that the intensity of how many pixels varies from one image to another, here is a simple example for both matters;
Approximate clc% // correlation coefficient 1 == more similarity A = imed ('coins.png'); B = midflil 2 (a); CorrCoeff = corr2 (A, B)% // even square intensity difference SquareIntDiff = (B-A). ^ 2; Calculate the square of% // pixel intensity difference SSID = sum (squareindid (:))% // Sum to get the SSID 0 is the value of 0 that both images are the same in terms of pixel intensity% // amount ( Using Yoga (Squareindid) will generate the same results in a less efficient manner. MATLAB takes the amount with the column and then once to get a value. CorrCoeff = 0.9964 SSID = 550746
Of course you can easily You can apply it in a loop to compare the frame continuously. Hope you get some help :)
Comments
Post a Comment