calculating velocity using Horn Schunck and Lucas Kanade Optical flow methods

11 Ansichten (letzte 30 Tage)
I want to calculate the velocity field from my tiff stack movie. I am using optical flow method. I see that there are Horn Schunck and Lucas Kanade methods. The problem is that I get different magnitudes of velocities from each method. Horn schunck method gives me much smaller velocities (about 10 times smaller which is a lot!). I do not change anything in my code except the opticalFlow method and I get different results.
How should I know which one I thrust?
What is different between these two methods and are they using the same units (pixel/frame)?
I copied a part of my code that is related to optical flow.
Thank you so much
% opticFlow = opticalFlowHS;
opticFlow = opticalFlowLK;
curImage = imread(ImageFile, k);
frameRGB = curImage;
frameGray = im2gray(frameRGB);
flow = estimateFlow(opticFlow,frameGray);

Antworten (2)

Aishwarya
Aishwarya am 6 Okt. 2023
Hi Dorsa,
As per my understanding you would like to know the difference between Horn Schunck and Lucas Kanade optical flow methods. To address your questions.
The difference between Horn Schunck and Lucas Kanade Optical Flow Methods:
  • The Horn-Schunck and Lucas-Kanade methods are two different approaches to optical flow estimation.
  • Horn-Schunck method assumes that the velocity field is smooth and solves a global optimization problem to estimate the flow.
  • Lucas-Kanade method, on the other hand, assumes that the flow is constant in a small neighbourhood and solves a local optimization problem to estimate the flow. 
  • The difference in the magnitude of velocities you are observing could be due to the different assumptions made by the two methods.
The units used by two methods:
  •  Both the methods estimate the velocity in pixels/frame.
Some approaches to evaluate the two methods:
  • Compare estimated flow vectors to ground truth data using metrics like endpoint error (EPE).
  • Use synthetic data, where you generate a sequence of images with known motion and compare the estimated flow vectors to the ground truth motion.
Please note that the provided links below contain documentation that you may find helpful for further reference:
Hope this helps!
Regards,
Aishwarya Palli

Francois
Francois am 1 Mär. 2024
In my experience, not specifically with Matlab libraries, Horn-Schunck can significantly underestimate true displacements if the regularization parameter is too strong. You may want to play with that a bit.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by