Back to Aurora Vision Studio website

You are here: Start » Filter Reference » OpenCV » Video Analysis » cvCalcOpticalFlowFarneback

cvCalcOpticalFlowFarneback


Module: OpenCV

Computes a dense optical flow using the Gunnar Farneback's algorithm.

Name Type Range Description
Input value inPrevImg Image First UINT8 single-channel input image.
Input value inNextImg Image Second input image of the same size and the same type as inPrevImg.
Input value inFlow Image Input REAL, 2-channel flow image that has the same size as prevImg.
Input value inPyrScale Real 0.0 - 1.0 Parameter specifying the image scale to build pyramids for each image. pyrScale=0.5 means a classical pyramid, where each next layer is twice smaller than the previous one.
Input value inLevels Integer 1 - Number of pyramid layers including the initial image. levels=1 means that no extra layers are created and only the original images are used.
Input value inWinSize Integer 1 - Averaging window size. Larger values increase the algorithm robustness to image noise and give more chances for fast motion detection, but yield more blurred motion field.
Input value inIterations Integer Number of iterations the algorithm does at each pyramid level.
Input value inPolyN Integer Size of the pixel neighborhood used to find polynomial expansion in each pixel. Larger values mean that the image will be approximated with smoother surfaces, yielding more robust algorithm and more blurred motion field. Typically, polyN =5 or 7.
Input value inPolySigma Real 0.0 - Standard deviation of the Gaussian that is used to smooth derivatives used as a basis for the polynomial expansion. For polyN=5, you can set polySigma=1.1. For polyN=7, a good value would be polySigma=1.5.
Input value inUseInitialFlow Bool Use the input flow as an initial flow approximation.
Input value inUseFarnebackGaussian Bool Use the Gaussian 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.
Output value outFlow Image Computed flow image.

Errors

This filter can throw an exception to report error. Read how to deal with errors in Error Handling.

List of possible exceptions:

Error type Description
DomainError inFlow must have the same size as inPrevImg and REAL pixel type in cvCalcOpticalFlowFarneback.
DomainError inNextImg must have the same size, pixel type and depth as inPrevImg in cvCalcOpticalFlowFarneback.
DomainError inPrevImg must be UINT8 single-channel image in cvCalcOpticalFlowFarneback.

Complexity Level

This filter is available on Basic Complexity Level.