How to write matlab code for The 2-D correlation (correlation coefficient) between the current frame and a previous frame for 300 frames?
Show older comments
How to write matlab code for The 2-D correlation (correlation coefficient) between the current frame and a previous frame for 300 frames?
Answers (1)
Assuming the frames are represented by a series of equally sized matricies, you can just loop through your frames, starting with the 2nd frame, and calculate the correlation coefficient between that frame and the previous one. Here's an example.
frames = rand(9,9,300); %fake data
nFrames = size(frames,3); %number of frames (300 for this example)
cc = zeros(1,nFrames); %allocate storage variable
for i = 2:nFrames
r = corrcoef(frames(:,:,i), frames(:,:,i-1)); % r will be a [2x2] matrix
cc(i) = r(2,1); % store the coef.
end
Categories
Find more on Modify Image Colors 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!