Borrar filtros
Borrar filtros

How come opticalFlowLK works on 1 frame?

5 visualizaciones (últimos 30 días)
kuku hello
kuku hello el 27 de Mzo. de 2022
Editada: Aishwarya el 30 de Oct. de 2023
I wanted to try and calculate for two frames the built in optical flow using Lucas Kanade algorithm and compare it to my simple implementation of the LK algorithm. So I used the opticalFlowLK function like so:
opticFlow = opticalFlowLK("NoiseThreshold",0.009);
flow = estimateFlow(opticFlow,img1);
Then I plotted the flow variable on the image as explained in the documentray and it worked amazingly well. But here is the thing, what I wrote above is the whole code.
Variable img1 consist of one gray image matrix and nothing else. Lucas Kanade algorithm suppose to work on 2 consecutive frames at least in order to calculate the time derivative! It is also says that in the documentray. HOW DID IT WORK? How does the algorithm can tell if there is any movement at all based on 1 frame?! I don't understand. Can someone help me please?

Respuestas (1)

Aishwarya
Aishwarya el 30 de Oct. de 2023
Editada: Aishwarya el 30 de Oct. de 2023
Hi,
As per my understanding, you wish to understand on why “estimateFlow” function only requires one image to calculate optical flow, when the algorithm requires two consecutive frames.
In the provided example code, an optical flow object named "opticFlow" is created using the "opticalFlowLK" function before using the "estimateFlow" method.
opticFlow = opticalFlowLK("NoiseThreshold",0.009);
flow = estimateFlow(opticFlow,img1);
This optical flow object, "opticFlow," stores the information of the previous image that is passed through the "estimateFlow" function. When the "img1" image is passed through the "estimateFlow" function, the resulting "flow" output provides the optical flow between the previous frame passed through the "estimateFlow" function and the current frame "img1."
When the optical flow object is used for first time, the previous frame is initialized with uniform image having intensity value 0.
Please refer to MathWorks documentations below for more information about the functions:
I hope this helps!

Categorías

Más información sobre Tracking and Motion Estimation en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by