cv.calcOpticalFlowFarneback - MATLAB File Help |
Computes a dense optical flow using the Gunnar Farneback's algorithm
flow = cv.calcOpticalFlowFarneback(prevImg, nextImg)
flow = cv.calcOpticalFlowFarneback(prevImg, nextImg, 'OptionName',optionValue, ...)
prevImg
.prevImg
and
single
type (2-channels). Flow for (x,y)
is stored in the third
dimension.<1
) to build pyramids
for each image. PyrScale=0.5
means a classical pyramid, where each next
layer is twice smaller than the previous one. default 0.5.Levels=1
means that no extra layers are created and only the original
images are used. default 5.PolyN
is 5 or 7. default 5.PolyN=5
,
you can set PolySigma = 1.1
. For PolyN=7
, a good value would be
PolySigma = 1.5
. default 1.1.WinSize x WinSize
filter instead of a box
filter of the same size for optical flow estimation. Usually, this option
gives z more accurate flow than with a box filter, at the cost of lower
speed. Normally, WinSize
for a Gaussian window should be set to a larger
value to achieve the same level of robustness. default false.The function finds an optical flow for each prevImg
pixel using the
[Farneback2003] alorithm so that:
prevImg(y,x) ~ nextImg(y + flow(y,x,2), x + flow(y,x,1))
[Farneback2003]:
Gunnar Farneback. "Two-frame motion estimation based on polynomial expansion". In Image Analysis, pages 363-370. Springer, 2003.