How to use estimateFlow between two images that are not video frames
Show older comments
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; % combine the images to a sequence
ImgStack(:,:,2) = Img2;
reset(opticFlow); % clear previous optical flow
opticFlow = opticalFlowLKDoG; % At this point, I don't realy care what method is used
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
Image Analyst
on 7 Aug 2020
What do you have to start with? A bunch of arrays called Img1, Img2, Img3, etc.? Or one array ImgStack?
chris crowley
on 8 Aug 2020
Accepted Answer
More Answers (0)
Categories
Find more on Tracking and Motion Estimation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!