calcOpticalFlowPyrLKAsync function
Future<(VecPoint2f, VecUChar, VecF32)>
calcOpticalFlowPyrLKAsync(
- InputArray prevImg,
- InputArray nextImg,
- VecPoint2f prevPts,
- VecPoint2f nextPts, {
- VecUChar? status,
- VecF32? err,
- (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,
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, {
VecUChar? status,
VecF32? err,
(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,
}) {
final s = status?.ptr ?? calloc<cvg.VecUChar>();
final e = err?.ptr ?? calloc<cvg.VecF32>();
return cvRunAsync0(
(callback) => cvideo.cv_calcOpticalFlowPyrLK_1(
prevImg.ref,
nextImg.ref,
prevPts.ref,
nextPts.ptr,
s,
e,
winSize.cvd.ref,
maxLevel,
criteria.toTermCriteria().ref,
flags,
minEigThreshold,
callback,
),
(c) {
nextPts.reattach();
return c.complete((nextPts, status ?? VecUChar.fromPointer(s), VecF32.fromPointer(e)));
},
);
}