calcOpticalFlowPyrLKAsync function

Future<(VecPoint2f, VecUChar, VecF32)> calcOpticalFlowPyrLKAsync(
  1. InputArray prevImg,
  2. InputArray nextImg,
  3. VecPoint2f prevPts,
  4. VecPoint2f nextPts, {
  5. (int, int) winSize = (21, 21),
  6. int maxLevel = 3,
  7. (int, int, double) criteria = (TERM_COUNT + TERM_EPS, 30, 1e-4),
  8. int flags = 0,
  9. double minEigThreshold = 1e-4,
})

CalcOpticalFlowPyrLK calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with pyramids.

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

Implementation

Future<(VecPoint2f nextPts, VecUChar status, VecF32 error)> calcOpticalFlowPyrLKAsync(
  InputArray prevImg,
  InputArray nextImg,
  VecPoint2f prevPts,
  VecPoint2f nextPts, {
  (int, int) winSize = (21, 21),
  int maxLevel = 3,
  (int, int, double) criteria = (TERM_COUNT + TERM_EPS, 30, 1e-4),
  int flags = 0,
  double minEigThreshold = 1e-4,
}) async =>
    cvRunAsync2(
        (callback) => cffi.CalcOpticalFlowPyrLK_Async(
              prevImg.ref,
              nextImg.ref,
              prevPts.ref,
              nextPts.ptr,
              winSize.cvd.ref,
              maxLevel,
              criteria.cvd.ref,
              flags,
              minEigThreshold,
              callback,
            ), (c, p, p1) {
      nextPts.reattach();
      c.complete(
        (
          nextPts,
          VecUChar.fromPointer(p.cast<cvg.VecUChar>()),
          VecF32.fromPointer(p1.cast<cvg.VecF32>()),
        ),
      );
    });