How to use Horn-schunck optical to compare many subsequent images?
13 views (last 30 days)
Show older comments
Hi,
I'm working on Horn-Schunck optical flow, got from http://www.mathworks.com/matlabcentral/fileexchange/22756-horn-schunck-optical-flow-method . From my reading on optical flow, it compares two subsequent images/frames. How to implement this optical flow algorithm if I have 100 frames of image? I've tried using this algorithm but it seems not working.It will compare 100 frames with only one reference image. I wish to compare e.g frame2 to frame 1, frame3 to frame 2, frame4 to frame3 and so on. When I tried to compare 100 frames with one reference image,it will output optical flow(value u and v) for the last frame. I want it produce optical flow for each frame.
Here's my coding
im1=imread('C:\Users\Acer\Documents\MATLAB\HS\Flow\Flow18.jpg');
text='C:\Users\Acer\Documents\MATLAB\Flow\Flow';
for img=19:22; % here,I used to test frame 19 to 22 only
filname=strcat(text,int2str(img));
filname=strcat(filname,'.jpg');
im=imread(filname);
[vAvg,uAvg,u,v] = HS(im1,im); % calling Horn-Schunck function
end
How to modified this code so that I can compare frame to previous frame? Anyone have knowledge about this optical flow? Any helps and suggestions is appreciated. Thanks a lot.
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!