I am interested in computing optical flow between images that are not part of a video sequence using the built-in MATLAB function estimateFlow. That is, I would like to compute optical flow between two images in my workspace, Img1 and Img2. How can I do this?
Currently, I am combining the images into an array and running a for loop to obtain the optical flow:
ImgStack(:,:,1) = Img1;
ImgStack(:,:,2) = Img2;
reset(opticFlow);
opticFlow = opticalFlowLKDoG;
for t = 1:2
flow = estimateFlow(opticFlow,ImgStack(:,:,t));
end
This procedure is inelegant and quite cumbersome. I am doing this on a large number of images and I would like a more efficient way to do this. It would be nice if I could just do something like flow = estimateFlow(opticFlow,[Img1,Img2]).
Dose anyone know how to do this?
2 Comments
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/576712-how-to-use-estimateflow-between-two-images-that-are-not-video-frames#comment_964540
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/576712-how-to-use-estimateflow-between-two-images-that-are-not-video-frames#comment_964540
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/576712-how-to-use-estimateflow-between-two-images-that-are-not-video-frames#comment_964990
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/576712-how-to-use-estimateflow-between-two-images-that-are-not-video-frames#comment_964990
Sign in to comment.