calcOpticalFlowFarneback function

Mat calcOpticalFlowFarneback(
  1. InputArray prev,
  2. InputArray next,
  3. InputOutputArray flow,
  4. double pyrScale,
  5. int levels,
  6. int winsize,
  7. int iterations,
  8. int polyN,
  9. double polySigma,
  10. int flags,
)

Apply computes a foreground mask using the current BackgroundSubtractorMOG2.

For further details, please see: https://docs.opencv.org/master/d7/df6/classcv_1_1BackgroundSubtractor.html#aa735e76f7069b3fa9c3f32395f9ccd21 CalcOpticalFlowFarneback computes a dense optical flow using Gunnar Farneback's algorithm.

For further details, please see: https://docs.opencv.org/master/dc/d6b/group__video__track.html#ga5d10ebbd59fe09c5f650289ec0ece5af

Implementation

/// CalcOpticalFlowFarneback computes a dense optical flow using
/// Gunnar Farneback's algorithm.
///
/// For further details, please see:
/// https://docs.opencv.org/master/dc/d6b/group__video__track.html#ga5d10ebbd59fe09c5f650289ec0ece5af
Mat calcOpticalFlowFarneback(
  InputArray prev,
  InputArray next,
  InputOutputArray flow,
  double pyrScale,
  int levels,
  int winsize,
  int iterations,
  int polyN,
  double polySigma,
  int flags,
) {
  cvRun(
    () => cvideo.cv_calcOpticalFlowFarneback(
      prev.ref,
      next.ref,
      flow.ref,
      pyrScale,
      levels,
      winsize,
      iterations,
      polyN,
      polySigma,
      flags,
      ffi.nullptr,
    ),
  );
  return flow;
}