Object for estimating optical flow using Farneback method
Create an optical flow object for estimating the direction and speed of moving objects using the Farneback method. Use the object functionestimateFlow
to estimate the optical flow vectors. Using thereset
object function, you can reset the internal state of the optical flow object.
returns an optical flow object that you can use to estimate the direction and speed of the moving objects in a video. The optical flow is estimated using the Farneback method.opticFlow
= opticalFlowFarneback
returns an optical flow object with properties specified as one or moreopticFlow
= opticalFlowFarneback(Name,Value
)Name,Value
pair arguments. Any unspecified properties have default values. Enclose each property name in quotes.
For example,opticalFlowFarneback('NumPyramidLevels',3)
estimateFlow |
Estimate optical flow |
reset |
Reset the internal state of the optical flow estimation object |
The Farneback algorithm generates an image pyramid, where each level has a lower resolution compared to the previous level. When you select a pyramid level greater than 1, the algorithm can track the points at multiple levels of resolution, starting at the lowest level. Increasing the number of pyramid levels enables the algorithm to handle larger displacements of points between frames. However, the number of computations also increases. The diagram shows an image pyramid with three levels.
The tracking begins in the lowest resolution level, and continues until convergence. The point locations detected at a level are propagated as keypoints for the succeeding level. In this way, the algorithm refines the tracking with each level. The pyramid decomposition enables the algorithm to handle large pixel motions, which can be distances greater than the neighborhood size.
[1] Farneback, G. “Two-Frame Motion Estimation Based on Polynomial Expansion.” InProceedings of the 13th Scandinavian Conference on Image Analysis, 363 - 370. Halmstad, Sweden: SCIA, 2003.