Interpreting the output results from the optical flow

4 visualizzazioni (ultimi 30 giorni)
I am working on a study where I have to implement Horn Shunck's optical flow to videos. I would like to be able to compare the displacement of a pixel between two successive frames with a manual evaluation (example. pixel moved from [300 250] to [310 270]) and the optical flow result contained in the magnitude. Is this possible? in the magnitude I have smaller values than I calculate, is it because they are scaled? if I multiply them by the framerate would it make sense? thank you all

Risposte (1)

Ayush
Ayush il 13 Dic 2023
Hi Nicole,
I understand that you are implementing Horn Shunck’s optical flow method to find the displacement of a pixel between two successive frames.
You can use the opticalFlow” function from computer vision toolbox to implement it. This function will store the direction and speed of a moving object from one image or video frame to another. For manually computing, you can use the mathematical equations given in the “Optical Flow” documentation under the Algorithms section. The documentation provides the equation to compute the optical flow between two images (frames) and under the Horn-Schunck Method section you will find the equation to estimate the velocity field and pixel displacements.
You mentioned that you got values of smaller magnitude than expected, to address this, you can change the scaling factor of the function. You can try multiplying the magnitude values by the frame rate, which will mean that you are effectively converting the optical flow magnitude values into displacement values per unit time.
For more information on the “opticalFlow” function and the documentation for mathematical equations refer the links given below:
Regards,
Ayush

Community Treasure Hunt

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

Start Hunting!