diff --git a/ffigen.yaml b/ffigen.yaml index 68aa1355..50e74e63 100644 --- a/ffigen.yaml +++ b/ffigen.yaml @@ -44,7 +44,9 @@ headers: - src/stitching/stitching.h - src/stitching/stitching_async.h - src/video/video.h + - src/video/video_async.h - src/video/videoio.h + - src/video/videoio_async.h include-directives: - src/calib3d/calib3d.h - src/calib3d/calib3d_async.h @@ -75,7 +77,10 @@ headers: - src/stitching/stitching.h - src/stitching/stitching_async.h - src/video/video.h + - src/video/video_async.h - src/video/videoio.h + - src/video/videoio_async.h + functions: symbol-address: include: diff --git a/lib/opencv_dart.dart b/lib/opencv_dart.dart index db33fc6f..12133f60 100644 --- a/lib/opencv_dart.dart +++ b/lib/opencv_dart.dart @@ -48,4 +48,6 @@ export 'src/stitching/stitching.dart'; export 'src/stitching/stitching_async.dart'; export 'src/svd/svd.dart'; export 'src/video/video.dart'; +export 'src/video/video_async.dart'; export 'src/video/videoio.dart'; +export 'src/video/videoio_async.dart'; diff --git a/lib/src/core/base.dart b/lib/src/core/base.dart index 49c7894c..2c4c7cc6 100644 --- a/lib/src/core/base.dart +++ b/lib/src/core/base.dart @@ -198,6 +198,14 @@ Future cvRunAsync5( } // async completers +void voidCompleter(Completer completer) => completer.complete(); + +void boolCompleter(Completer completer, VoidPtr p) { + final value = p.cast().value; + calloc.free(p); + completer.complete(value); +} + void intCompleter(Completer completer, VoidPtr p) { final value = p.cast().value; calloc.free(p); diff --git a/lib/src/opencv.g.dart b/lib/src/opencv.g.dart index 9b5f2d87..0df70f80 100644 --- a/lib/src/opencv.g.dart +++ b/lib/src/opencv.g.dart @@ -41,23 +41,6 @@ class CvNative { late final _AKAZE_Close = _AKAZE_ClosePtr.asFunction(); - ffi.Pointer AKAZE_Close_Async( - AKAZEPtr self, - CvCallback_0 callback, - ) { - return _AKAZE_Close_Async( - self, - callback, - ); - } - - late final _AKAZE_Close_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - AKAZEPtr, CvCallback_0)>>('AKAZE_Close_Async'); - late final _AKAZE_Close_Async = _AKAZE_Close_AsyncPtr.asFunction< - ffi.Pointer Function(AKAZEPtr, CvCallback_0)>(); - ffi.Pointer AKAZE_Create( ffi.Pointer rval, ) { @@ -72,20 +55,6 @@ class CvNative { late final _AKAZE_Create = _AKAZE_CreatePtr.asFunction< ffi.Pointer Function(ffi.Pointer)>(); - ffi.Pointer AKAZE_Create_Async( - CvCallback_1 callback, - ) { - return _AKAZE_Create_Async( - callback, - ); - } - - late final _AKAZE_Create_AsyncPtr = - _lookup Function(CvCallback_1)>>( - 'AKAZE_Create_Async'); - late final _AKAZE_Create_Async = _AKAZE_Create_AsyncPtr.asFunction< - ffi.Pointer Function(CvCallback_1)>(); - ffi.Pointer AKAZE_Detect( AKAZE a, Mat src, @@ -129,47 +98,6 @@ class CvNative { ffi.Pointer Function( AKAZE, Mat, Mat, Mat, ffi.Pointer)>(); - ffi.Pointer AKAZE_DetectAndCompute_Async( - AKAZE self, - Mat src, - Mat mask, - CvCallback_2 callback, - ) { - return _AKAZE_DetectAndCompute_Async( - self, - src, - mask, - callback, - ); - } - - late final _AKAZE_DetectAndCompute_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - AKAZE, Mat, Mat, CvCallback_2)>>('AKAZE_DetectAndCompute_Async'); - late final _AKAZE_DetectAndCompute_Async = - _AKAZE_DetectAndCompute_AsyncPtr.asFunction< - ffi.Pointer Function(AKAZE, Mat, Mat, CvCallback_2)>(); - - ffi.Pointer AKAZE_Detect_Async( - AKAZE self, - Mat src, - CvCallback_1 callback, - ) { - return _AKAZE_Detect_Async( - self, - src, - callback, - ); - } - - late final _AKAZE_Detect_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - AKAZE, Mat, CvCallback_1)>>('AKAZE_Detect_Async'); - late final _AKAZE_Detect_Async = _AKAZE_Detect_AsyncPtr.asFunction< - ffi.Pointer Function(AKAZE, Mat, CvCallback_1)>(); - ffi.Pointer AdaptiveThreshold( Mat src, Mat dst, @@ -240,25 +168,6 @@ class CvNative { late final _AgastFeatureDetector_Close = _AgastFeatureDetector_ClosePtr .asFunction(); - ffi.Pointer AgastFeatureDetector_Close_Async( - AgastFeatureDetectorPtr self, - CvCallback_0 callback, - ) { - return _AgastFeatureDetector_Close_Async( - self, - callback, - ); - } - - late final _AgastFeatureDetector_Close_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(AgastFeatureDetectorPtr, - CvCallback_0)>>('AgastFeatureDetector_Close_Async'); - late final _AgastFeatureDetector_Close_Async = - _AgastFeatureDetector_Close_AsyncPtr.asFunction< - ffi.Pointer Function( - AgastFeatureDetectorPtr, CvCallback_0)>(); - ffi.Pointer AgastFeatureDetector_Create( ffi.Pointer rval, ) { @@ -276,21 +185,6 @@ class CvNative { _AgastFeatureDetector_CreatePtr.asFunction< ffi.Pointer Function(ffi.Pointer)>(); - ffi.Pointer AgastFeatureDetector_Create_Async( - CvCallback_1 callback, - ) { - return _AgastFeatureDetector_Create_Async( - callback, - ); - } - - late final _AgastFeatureDetector_Create_AsyncPtr = - _lookup Function(CvCallback_1)>>( - 'AgastFeatureDetector_Create_Async'); - late final _AgastFeatureDetector_Create_Async = - _AgastFeatureDetector_Create_AsyncPtr.asFunction< - ffi.Pointer Function(CvCallback_1)>(); - ffi.Pointer AgastFeatureDetector_Detect( AgastFeatureDetector a, Mat src, @@ -312,27 +206,6 @@ class CvNative { ffi.Pointer Function( AgastFeatureDetector, Mat, ffi.Pointer)>(); - ffi.Pointer AgastFeatureDetector_Detect_Async( - AgastFeatureDetector self, - Mat src, - CvCallback_1 callback, - ) { - return _AgastFeatureDetector_Detect_Async( - self, - src, - callback, - ); - } - - late final _AgastFeatureDetector_Detect_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(AgastFeatureDetector, Mat, - CvCallback_1)>>('AgastFeatureDetector_Detect_Async'); - late final _AgastFeatureDetector_Detect_Async = - _AgastFeatureDetector_Detect_AsyncPtr.asFunction< - ffi.Pointer Function( - AgastFeatureDetector, Mat, CvCallback_1)>(); - void AlignMTB_Close( AlignMTBPtr b, ) { @@ -2054,23 +1927,6 @@ class CvNative { late final _BFMatcher_Close = _BFMatcher_ClosePtr.asFunction(); - ffi.Pointer BFMatcher_Close_Async( - BFMatcherPtr self, - CvCallback_0 callback, - ) { - return _BFMatcher_Close_Async( - self, - callback, - ); - } - - late final _BFMatcher_Close_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - BFMatcherPtr, CvCallback_0)>>('BFMatcher_Close_Async'); - late final _BFMatcher_Close_Async = _BFMatcher_Close_AsyncPtr.asFunction< - ffi.Pointer Function(BFMatcherPtr, CvCallback_0)>(); - ffi.Pointer BFMatcher_Create( ffi.Pointer rval, ) { @@ -2106,40 +1962,6 @@ class CvNative { _BFMatcher_CreateWithParamsPtr.asFunction< ffi.Pointer Function(int, bool, ffi.Pointer)>(); - ffi.Pointer BFMatcher_CreateWithParams_Async( - int normType, - bool crossCheck, - CvCallback_1 callback, - ) { - return _BFMatcher_CreateWithParams_Async( - normType, - crossCheck, - callback, - ); - } - - late final _BFMatcher_CreateWithParams_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Int, ffi.Bool, - CvCallback_1)>>('BFMatcher_CreateWithParams_Async'); - late final _BFMatcher_CreateWithParams_Async = - _BFMatcher_CreateWithParams_AsyncPtr.asFunction< - ffi.Pointer Function(int, bool, CvCallback_1)>(); - - ffi.Pointer BFMatcher_Create_Async( - CvCallback_1 callback, - ) { - return _BFMatcher_Create_Async( - callback, - ); - } - - late final _BFMatcher_Create_AsyncPtr = - _lookup Function(CvCallback_1)>>( - 'BFMatcher_Create_Async'); - late final _BFMatcher_Create_Async = _BFMatcher_Create_AsyncPtr.asFunction< - ffi.Pointer Function(CvCallback_1)>(); - ffi.Pointer BFMatcher_KnnMatch( BFMatcher b, Mat query, @@ -2164,31 +1986,6 @@ class CvNative { ffi.Pointer Function( BFMatcher, Mat, Mat, int, ffi.Pointer)>(); - ffi.Pointer BFMatcher_KnnMatch_Async( - BFMatcher self, - Mat query, - Mat train, - int k, - CvCallback_1 callback, - ) { - return _BFMatcher_KnnMatch_Async( - self, - query, - train, - k, - callback, - ); - } - - late final _BFMatcher_KnnMatch_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(BFMatcher, Mat, Mat, ffi.Int, - CvCallback_1)>>('BFMatcher_KnnMatch_Async'); - late final _BFMatcher_KnnMatch_Async = - _BFMatcher_KnnMatch_AsyncPtr.asFunction< - ffi.Pointer Function( - BFMatcher, Mat, Mat, int, CvCallback_1)>(); - ffi.Pointer BFMatcher_Match( BFMatcher b, Mat query, @@ -2211,27 +2008,6 @@ class CvNative { ffi.Pointer Function( BFMatcher, Mat, Mat, ffi.Pointer)>(); - ffi.Pointer BFMatcher_Match_Async( - BFMatcher self, - Mat query, - Mat train, - CvCallback_1 callback, - ) { - return _BFMatcher_Match_Async( - self, - query, - train, - callback, - ); - } - - late final _BFMatcher_Match_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - BFMatcher, Mat, Mat, CvCallback_1)>>('BFMatcher_Match_Async'); - late final _BFMatcher_Match_Async = _BFMatcher_Match_AsyncPtr.asFunction< - ffi.Pointer Function(BFMatcher, Mat, Mat, CvCallback_1)>(); - void BRISK_Close( BRISKPtr b, ) { @@ -2245,23 +2021,6 @@ class CvNative { late final _BRISK_Close = _BRISK_ClosePtr.asFunction(); - ffi.Pointer BRISK_Close_Async( - BRISKPtr self, - CvCallback_0 callback, - ) { - return _BRISK_Close_Async( - self, - callback, - ); - } - - late final _BRISK_Close_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - BRISKPtr, CvCallback_0)>>('BRISK_Close_Async'); - late final _BRISK_Close_Async = _BRISK_Close_AsyncPtr.asFunction< - ffi.Pointer Function(BRISKPtr, CvCallback_0)>(); - ffi.Pointer BRISK_Create( ffi.Pointer rval, ) { @@ -2276,20 +2035,6 @@ class CvNative { late final _BRISK_Create = _BRISK_CreatePtr.asFunction< ffi.Pointer Function(ffi.Pointer)>(); - ffi.Pointer BRISK_Create_Async( - CvCallback_1 callback, - ) { - return _BRISK_Create_Async( - callback, - ); - } - - late final _BRISK_Create_AsyncPtr = - _lookup Function(CvCallback_1)>>( - 'BRISK_Create_Async'); - late final _BRISK_Create_Async = _BRISK_Create_AsyncPtr.asFunction< - ffi.Pointer Function(CvCallback_1)>(); - ffi.Pointer BRISK_Detect( BRISK b, Mat src, @@ -2333,66 +2078,46 @@ class CvNative { ffi.Pointer Function( BRISK, Mat, Mat, Mat, ffi.Pointer)>(); - ffi.Pointer BRISK_DetectAndCompute_Async( - BRISK self, + ffi.Pointer BackgroundSubtractorKNN_Apply( + BackgroundSubtractorKNN self, Mat src, - Mat mask, - CvCallback_2 callback, + Mat dst, ) { - return _BRISK_DetectAndCompute_Async( + return _BackgroundSubtractorKNN_Apply( self, src, - mask, - callback, + dst, ); } - late final _BRISK_DetectAndCompute_AsyncPtr = _lookup< + late final _BackgroundSubtractorKNN_ApplyPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - BRISK, Mat, Mat, CvCallback_2)>>('BRISK_DetectAndCompute_Async'); - late final _BRISK_DetectAndCompute_Async = - _BRISK_DetectAndCompute_AsyncPtr.asFunction< - ffi.Pointer Function(BRISK, Mat, Mat, CvCallback_2)>(); + ffi.Pointer Function(BackgroundSubtractorKNN, Mat, + Mat)>>('BackgroundSubtractorKNN_Apply'); + late final _BackgroundSubtractorKNN_Apply = + _BackgroundSubtractorKNN_ApplyPtr.asFunction< + ffi.Pointer Function(BackgroundSubtractorKNN, Mat, Mat)>(); - ffi.Pointer BRISK_Detect_Async( - BRISK self, + ffi.Pointer BackgroundSubtractorKNN_Apply_Async( + BackgroundSubtractorKNN self, Mat src, CvCallback_1 callback, ) { - return _BRISK_Detect_Async( + return _BackgroundSubtractorKNN_Apply_Async( self, src, callback, ); } - late final _BRISK_Detect_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - BRISK, Mat, CvCallback_1)>>('BRISK_Detect_Async'); - late final _BRISK_Detect_Async = _BRISK_Detect_AsyncPtr.asFunction< - ffi.Pointer Function(BRISK, Mat, CvCallback_1)>(); - - ffi.Pointer BackgroundSubtractorKNN_Apply( - BackgroundSubtractorKNN self, - Mat src, - Mat dst, - ) { - return _BackgroundSubtractorKNN_Apply( - self, - src, - dst, - ); - } - - late final _BackgroundSubtractorKNN_ApplyPtr = _lookup< + late final _BackgroundSubtractorKNN_Apply_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function(BackgroundSubtractorKNN, Mat, - Mat)>>('BackgroundSubtractorKNN_Apply'); - late final _BackgroundSubtractorKNN_Apply = - _BackgroundSubtractorKNN_ApplyPtr.asFunction< - ffi.Pointer Function(BackgroundSubtractorKNN, Mat, Mat)>(); + CvCallback_1)>>('BackgroundSubtractorKNN_Apply_Async'); + late final _BackgroundSubtractorKNN_Apply_Async = + _BackgroundSubtractorKNN_Apply_AsyncPtr.asFunction< + ffi.Pointer Function( + BackgroundSubtractorKNN, Mat, CvCallback_1)>(); void BackgroundSubtractorKNN_Close( BackgroundSubtractorKNNPtr self, @@ -2450,6 +2175,43 @@ class CvNative { ffi.Pointer Function( int, double, bool, ffi.Pointer)>(); + ffi.Pointer BackgroundSubtractorKNN_CreateWithParams_Async( + int history, + double dist2Threshold, + bool detectShadows, + CvCallback_1 callback, + ) { + return _BackgroundSubtractorKNN_CreateWithParams_Async( + history, + dist2Threshold, + detectShadows, + callback, + ); + } + + late final _BackgroundSubtractorKNN_CreateWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Int, ffi.Double, ffi.Bool, + CvCallback_1)>>('BackgroundSubtractorKNN_CreateWithParams_Async'); + late final _BackgroundSubtractorKNN_CreateWithParams_Async = + _BackgroundSubtractorKNN_CreateWithParams_AsyncPtr.asFunction< + ffi.Pointer Function(int, double, bool, CvCallback_1)>(); + + ffi.Pointer BackgroundSubtractorKNN_Create_Async( + CvCallback_1 callback, + ) { + return _BackgroundSubtractorKNN_Create_Async( + callback, + ); + } + + late final _BackgroundSubtractorKNN_Create_AsyncPtr = + _lookup Function(CvCallback_1)>>( + 'BackgroundSubtractorKNN_Create_Async'); + late final _BackgroundSubtractorKNN_Create_Async = + _BackgroundSubtractorKNN_Create_AsyncPtr.asFunction< + ffi.Pointer Function(CvCallback_1)>(); + ffi.Pointer BackgroundSubtractorMOG2_Apply( BackgroundSubtractorMOG2 self, Mat src, @@ -2470,6 +2232,27 @@ class CvNative { _BackgroundSubtractorMOG2_ApplyPtr.asFunction< ffi.Pointer Function(BackgroundSubtractorMOG2, Mat, Mat)>(); + ffi.Pointer BackgroundSubtractorMOG2_Apply_Async( + BackgroundSubtractorMOG2 self, + Mat src, + CvCallback_1 callback, + ) { + return _BackgroundSubtractorMOG2_Apply_Async( + self, + src, + callback, + ); + } + + late final _BackgroundSubtractorMOG2_Apply_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(BackgroundSubtractorMOG2, Mat, + CvCallback_1)>>('BackgroundSubtractorMOG2_Apply_Async'); + late final _BackgroundSubtractorMOG2_Apply_Async = + _BackgroundSubtractorMOG2_Apply_AsyncPtr.asFunction< + ffi.Pointer Function( + BackgroundSubtractorMOG2, Mat, CvCallback_1)>(); + void BackgroundSubtractorMOG2_Close( BackgroundSubtractorMOG2Ptr self, ) { @@ -2527,24 +2310,62 @@ class CvNative { ffi.Pointer Function( int, double, bool, ffi.Pointer)>(); - ffi.Pointer BilateralFilter( - Mat src, - Mat dst, - int d, - double sc, - double ss, + ffi.Pointer BackgroundSubtractorMOG2_CreateWithParams_Async( + int history, + double varThreshold, + bool detectShadows, + CvCallback_1 callback, ) { - return _BilateralFilter( - src, - dst, - d, - sc, - ss, + return _BackgroundSubtractorMOG2_CreateWithParams_Async( + history, + varThreshold, + detectShadows, + callback, ); } - late final _BilateralFilterPtr = _lookup< - ffi.NativeFunction< + late final _BackgroundSubtractorMOG2_CreateWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Int, ffi.Double, ffi.Bool, CvCallback_1)>>( + 'BackgroundSubtractorMOG2_CreateWithParams_Async'); + late final _BackgroundSubtractorMOG2_CreateWithParams_Async = + _BackgroundSubtractorMOG2_CreateWithParams_AsyncPtr.asFunction< + ffi.Pointer Function(int, double, bool, CvCallback_1)>(); + + ffi.Pointer BackgroundSubtractorMOG2_Create_Async( + CvCallback_1 callback, + ) { + return _BackgroundSubtractorMOG2_Create_Async( + callback, + ); + } + + late final _BackgroundSubtractorMOG2_Create_AsyncPtr = + _lookup Function(CvCallback_1)>>( + 'BackgroundSubtractorMOG2_Create_Async'); + late final _BackgroundSubtractorMOG2_Create_Async = + _BackgroundSubtractorMOG2_Create_AsyncPtr.asFunction< + ffi.Pointer Function(CvCallback_1)>(); + + ffi.Pointer BilateralFilter( + Mat src, + Mat dst, + int d, + double sc, + double ss, + ) { + return _BilateralFilter( + src, + dst, + d, + sc, + ss, + ); + } + + late final _BilateralFilterPtr = _lookup< + ffi.NativeFunction< ffi.Pointer Function( Mat, Mat, ffi.Int, ffi.Double, ffi.Double)>>('BilateralFilter'); late final _BilateralFilter = _BilateralFilterPtr.asFunction< @@ -3286,6 +3107,53 @@ class CvNative { ffi.Pointer Function( Mat, Mat, Mat, double, int, int, int, int, double, int)>(); + ffi.Pointer CalcOpticalFlowFarneback_Async( + Mat prevImg, + Mat nextImg, + Mat flow, + double pyrScale, + int levels, + int winsize, + int iterations, + int polyN, + double polySigma, + int flags, + CvCallback_0 callback, + ) { + return _CalcOpticalFlowFarneback_Async( + prevImg, + nextImg, + flow, + pyrScale, + levels, + winsize, + iterations, + polyN, + polySigma, + flags, + callback, + ); + } + + late final _CalcOpticalFlowFarneback_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, + Mat, + Mat, + ffi.Double, + ffi.Int, + ffi.Int, + ffi.Int, + ffi.Int, + ffi.Double, + ffi.Int, + CvCallback_0)>>('CalcOpticalFlowFarneback_Async'); + late final _CalcOpticalFlowFarneback_Async = + _CalcOpticalFlowFarneback_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, double, int, int, int, + int, double, int, CvCallback_0)>(); + ffi.Pointer CalcOpticalFlowPyrLK( Mat prevImg, Mat nextImg, @@ -3369,6 +3237,50 @@ class CvNative { int, double)>(); + ffi.Pointer CalcOpticalFlowPyrLK_Async( + Mat prevImg, + Mat nextImg, + VecPoint2f prevPts, + VecPoint2f nextPts, + Size winSize, + int maxLevel, + TermCriteria criteria, + int flags, + double minEigThreshold, + CvCallback_2 callback, + ) { + return _CalcOpticalFlowPyrLK_Async( + prevImg, + nextImg, + prevPts, + nextPts, + winSize, + maxLevel, + criteria, + flags, + minEigThreshold, + callback, + ); + } + + late final _CalcOpticalFlowPyrLK_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, + Mat, + VecPoint2f, + VecPoint2f, + Size, + ffi.Int, + TermCriteria, + ffi.Int, + ffi.Double, + CvCallback_2)>>('CalcOpticalFlowPyrLK_Async'); + late final _CalcOpticalFlowPyrLK_Async = + _CalcOpticalFlowPyrLK_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, VecPoint2f, VecPoint2f, Size, + int, TermCriteria, int, double, CvCallback_2)>(); + ffi.Pointer CalibrateCamera( VecVecPoint3f objectPoints, VecVecPoint2f imagePoints, @@ -4955,32 +4867,6 @@ class CvNative { late final _DrawKeyPoints = _DrawKeyPointsPtr.asFunction< ffi.Pointer Function(Mat, VecKeyPoint, Mat, Scalar, int)>(); - ffi.Pointer DrawKeyPoints_Async( - Mat src, - VecKeyPoint kp, - Mat dst, - Scalar color, - int flags, - CvCallback_0 callback, - ) { - return _DrawKeyPoints_Async( - src, - kp, - dst, - color, - flags, - callback, - ); - } - - late final _DrawKeyPoints_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(Mat, VecKeyPoint, Mat, Scalar, ffi.Int, - CvCallback_0)>>('DrawKeyPoints_Async'); - late final _DrawKeyPoints_Async = _DrawKeyPoints_AsyncPtr.asFunction< - ffi.Pointer Function( - Mat, VecKeyPoint, Mat, Scalar, int, CvCallback_0)>(); - ffi.Pointer DrawMatches( Mat img1, VecKeyPoint kp1, @@ -5024,52 +4910,6 @@ class CvNative { ffi.Pointer Function(Mat, VecKeyPoint, Mat, VecKeyPoint, VecDMatch, Mat, Scalar, Scalar, VecChar, int)>(); - ffi.Pointer DrawMatches_Async( - Mat img1, - VecKeyPoint kp1, - Mat img2, - VecKeyPoint kp2, - VecDMatch matches1to2, - Mat outImg, - Scalar matchesColor, - Scalar pointColor, - VecChar matchesMask, - int flags, - CvCallback_0 callback, - ) { - return _DrawMatches_Async( - img1, - kp1, - img2, - kp2, - matches1to2, - outImg, - matchesColor, - pointColor, - matchesMask, - flags, - callback, - ); - } - - late final _DrawMatches_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - Mat, - VecKeyPoint, - Mat, - VecKeyPoint, - VecDMatch, - Mat, - Scalar, - Scalar, - VecChar, - ffi.Int, - CvCallback_0)>>('DrawMatches_Async'); - late final _DrawMatches_Async = _DrawMatches_AsyncPtr.asFunction< - ffi.Pointer Function(Mat, VecKeyPoint, Mat, VecKeyPoint, - VecDMatch, Mat, Scalar, Scalar, VecChar, int, CvCallback_0)>(); - ffi.Pointer EdgePreservingFilter( Mat src, Mat dst, @@ -6315,25 +6155,6 @@ class CvNative { late final _FastFeatureDetector_Close = _FastFeatureDetector_ClosePtr .asFunction(); - ffi.Pointer FastFeatureDetector_Close_Async( - FastFeatureDetectorPtr self, - CvCallback_0 callback, - ) { - return _FastFeatureDetector_Close_Async( - self, - callback, - ); - } - - late final _FastFeatureDetector_Close_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(FastFeatureDetectorPtr, - CvCallback_0)>>('FastFeatureDetector_Close_Async'); - late final _FastFeatureDetector_Close_Async = - _FastFeatureDetector_Close_AsyncPtr.asFunction< - ffi.Pointer Function( - FastFeatureDetectorPtr, CvCallback_0)>(); - ffi.Pointer FastFeatureDetector_Create( ffi.Pointer rval, ) { @@ -6374,43 +6195,6 @@ class CvNative { ffi.Pointer Function( int, bool, int, ffi.Pointer)>(); - ffi.Pointer FastFeatureDetector_CreateWithParams_Async( - int threshold, - bool nonmaxSuppression, - int type, - CvCallback_1 callback, - ) { - return _FastFeatureDetector_CreateWithParams_Async( - threshold, - nonmaxSuppression, - type, - callback, - ); - } - - late final _FastFeatureDetector_CreateWithParams_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Int, ffi.Bool, ffi.Int, - CvCallback_1)>>('FastFeatureDetector_CreateWithParams_Async'); - late final _FastFeatureDetector_CreateWithParams_Async = - _FastFeatureDetector_CreateWithParams_AsyncPtr.asFunction< - ffi.Pointer Function(int, bool, int, CvCallback_1)>(); - - ffi.Pointer FastFeatureDetector_Create_Async( - CvCallback_1 callback, - ) { - return _FastFeatureDetector_Create_Async( - callback, - ); - } - - late final _FastFeatureDetector_Create_AsyncPtr = - _lookup Function(CvCallback_1)>>( - 'FastFeatureDetector_Create_Async'); - late final _FastFeatureDetector_Create_Async = - _FastFeatureDetector_Create_AsyncPtr.asFunction< - ffi.Pointer Function(CvCallback_1)>(); - ffi.Pointer FastFeatureDetector_Detect( FastFeatureDetector f, Mat src, @@ -6432,27 +6216,6 @@ class CvNative { ffi.Pointer Function( FastFeatureDetector, Mat, ffi.Pointer)>(); - ffi.Pointer FastFeatureDetector_Detect_Async( - FastFeatureDetector self, - Mat src, - CvCallback_1 callback, - ) { - return _FastFeatureDetector_Detect_Async( - self, - src, - callback, - ); - } - - late final _FastFeatureDetector_Detect_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(FastFeatureDetector, Mat, - CvCallback_1)>>('FastFeatureDetector_Detect_Async'); - late final _FastFeatureDetector_Detect_Async = - _FastFeatureDetector_Detect_AsyncPtr.asFunction< - ffi.Pointer Function( - FastFeatureDetector, Mat, CvCallback_1)>(); - ffi.Pointer FastNlMeansDenoising( Mat src, Mat dst, @@ -7099,6 +6862,36 @@ class CvNative { ffi.Pointer Function(Mat, Mat, Mat, int, TermCriteria, Mat, int, ffi.Pointer)>(); + ffi.Pointer FindTransformECC_Async( + Mat templateImage, + Mat inputImage, + Mat warpMatrix, + int motionType, + TermCriteria criteria, + Mat inputMask, + int gaussFiltSize, + CvCallback_1 callback, + ) { + return _FindTransformECC_Async( + templateImage, + inputImage, + warpMatrix, + motionType, + criteria, + inputMask, + gaussFiltSize, + callback, + ); + } + + late final _FindTransformECC_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, Mat, ffi.Int, TermCriteria, + Mat, ffi.Int, CvCallback_1)>>('FindTransformECC_Async'); + late final _FindTransformECC_Async = _FindTransformECC_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, Mat, int, TermCriteria, Mat, int, CvCallback_1)>(); + ffi.Pointer Fisheye_EstimateNewCameraMatrixForUndistortRectify( Mat k, Mat d, @@ -7303,24 +7096,6 @@ class CvNative { late final _FlannBasedMatcher_Close = _FlannBasedMatcher_ClosePtr.asFunction< void Function(FlannBasedMatcherPtr)>(); - ffi.Pointer FlannBasedMatcher_Close_Async( - FlannBasedMatcherPtr self, - CvCallback_0 callback, - ) { - return _FlannBasedMatcher_Close_Async( - self, - callback, - ); - } - - late final _FlannBasedMatcher_Close_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(FlannBasedMatcherPtr, - CvCallback_0)>>('FlannBasedMatcher_Close_Async'); - late final _FlannBasedMatcher_Close_Async = - _FlannBasedMatcher_Close_AsyncPtr.asFunction< - ffi.Pointer Function(FlannBasedMatcherPtr, CvCallback_0)>(); - ffi.Pointer FlannBasedMatcher_Create( ffi.Pointer rval, ) { @@ -7337,21 +7112,6 @@ class CvNative { _FlannBasedMatcher_CreatePtr.asFunction< ffi.Pointer Function(ffi.Pointer)>(); - ffi.Pointer FlannBasedMatcher_Create_Async( - CvCallback_1 callback, - ) { - return _FlannBasedMatcher_Create_Async( - callback, - ); - } - - late final _FlannBasedMatcher_Create_AsyncPtr = - _lookup Function(CvCallback_1)>>( - 'FlannBasedMatcher_Create_Async'); - late final _FlannBasedMatcher_Create_Async = - _FlannBasedMatcher_Create_AsyncPtr.asFunction< - ffi.Pointer Function(CvCallback_1)>(); - ffi.Pointer FlannBasedMatcher_KnnMatch( FlannBasedMatcher f, Mat query, @@ -7377,31 +7137,6 @@ class CvNative { ffi.Pointer Function( FlannBasedMatcher, Mat, Mat, int, ffi.Pointer)>(); - ffi.Pointer FlannBasedMatcher_KnnMatch_Async( - FlannBasedMatcher self, - Mat query, - Mat train, - int k, - CvCallback_1 callback, - ) { - return _FlannBasedMatcher_KnnMatch_Async( - self, - query, - train, - k, - callback, - ); - } - - late final _FlannBasedMatcher_KnnMatch_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(FlannBasedMatcher, Mat, Mat, ffi.Int, - CvCallback_1)>>('FlannBasedMatcher_KnnMatch_Async'); - late final _FlannBasedMatcher_KnnMatch_Async = - _FlannBasedMatcher_KnnMatch_AsyncPtr.asFunction< - ffi.Pointer Function( - FlannBasedMatcher, Mat, Mat, int, CvCallback_1)>(); - ffi.Pointer GArrayGArrayPoint_FromVec( VecVecPoint points, ffi.Pointer rval, @@ -7588,24 +7323,6 @@ class CvNative { late final _GFTTDetector_Close = _GFTTDetector_ClosePtr.asFunction(); - ffi.Pointer GFTTDetector_Close_Async( - GFTTDetectorPtr self, - CvCallback_0 callback, - ) { - return _GFTTDetector_Close_Async( - self, - callback, - ); - } - - late final _GFTTDetector_Close_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - GFTTDetectorPtr, CvCallback_0)>>('GFTTDetector_Close_Async'); - late final _GFTTDetector_Close_Async = - _GFTTDetector_Close_AsyncPtr.asFunction< - ffi.Pointer Function(GFTTDetectorPtr, CvCallback_0)>(); - ffi.Pointer GFTTDetector_Create( ffi.Pointer rval, ) { @@ -7621,20 +7338,6 @@ class CvNative { late final _GFTTDetector_Create = _GFTTDetector_CreatePtr.asFunction< ffi.Pointer Function(ffi.Pointer)>(); - ffi.Pointer GFTTDetector_Create_Async( - CvCallback_1 callback, - ) { - return _GFTTDetector_Create_Async( - callback, - ); - } - - late final _GFTTDetector_Create_AsyncPtr = - _lookup Function(CvCallback_1)>>( - 'GFTTDetector_Create_Async'); - late final _GFTTDetector_Create_Async = _GFTTDetector_Create_AsyncPtr - .asFunction Function(CvCallback_1)>(); - ffi.Pointer GFTTDetector_Detect( GFTTDetector a, Mat src, @@ -7655,26 +7358,6 @@ class CvNative { ffi.Pointer Function( GFTTDetector, Mat, ffi.Pointer)>(); - ffi.Pointer GFTTDetector_Detect_Async( - GFTTDetector self, - Mat src, - CvCallback_1 callback, - ) { - return _GFTTDetector_Detect_Async( - self, - src, - callback, - ); - } - - late final _GFTTDetector_Detect_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - GFTTDetector, Mat, CvCallback_1)>>('GFTTDetector_Detect_Async'); - late final _GFTTDetector_Detect_Async = - _GFTTDetector_Detect_AsyncPtr.asFunction< - ffi.Pointer Function(GFTTDetector, Mat, CvCallback_1)>(); - ffi.Pointer GaussianBlur( Mat src, Mat dst, @@ -10019,23 +9702,6 @@ class CvNative { _lookup>('KAZE_Close'); late final _KAZE_Close = _KAZE_ClosePtr.asFunction(); - ffi.Pointer KAZE_Close_Async( - KAZEPtr self, - CvCallback_0 callback, - ) { - return _KAZE_Close_Async( - self, - callback, - ); - } - - late final _KAZE_Close_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - KAZEPtr, CvCallback_0)>>('KAZE_Close_Async'); - late final _KAZE_Close_Async = _KAZE_Close_AsyncPtr.asFunction< - ffi.Pointer Function(KAZEPtr, CvCallback_0)>(); - ffi.Pointer KAZE_Create( ffi.Pointer rval, ) { @@ -10050,20 +9716,6 @@ class CvNative { late final _KAZE_Create = _KAZE_CreatePtr.asFunction< ffi.Pointer Function(ffi.Pointer)>(); - ffi.Pointer KAZE_Create_Async( - CvCallback_1 callback, - ) { - return _KAZE_Create_Async( - callback, - ); - } - - late final _KAZE_Create_AsyncPtr = - _lookup Function(CvCallback_1)>>( - 'KAZE_Create_Async'); - late final _KAZE_Create_Async = _KAZE_Create_AsyncPtr.asFunction< - ffi.Pointer Function(CvCallback_1)>(); - ffi.Pointer KAZE_Detect( KAZE a, Mat src, @@ -10107,47 +9759,6 @@ class CvNative { ffi.Pointer Function( KAZE, Mat, Mat, Mat, ffi.Pointer)>(); - ffi.Pointer KAZE_DetectAndCompute_Async( - KAZE self, - Mat src, - Mat mask, - CvCallback_2 callback, - ) { - return _KAZE_DetectAndCompute_Async( - self, - src, - mask, - callback, - ); - } - - late final _KAZE_DetectAndCompute_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - KAZE, Mat, Mat, CvCallback_2)>>('KAZE_DetectAndCompute_Async'); - late final _KAZE_DetectAndCompute_Async = - _KAZE_DetectAndCompute_AsyncPtr.asFunction< - ffi.Pointer Function(KAZE, Mat, Mat, CvCallback_2)>(); - - ffi.Pointer KAZE_Detect_Async( - KAZE self, - Mat src, - CvCallback_1 callback, - ) { - return _KAZE_Detect_Async( - self, - src, - callback, - ); - } - - late final _KAZE_Detect_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - KAZE, Mat, CvCallback_1)>>('KAZE_Detect_Async'); - late final _KAZE_Detect_Async = _KAZE_Detect_AsyncPtr.asFunction< - ffi.Pointer Function(KAZE, Mat, CvCallback_1)>(); - ffi.Pointer KMeans( Mat data, int k, @@ -10241,6 +9852,26 @@ class CvNative { late final _KalmanFilter_Correct = _KalmanFilter_CorrectPtr.asFunction< ffi.Pointer Function(KalmanFilter, Mat, ffi.Pointer)>(); + ffi.Pointer KalmanFilter_Correct_Async( + KalmanFilter self, + Mat measurement, + CvCallback_1 callback, + ) { + return _KalmanFilter_Correct_Async( + self, + measurement, + callback, + ); + } + + late final _KalmanFilter_Correct_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + KalmanFilter, Mat, CvCallback_1)>>('KalmanFilter_Correct_Async'); + late final _KalmanFilter_Correct_Async = + _KalmanFilter_Correct_AsyncPtr.asFunction< + ffi.Pointer Function(KalmanFilter, Mat, CvCallback_1)>(); + ffi.Pointer KalmanFilter_GetControlMatrix( KalmanFilter self, ffi.Pointer rval, @@ -10259,6 +9890,24 @@ class CvNative { _KalmanFilter_GetControlMatrixPtr.asFunction< ffi.Pointer Function(KalmanFilter, ffi.Pointer)>(); + ffi.Pointer KalmanFilter_GetControlMatrix_Async( + KalmanFilter self, + CvCallback_1 callback, + ) { + return _KalmanFilter_GetControlMatrix_Async( + self, + callback, + ); + } + + late final _KalmanFilter_GetControlMatrix_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(KalmanFilter, + CvCallback_1)>>('KalmanFilter_GetControlMatrix_Async'); + late final _KalmanFilter_GetControlMatrix_Async = + _KalmanFilter_GetControlMatrix_AsyncPtr.asFunction< + ffi.Pointer Function(KalmanFilter, CvCallback_1)>(); + ffi.Pointer KalmanFilter_GetErrorCovPost( KalmanFilter self, ffi.Pointer rval, @@ -10277,6 +9926,24 @@ class CvNative { _KalmanFilter_GetErrorCovPostPtr.asFunction< ffi.Pointer Function(KalmanFilter, ffi.Pointer)>(); + ffi.Pointer KalmanFilter_GetErrorCovPost_Async( + KalmanFilter self, + CvCallback_1 callback, + ) { + return _KalmanFilter_GetErrorCovPost_Async( + self, + callback, + ); + } + + late final _KalmanFilter_GetErrorCovPost_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(KalmanFilter, + CvCallback_1)>>('KalmanFilter_GetErrorCovPost_Async'); + late final _KalmanFilter_GetErrorCovPost_Async = + _KalmanFilter_GetErrorCovPost_AsyncPtr.asFunction< + ffi.Pointer Function(KalmanFilter, CvCallback_1)>(); + ffi.Pointer KalmanFilter_GetErrorCovPre( KalmanFilter self, ffi.Pointer rval, @@ -10295,6 +9962,24 @@ class CvNative { _KalmanFilter_GetErrorCovPrePtr.asFunction< ffi.Pointer Function(KalmanFilter, ffi.Pointer)>(); + ffi.Pointer KalmanFilter_GetErrorCovPre_Async( + KalmanFilter self, + CvCallback_1 callback, + ) { + return _KalmanFilter_GetErrorCovPre_Async( + self, + callback, + ); + } + + late final _KalmanFilter_GetErrorCovPre_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(KalmanFilter, + CvCallback_1)>>('KalmanFilter_GetErrorCovPre_Async'); + late final _KalmanFilter_GetErrorCovPre_Async = + _KalmanFilter_GetErrorCovPre_AsyncPtr.asFunction< + ffi.Pointer Function(KalmanFilter, CvCallback_1)>(); + ffi.Pointer KalmanFilter_GetGain( KalmanFilter self, ffi.Pointer rval, @@ -10312,6 +9997,23 @@ class CvNative { late final _KalmanFilter_GetGain = _KalmanFilter_GetGainPtr.asFunction< ffi.Pointer Function(KalmanFilter, ffi.Pointer)>(); + ffi.Pointer KalmanFilter_GetGain_Async( + KalmanFilter self, + CvCallback_1 callback, + ) { + return _KalmanFilter_GetGain_Async( + self, + callback, + ); + } + + late final _KalmanFilter_GetGain_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + KalmanFilter, CvCallback_1)>>('KalmanFilter_GetGain_Async'); + late final _KalmanFilter_GetGain_Async = _KalmanFilter_GetGain_AsyncPtr + .asFunction Function(KalmanFilter, CvCallback_1)>(); + ffi.Pointer KalmanFilter_GetMeasurementMatrix( KalmanFilter self, ffi.Pointer rval, @@ -10330,6 +10032,24 @@ class CvNative { _KalmanFilter_GetMeasurementMatrixPtr.asFunction< ffi.Pointer Function(KalmanFilter, ffi.Pointer)>(); + ffi.Pointer KalmanFilter_GetMeasurementMatrix_Async( + KalmanFilter self, + CvCallback_1 callback, + ) { + return _KalmanFilter_GetMeasurementMatrix_Async( + self, + callback, + ); + } + + late final _KalmanFilter_GetMeasurementMatrix_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(KalmanFilter, + CvCallback_1)>>('KalmanFilter_GetMeasurementMatrix_Async'); + late final _KalmanFilter_GetMeasurementMatrix_Async = + _KalmanFilter_GetMeasurementMatrix_AsyncPtr.asFunction< + ffi.Pointer Function(KalmanFilter, CvCallback_1)>(); + ffi.Pointer KalmanFilter_GetMeasurementNoiseCov( KalmanFilter self, ffi.Pointer rval, @@ -10348,6 +10068,24 @@ class CvNative { _KalmanFilter_GetMeasurementNoiseCovPtr.asFunction< ffi.Pointer Function(KalmanFilter, ffi.Pointer)>(); + ffi.Pointer KalmanFilter_GetMeasurementNoiseCov_Async( + KalmanFilter self, + CvCallback_1 callback, + ) { + return _KalmanFilter_GetMeasurementNoiseCov_Async( + self, + callback, + ); + } + + late final _KalmanFilter_GetMeasurementNoiseCov_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(KalmanFilter, + CvCallback_1)>>('KalmanFilter_GetMeasurementNoiseCov_Async'); + late final _KalmanFilter_GetMeasurementNoiseCov_Async = + _KalmanFilter_GetMeasurementNoiseCov_AsyncPtr.asFunction< + ffi.Pointer Function(KalmanFilter, CvCallback_1)>(); + ffi.Pointer KalmanFilter_GetProcessNoiseCov( KalmanFilter self, ffi.Pointer rval, @@ -10366,6 +10104,24 @@ class CvNative { _KalmanFilter_GetProcessNoiseCovPtr.asFunction< ffi.Pointer Function(KalmanFilter, ffi.Pointer)>(); + ffi.Pointer KalmanFilter_GetProcessNoiseCov_Async( + KalmanFilter self, + CvCallback_1 callback, + ) { + return _KalmanFilter_GetProcessNoiseCov_Async( + self, + callback, + ); + } + + late final _KalmanFilter_GetProcessNoiseCov_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(KalmanFilter, + CvCallback_1)>>('KalmanFilter_GetProcessNoiseCov_Async'); + late final _KalmanFilter_GetProcessNoiseCov_Async = + _KalmanFilter_GetProcessNoiseCov_AsyncPtr.asFunction< + ffi.Pointer Function(KalmanFilter, CvCallback_1)>(); + ffi.Pointer KalmanFilter_GetStatePost( KalmanFilter self, ffi.Pointer rval, @@ -10384,6 +10140,24 @@ class CvNative { _KalmanFilter_GetStatePostPtr.asFunction< ffi.Pointer Function(KalmanFilter, ffi.Pointer)>(); + ffi.Pointer KalmanFilter_GetStatePost_Async( + KalmanFilter self, + CvCallback_1 callback, + ) { + return _KalmanFilter_GetStatePost_Async( + self, + callback, + ); + } + + late final _KalmanFilter_GetStatePost_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + KalmanFilter, CvCallback_1)>>('KalmanFilter_GetStatePost_Async'); + late final _KalmanFilter_GetStatePost_Async = + _KalmanFilter_GetStatePost_AsyncPtr.asFunction< + ffi.Pointer Function(KalmanFilter, CvCallback_1)>(); + ffi.Pointer KalmanFilter_GetStatePre( KalmanFilter self, ffi.Pointer rval, @@ -10402,6 +10176,24 @@ class CvNative { _KalmanFilter_GetStatePrePtr.asFunction< ffi.Pointer Function(KalmanFilter, ffi.Pointer)>(); + ffi.Pointer KalmanFilter_GetStatePre_Async( + KalmanFilter self, + CvCallback_1 callback, + ) { + return _KalmanFilter_GetStatePre_Async( + self, + callback, + ); + } + + late final _KalmanFilter_GetStatePre_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + KalmanFilter, CvCallback_1)>>('KalmanFilter_GetStatePre_Async'); + late final _KalmanFilter_GetStatePre_Async = + _KalmanFilter_GetStatePre_AsyncPtr.asFunction< + ffi.Pointer Function(KalmanFilter, CvCallback_1)>(); + ffi.Pointer KalmanFilter_GetTemp1( KalmanFilter self, ffi.Pointer rval, @@ -10419,6 +10211,23 @@ class CvNative { late final _KalmanFilter_GetTemp1 = _KalmanFilter_GetTemp1Ptr.asFunction< ffi.Pointer Function(KalmanFilter, ffi.Pointer)>(); + ffi.Pointer KalmanFilter_GetTemp1_Async( + KalmanFilter self, + CvCallback_1 callback, + ) { + return _KalmanFilter_GetTemp1_Async( + self, + callback, + ); + } + + late final _KalmanFilter_GetTemp1_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + KalmanFilter, CvCallback_1)>>('KalmanFilter_GetTemp1_Async'); + late final _KalmanFilter_GetTemp1_Async = _KalmanFilter_GetTemp1_AsyncPtr + .asFunction Function(KalmanFilter, CvCallback_1)>(); + ffi.Pointer KalmanFilter_GetTemp2( KalmanFilter self, ffi.Pointer rval, @@ -10436,6 +10245,23 @@ class CvNative { late final _KalmanFilter_GetTemp2 = _KalmanFilter_GetTemp2Ptr.asFunction< ffi.Pointer Function(KalmanFilter, ffi.Pointer)>(); + ffi.Pointer KalmanFilter_GetTemp2_Async( + KalmanFilter self, + CvCallback_1 callback, + ) { + return _KalmanFilter_GetTemp2_Async( + self, + callback, + ); + } + + late final _KalmanFilter_GetTemp2_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + KalmanFilter, CvCallback_1)>>('KalmanFilter_GetTemp2_Async'); + late final _KalmanFilter_GetTemp2_Async = _KalmanFilter_GetTemp2_AsyncPtr + .asFunction Function(KalmanFilter, CvCallback_1)>(); + ffi.Pointer KalmanFilter_GetTemp3( KalmanFilter self, ffi.Pointer rval, @@ -10453,6 +10279,23 @@ class CvNative { late final _KalmanFilter_GetTemp3 = _KalmanFilter_GetTemp3Ptr.asFunction< ffi.Pointer Function(KalmanFilter, ffi.Pointer)>(); + ffi.Pointer KalmanFilter_GetTemp3_Async( + KalmanFilter self, + CvCallback_1 callback, + ) { + return _KalmanFilter_GetTemp3_Async( + self, + callback, + ); + } + + late final _KalmanFilter_GetTemp3_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + KalmanFilter, CvCallback_1)>>('KalmanFilter_GetTemp3_Async'); + late final _KalmanFilter_GetTemp3_Async = _KalmanFilter_GetTemp3_AsyncPtr + .asFunction Function(KalmanFilter, CvCallback_1)>(); + ffi.Pointer KalmanFilter_GetTemp4( KalmanFilter self, ffi.Pointer rval, @@ -10470,6 +10313,23 @@ class CvNative { late final _KalmanFilter_GetTemp4 = _KalmanFilter_GetTemp4Ptr.asFunction< ffi.Pointer Function(KalmanFilter, ffi.Pointer)>(); + ffi.Pointer KalmanFilter_GetTemp4_Async( + KalmanFilter self, + CvCallback_1 callback, + ) { + return _KalmanFilter_GetTemp4_Async( + self, + callback, + ); + } + + late final _KalmanFilter_GetTemp4_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + KalmanFilter, CvCallback_1)>>('KalmanFilter_GetTemp4_Async'); + late final _KalmanFilter_GetTemp4_Async = _KalmanFilter_GetTemp4_AsyncPtr + .asFunction Function(KalmanFilter, CvCallback_1)>(); + ffi.Pointer KalmanFilter_GetTemp5( KalmanFilter self, ffi.Pointer rval, @@ -10487,6 +10347,23 @@ class CvNative { late final _KalmanFilter_GetTemp5 = _KalmanFilter_GetTemp5Ptr.asFunction< ffi.Pointer Function(KalmanFilter, ffi.Pointer)>(); + ffi.Pointer KalmanFilter_GetTemp5_Async( + KalmanFilter self, + CvCallback_1 callback, + ) { + return _KalmanFilter_GetTemp5_Async( + self, + callback, + ); + } + + late final _KalmanFilter_GetTemp5_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + KalmanFilter, CvCallback_1)>>('KalmanFilter_GetTemp5_Async'); + late final _KalmanFilter_GetTemp5_Async = _KalmanFilter_GetTemp5_AsyncPtr + .asFunction Function(KalmanFilter, CvCallback_1)>(); + ffi.Pointer KalmanFilter_GetTransitionMatrix( KalmanFilter self, ffi.Pointer rval, @@ -10505,6 +10382,24 @@ class CvNative { _KalmanFilter_GetTransitionMatrixPtr.asFunction< ffi.Pointer Function(KalmanFilter, ffi.Pointer)>(); + ffi.Pointer KalmanFilter_GetTransitionMatrix_Async( + KalmanFilter self, + CvCallback_1 callback, + ) { + return _KalmanFilter_GetTransitionMatrix_Async( + self, + callback, + ); + } + + late final _KalmanFilter_GetTransitionMatrix_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(KalmanFilter, + CvCallback_1)>>('KalmanFilter_GetTransitionMatrix_Async'); + late final _KalmanFilter_GetTransitionMatrix_Async = + _KalmanFilter_GetTransitionMatrix_AsyncPtr.asFunction< + ffi.Pointer Function(KalmanFilter, CvCallback_1)>(); + ffi.Pointer KalmanFilter_Init( KalmanFilter self, int dynamParams, @@ -10548,6 +10443,59 @@ class CvNative { _KalmanFilter_InitWithParamsPtr.asFunction< ffi.Pointer Function(KalmanFilter, int, int, int, int)>(); + ffi.Pointer KalmanFilter_InitWithParams_Async( + KalmanFilter self, + int dynamParams, + int measureParams, + int controlParams, + int type, + CvCallback_0 callback, + ) { + return _KalmanFilter_InitWithParams_Async( + self, + dynamParams, + measureParams, + controlParams, + type, + callback, + ); + } + + late final _KalmanFilter_InitWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + KalmanFilter, + ffi.Int, + ffi.Int, + ffi.Int, + ffi.Int, + CvCallback_0)>>('KalmanFilter_InitWithParams_Async'); + late final _KalmanFilter_InitWithParams_Async = + _KalmanFilter_InitWithParams_AsyncPtr.asFunction< + ffi.Pointer Function( + KalmanFilter, int, int, int, int, CvCallback_0)>(); + + ffi.Pointer KalmanFilter_Init_Async( + KalmanFilter self, + int dynamParams, + int measureParams, + CvCallback_0 callback, + ) { + return _KalmanFilter_Init_Async( + self, + dynamParams, + measureParams, + callback, + ); + } + + late final _KalmanFilter_Init_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(KalmanFilter, ffi.Int, ffi.Int, + CvCallback_0)>>('KalmanFilter_Init_Async'); + late final _KalmanFilter_Init_Async = _KalmanFilter_Init_AsyncPtr.asFunction< + ffi.Pointer Function(KalmanFilter, int, int, CvCallback_0)>(); + ffi.Pointer KalmanFilter_New( int dynamParams, int measureParams, @@ -10572,6 +10520,29 @@ class CvNative { ffi.Pointer Function( int, int, int, int, ffi.Pointer)>(); + ffi.Pointer KalmanFilter_New_Async( + int dynamParams, + int measureParams, + int controlParams, + int type, + CvCallback_1 callback, + ) { + return _KalmanFilter_New_Async( + dynamParams, + measureParams, + controlParams, + type, + callback, + ); + } + + late final _KalmanFilter_New_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Int, ffi.Int, ffi.Int, ffi.Int, + CvCallback_1)>>('KalmanFilter_New_Async'); + late final _KalmanFilter_New_Async = _KalmanFilter_New_AsyncPtr.asFunction< + ffi.Pointer Function(int, int, int, int, CvCallback_1)>(); + ffi.Pointer KalmanFilter_Predict( KalmanFilter self, ffi.Pointer rval, @@ -10610,6 +10581,43 @@ class CvNative { ffi.Pointer Function( KalmanFilter, Mat, ffi.Pointer)>(); + ffi.Pointer KalmanFilter_PredictWithParams_Async( + KalmanFilter self, + Mat control, + CvCallback_1 callback, + ) { + return _KalmanFilter_PredictWithParams_Async( + self, + control, + callback, + ); + } + + late final _KalmanFilter_PredictWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(KalmanFilter, Mat, + CvCallback_1)>>('KalmanFilter_PredictWithParams_Async'); + late final _KalmanFilter_PredictWithParams_Async = + _KalmanFilter_PredictWithParams_AsyncPtr.asFunction< + ffi.Pointer Function(KalmanFilter, Mat, CvCallback_1)>(); + + ffi.Pointer KalmanFilter_Predict_Async( + KalmanFilter self, + CvCallback_1 callback, + ) { + return _KalmanFilter_Predict_Async( + self, + callback, + ); + } + + late final _KalmanFilter_Predict_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + KalmanFilter, CvCallback_1)>>('KalmanFilter_Predict_Async'); + late final _KalmanFilter_Predict_Async = _KalmanFilter_Predict_AsyncPtr + .asFunction Function(KalmanFilter, CvCallback_1)>(); + ffi.Pointer KalmanFilter_SetControlMatrix( KalmanFilter self, Mat controlMatrix, @@ -10627,6 +10635,26 @@ class CvNative { late final _KalmanFilter_SetControlMatrix = _KalmanFilter_SetControlMatrixPtr .asFunction Function(KalmanFilter, Mat)>(); + ffi.Pointer KalmanFilter_SetControlMatrix_Async( + KalmanFilter self, + Mat value, + CvCallback_0 callback, + ) { + return _KalmanFilter_SetControlMatrix_Async( + self, + value, + callback, + ); + } + + late final _KalmanFilter_SetControlMatrix_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(KalmanFilter, Mat, + CvCallback_0)>>('KalmanFilter_SetControlMatrix_Async'); + late final _KalmanFilter_SetControlMatrix_Async = + _KalmanFilter_SetControlMatrix_AsyncPtr.asFunction< + ffi.Pointer Function(KalmanFilter, Mat, CvCallback_0)>(); + ffi.Pointer KalmanFilter_SetErrorCovPost( KalmanFilter self, Mat errorCovPost, @@ -10644,6 +10672,26 @@ class CvNative { late final _KalmanFilter_SetErrorCovPost = _KalmanFilter_SetErrorCovPostPtr .asFunction Function(KalmanFilter, Mat)>(); + ffi.Pointer KalmanFilter_SetErrorCovPost_Async( + KalmanFilter self, + Mat value, + CvCallback_0 callback, + ) { + return _KalmanFilter_SetErrorCovPost_Async( + self, + value, + callback, + ); + } + + late final _KalmanFilter_SetErrorCovPost_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(KalmanFilter, Mat, + CvCallback_0)>>('KalmanFilter_SetErrorCovPost_Async'); + late final _KalmanFilter_SetErrorCovPost_Async = + _KalmanFilter_SetErrorCovPost_AsyncPtr.asFunction< + ffi.Pointer Function(KalmanFilter, Mat, CvCallback_0)>(); + ffi.Pointer KalmanFilter_SetErrorCovPre( KalmanFilter self, Mat errorCovPre, @@ -10661,6 +10709,26 @@ class CvNative { late final _KalmanFilter_SetErrorCovPre = _KalmanFilter_SetErrorCovPrePtr .asFunction Function(KalmanFilter, Mat)>(); + ffi.Pointer KalmanFilter_SetErrorCovPre_Async( + KalmanFilter self, + Mat value, + CvCallback_0 callback, + ) { + return _KalmanFilter_SetErrorCovPre_Async( + self, + value, + callback, + ); + } + + late final _KalmanFilter_SetErrorCovPre_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(KalmanFilter, Mat, + CvCallback_0)>>('KalmanFilter_SetErrorCovPre_Async'); + late final _KalmanFilter_SetErrorCovPre_Async = + _KalmanFilter_SetErrorCovPre_AsyncPtr.asFunction< + ffi.Pointer Function(KalmanFilter, Mat, CvCallback_0)>(); + ffi.Pointer KalmanFilter_SetGain( KalmanFilter self, Mat gain, @@ -10678,6 +10746,26 @@ class CvNative { late final _KalmanFilter_SetGain = _KalmanFilter_SetGainPtr.asFunction< ffi.Pointer Function(KalmanFilter, Mat)>(); + ffi.Pointer KalmanFilter_SetGain_Async( + KalmanFilter self, + Mat value, + CvCallback_0 callback, + ) { + return _KalmanFilter_SetGain_Async( + self, + value, + callback, + ); + } + + late final _KalmanFilter_SetGain_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + KalmanFilter, Mat, CvCallback_0)>>('KalmanFilter_SetGain_Async'); + late final _KalmanFilter_SetGain_Async = + _KalmanFilter_SetGain_AsyncPtr.asFunction< + ffi.Pointer Function(KalmanFilter, Mat, CvCallback_0)>(); + ffi.Pointer KalmanFilter_SetMeasurementMatrix( KalmanFilter self, Mat measurementMatrix, @@ -10696,6 +10784,26 @@ class CvNative { _KalmanFilter_SetMeasurementMatrixPtr.asFunction< ffi.Pointer Function(KalmanFilter, Mat)>(); + ffi.Pointer KalmanFilter_SetMeasurementMatrix_Async( + KalmanFilter self, + Mat value, + CvCallback_0 callback, + ) { + return _KalmanFilter_SetMeasurementMatrix_Async( + self, + value, + callback, + ); + } + + late final _KalmanFilter_SetMeasurementMatrix_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(KalmanFilter, Mat, + CvCallback_0)>>('KalmanFilter_SetMeasurementMatrix_Async'); + late final _KalmanFilter_SetMeasurementMatrix_Async = + _KalmanFilter_SetMeasurementMatrix_AsyncPtr.asFunction< + ffi.Pointer Function(KalmanFilter, Mat, CvCallback_0)>(); + ffi.Pointer KalmanFilter_SetMeasurementNoiseCov( KalmanFilter self, Mat measurementNoiseCov, @@ -10714,6 +10822,26 @@ class CvNative { _KalmanFilter_SetMeasurementNoiseCovPtr.asFunction< ffi.Pointer Function(KalmanFilter, Mat)>(); + ffi.Pointer KalmanFilter_SetMeasurementNoiseCov_Async( + KalmanFilter self, + Mat value, + CvCallback_0 callback, + ) { + return _KalmanFilter_SetMeasurementNoiseCov_Async( + self, + value, + callback, + ); + } + + late final _KalmanFilter_SetMeasurementNoiseCov_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(KalmanFilter, Mat, + CvCallback_0)>>('KalmanFilter_SetMeasurementNoiseCov_Async'); + late final _KalmanFilter_SetMeasurementNoiseCov_Async = + _KalmanFilter_SetMeasurementNoiseCov_AsyncPtr.asFunction< + ffi.Pointer Function(KalmanFilter, Mat, CvCallback_0)>(); + ffi.Pointer KalmanFilter_SetProcessNoiseCov( KalmanFilter self, Mat processNoiseCov, @@ -10732,6 +10860,26 @@ class CvNative { _KalmanFilter_SetProcessNoiseCovPtr.asFunction< ffi.Pointer Function(KalmanFilter, Mat)>(); + ffi.Pointer KalmanFilter_SetProcessNoiseCov_Async( + KalmanFilter self, + Mat value, + CvCallback_0 callback, + ) { + return _KalmanFilter_SetProcessNoiseCov_Async( + self, + value, + callback, + ); + } + + late final _KalmanFilter_SetProcessNoiseCov_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(KalmanFilter, Mat, + CvCallback_0)>>('KalmanFilter_SetProcessNoiseCov_Async'); + late final _KalmanFilter_SetProcessNoiseCov_Async = + _KalmanFilter_SetProcessNoiseCov_AsyncPtr.asFunction< + ffi.Pointer Function(KalmanFilter, Mat, CvCallback_0)>(); + ffi.Pointer KalmanFilter_SetStatePost( KalmanFilter self, Mat statePost, @@ -10749,6 +10897,26 @@ class CvNative { late final _KalmanFilter_SetStatePost = _KalmanFilter_SetStatePostPtr .asFunction Function(KalmanFilter, Mat)>(); + ffi.Pointer KalmanFilter_SetStatePost_Async( + KalmanFilter self, + Mat value, + CvCallback_0 callback, + ) { + return _KalmanFilter_SetStatePost_Async( + self, + value, + callback, + ); + } + + late final _KalmanFilter_SetStatePost_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(KalmanFilter, Mat, + CvCallback_0)>>('KalmanFilter_SetStatePost_Async'); + late final _KalmanFilter_SetStatePost_Async = + _KalmanFilter_SetStatePost_AsyncPtr.asFunction< + ffi.Pointer Function(KalmanFilter, Mat, CvCallback_0)>(); + ffi.Pointer KalmanFilter_SetStatePre( KalmanFilter self, Mat statePre, @@ -10766,6 +10934,26 @@ class CvNative { late final _KalmanFilter_SetStatePre = _KalmanFilter_SetStatePrePtr .asFunction Function(KalmanFilter, Mat)>(); + ffi.Pointer KalmanFilter_SetStatePre_Async( + KalmanFilter self, + Mat value, + CvCallback_0 callback, + ) { + return _KalmanFilter_SetStatePre_Async( + self, + value, + callback, + ); + } + + late final _KalmanFilter_SetStatePre_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(KalmanFilter, Mat, + CvCallback_0)>>('KalmanFilter_SetStatePre_Async'); + late final _KalmanFilter_SetStatePre_Async = + _KalmanFilter_SetStatePre_AsyncPtr.asFunction< + ffi.Pointer Function(KalmanFilter, Mat, CvCallback_0)>(); + ffi.Pointer KalmanFilter_SetTransitionMatrix( KalmanFilter self, Mat transitionMatrix, @@ -10784,6 +10972,26 @@ class CvNative { _KalmanFilter_SetTransitionMatrixPtr.asFunction< ffi.Pointer Function(KalmanFilter, Mat)>(); + ffi.Pointer KalmanFilter_SetTransitionMatrix_Async( + KalmanFilter self, + Mat value, + CvCallback_0 callback, + ) { + return _KalmanFilter_SetTransitionMatrix_Async( + self, + value, + callback, + ); + } + + late final _KalmanFilter_SetTransitionMatrix_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(KalmanFilter, Mat, + CvCallback_0)>>('KalmanFilter_SetTransitionMatrix_Async'); + late final _KalmanFilter_SetTransitionMatrix_Async = + _KalmanFilter_SetTransitionMatrix_AsyncPtr.asFunction< + ffi.Pointer Function(KalmanFilter, Mat, CvCallback_0)>(); + ffi.Pointer LUT( Mat src, Mat lut, @@ -11202,23 +11410,6 @@ class CvNative { _lookup>('MSER_Close'); late final _MSER_Close = _MSER_ClosePtr.asFunction(); - ffi.Pointer MSER_Close_Async( - MSERPtr self, - CvCallback_0 callback, - ) { - return _MSER_Close_Async( - self, - callback, - ); - } - - late final _MSER_Close_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - MSERPtr, CvCallback_0)>>('MSER_Close_Async'); - late final _MSER_Close_Async = _MSER_Close_AsyncPtr.asFunction< - ffi.Pointer Function(MSERPtr, CvCallback_0)>(); - ffi.Pointer MSER_Create( ffi.Pointer rval, ) { @@ -11233,57 +11424,24 @@ class CvNative { late final _MSER_Create = _MSER_CreatePtr.asFunction< ffi.Pointer Function(ffi.Pointer)>(); - ffi.Pointer MSER_Create_Async( - CvCallback_1 callback, - ) { - return _MSER_Create_Async( - callback, - ); - } - - late final _MSER_Create_AsyncPtr = - _lookup Function(CvCallback_1)>>( - 'MSER_Create_Async'); - late final _MSER_Create_Async = _MSER_Create_AsyncPtr.asFunction< - ffi.Pointer Function(CvCallback_1)>(); - ffi.Pointer MSER_Detect( MSER a, Mat src, ffi.Pointer rval, ) { - return _MSER_Detect( - a, - src, - rval, - ); - } - - late final _MSER_DetectPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - MSER, Mat, ffi.Pointer)>>('MSER_Detect'); - late final _MSER_Detect = _MSER_DetectPtr.asFunction< - ffi.Pointer Function(MSER, Mat, ffi.Pointer)>(); - - ffi.Pointer MSER_Detect_Async( - MSER self, - Mat src, - CvCallback_1 callback, - ) { - return _MSER_Detect_Async( - self, + return _MSER_Detect( + a, src, - callback, + rval, ); } - late final _MSER_Detect_AsyncPtr = _lookup< + late final _MSER_DetectPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - MSER, Mat, CvCallback_1)>>('MSER_Detect_Async'); - late final _MSER_Detect_Async = _MSER_Detect_AsyncPtr.asFunction< - ffi.Pointer Function(MSER, Mat, CvCallback_1)>(); + MSER, Mat, ffi.Pointer)>>('MSER_Detect'); + late final _MSER_Detect = _MSER_DetectPtr.asFunction< + ffi.Pointer Function(MSER, Mat, ffi.Pointer)>(); ffi.Pointer Mat_AbsDiff( Mat src1, @@ -18276,23 +18434,6 @@ class CvNative { _lookup>('ORB_Close'); late final _ORB_Close = _ORB_ClosePtr.asFunction(); - ffi.Pointer ORB_Close_Async( - ORBPtr self, - CvCallback_0 callback, - ) { - return _ORB_Close_Async( - self, - callback, - ); - } - - late final _ORB_Close_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - ORBPtr, CvCallback_0)>>('ORB_Close_Async'); - late final _ORB_Close_Async = _ORB_Close_AsyncPtr.asFunction< - ffi.Pointer Function(ORBPtr, CvCallback_0)>(); - ffi.Pointer ORB_Create( ffi.Pointer rval, ) { @@ -18350,64 +18491,6 @@ class CvNative { ffi.Pointer Function( int, double, int, int, int, int, int, int, int, ffi.Pointer)>(); - ffi.Pointer ORB_CreateWithParams_Async( - int nfeatures, - double scaleFactor, - int nlevels, - int edgeThreshold, - int firstLevel, - int WTA_K, - int scoreType, - int patchSize, - int fastThreshold, - CvCallback_1 callback, - ) { - return _ORB_CreateWithParams_Async( - nfeatures, - scaleFactor, - nlevels, - edgeThreshold, - firstLevel, - WTA_K, - scoreType, - patchSize, - fastThreshold, - callback, - ); - } - - late final _ORB_CreateWithParams_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Int, - ffi.Float, - ffi.Int, - ffi.Int, - ffi.Int, - ffi.Int, - ffi.Int, - ffi.Int, - ffi.Int, - CvCallback_1)>>('ORB_CreateWithParams_Async'); - late final _ORB_CreateWithParams_Async = - _ORB_CreateWithParams_AsyncPtr.asFunction< - ffi.Pointer Function( - int, double, int, int, int, int, int, int, int, CvCallback_1)>(); - - ffi.Pointer ORB_Create_Async( - CvCallback_1 callback, - ) { - return _ORB_Create_Async( - callback, - ); - } - - late final _ORB_Create_AsyncPtr = - _lookup Function(CvCallback_1)>>( - 'ORB_Create_Async'); - late final _ORB_Create_Async = _ORB_Create_AsyncPtr.asFunction< - ffi.Pointer Function(CvCallback_1)>(); - ffi.Pointer ORB_Detect( ORB o, Mat src, @@ -18451,47 +18534,6 @@ class CvNative { ffi.Pointer Function( ORB, Mat, Mat, Mat, ffi.Pointer)>(); - ffi.Pointer ORB_DetectAndCompute_Async( - ORB self, - Mat src, - Mat mask, - CvCallback_2 callback, - ) { - return _ORB_DetectAndCompute_Async( - self, - src, - mask, - callback, - ); - } - - late final _ORB_DetectAndCompute_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - ORB, Mat, Mat, CvCallback_2)>>('ORB_DetectAndCompute_Async'); - late final _ORB_DetectAndCompute_Async = - _ORB_DetectAndCompute_AsyncPtr.asFunction< - ffi.Pointer Function(ORB, Mat, Mat, CvCallback_2)>(); - - ffi.Pointer ORB_Detect_Async( - ORB self, - Mat src, - CvCallback_1 callback, - ) { - return _ORB_Detect_Async( - self, - src, - callback, - ); - } - - late final _ORB_Detect_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - ORB, Mat, CvCallback_1)>>('ORB_Detect_Async'); - late final _ORB_Detect_Async = _ORB_Detect_AsyncPtr.asFunction< - ffi.Pointer Function(ORB, Mat, CvCallback_1)>(); - ffi.Pointer Ones( int rows, int cols, @@ -20207,23 +20249,6 @@ class CvNative { _lookup>('SIFT_Close'); late final _SIFT_Close = _SIFT_ClosePtr.asFunction(); - ffi.Pointer SIFT_Close_Async( - SIFTPtr self, - CvCallback_0 callback, - ) { - return _SIFT_Close_Async( - self, - callback, - ); - } - - late final _SIFT_Close_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - SIFTPtr, CvCallback_0)>>('SIFT_Close_Async'); - late final _SIFT_Close_Async = _SIFT_Close_AsyncPtr.asFunction< - ffi.Pointer Function(SIFTPtr, CvCallback_0)>(); - ffi.Pointer SIFT_Create( ffi.Pointer rval, ) { @@ -20238,20 +20263,6 @@ class CvNative { late final _SIFT_Create = _SIFT_CreatePtr.asFunction< ffi.Pointer Function(ffi.Pointer)>(); - ffi.Pointer SIFT_Create_Async( - CvCallback_1 callback, - ) { - return _SIFT_Create_Async( - callback, - ); - } - - late final _SIFT_Create_AsyncPtr = - _lookup Function(CvCallback_1)>>( - 'SIFT_Create_Async'); - late final _SIFT_Create_Async = _SIFT_Create_AsyncPtr.asFunction< - ffi.Pointer Function(CvCallback_1)>(); - ffi.Pointer SIFT_Detect( SIFT f, Mat src, @@ -20295,47 +20306,6 @@ class CvNative { ffi.Pointer Function( SIFT, Mat, Mat, Mat, ffi.Pointer)>(); - ffi.Pointer SIFT_DetectAndCompute_Async( - SIFT self, - Mat src, - Mat mask, - CvCallback_2 callback, - ) { - return _SIFT_DetectAndCompute_Async( - self, - src, - mask, - callback, - ); - } - - late final _SIFT_DetectAndCompute_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - SIFT, Mat, Mat, CvCallback_2)>>('SIFT_DetectAndCompute_Async'); - late final _SIFT_DetectAndCompute_Async = - _SIFT_DetectAndCompute_AsyncPtr.asFunction< - ffi.Pointer Function(SIFT, Mat, Mat, CvCallback_2)>(); - - ffi.Pointer SIFT_Detect_Async( - SIFT self, - Mat src, - CvCallback_1 callback, - ) { - return _SIFT_Detect_Async( - self, - src, - callback, - ); - } - - late final _SIFT_Detect_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - SIFT, Mat, CvCallback_1)>>('SIFT_Detect_Async'); - late final _SIFT_Detect_Async = _SIFT_Detect_AsyncPtr.asFunction< - ffi.Pointer Function(SIFT, Mat, CvCallback_1)>(); - ffi.Pointer SVD_Compute( Mat src, ffi.Pointer w, @@ -20656,25 +20626,6 @@ class CvNative { late final _SimpleBlobDetector_Close = _SimpleBlobDetector_ClosePtr .asFunction(); - ffi.Pointer SimpleBlobDetector_Close_Async( - SimpleBlobDetectorPtr self, - CvCallback_0 callback, - ) { - return _SimpleBlobDetector_Close_Async( - self, - callback, - ); - } - - late final _SimpleBlobDetector_Close_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(SimpleBlobDetectorPtr, - CvCallback_0)>>('SimpleBlobDetector_Close_Async'); - late final _SimpleBlobDetector_Close_Async = - _SimpleBlobDetector_Close_AsyncPtr.asFunction< - ffi.Pointer Function( - SimpleBlobDetectorPtr, CvCallback_0)>(); - ffi.Pointer SimpleBlobDetector_Create( ffi.Pointer rval, ) { @@ -20691,21 +20642,6 @@ class CvNative { _SimpleBlobDetector_CreatePtr.asFunction< ffi.Pointer Function(ffi.Pointer)>(); - ffi.Pointer SimpleBlobDetector_Create_Async( - CvCallback_1 callback, - ) { - return _SimpleBlobDetector_Create_Async( - callback, - ); - } - - late final _SimpleBlobDetector_Create_AsyncPtr = - _lookup Function(CvCallback_1)>>( - 'SimpleBlobDetector_Create_Async'); - late final _SimpleBlobDetector_Create_Async = - _SimpleBlobDetector_Create_AsyncPtr.asFunction< - ffi.Pointer Function(CvCallback_1)>(); - ffi.Pointer SimpleBlobDetector_Create_WithParams( SimpleBlobDetectorParams params, ffi.Pointer rval, @@ -20726,25 +20662,6 @@ class CvNative { ffi.Pointer Function( SimpleBlobDetectorParams, ffi.Pointer)>(); - ffi.Pointer SimpleBlobDetector_Create_WithParams_Async( - SimpleBlobDetectorParams params, - CvCallback_1 callback, - ) { - return _SimpleBlobDetector_Create_WithParams_Async( - params, - callback, - ); - } - - late final _SimpleBlobDetector_Create_WithParams_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(SimpleBlobDetectorParams, - CvCallback_1)>>('SimpleBlobDetector_Create_WithParams_Async'); - late final _SimpleBlobDetector_Create_WithParams_Async = - _SimpleBlobDetector_Create_WithParams_AsyncPtr.asFunction< - ffi.Pointer Function( - SimpleBlobDetectorParams, CvCallback_1)>(); - ffi.Pointer SimpleBlobDetector_Detect( SimpleBlobDetector b, Mat src, @@ -20766,27 +20683,6 @@ class CvNative { ffi.Pointer Function( SimpleBlobDetector, Mat, ffi.Pointer)>(); - ffi.Pointer SimpleBlobDetector_Detect_Async( - SimpleBlobDetector self, - Mat src, - CvCallback_1 callback, - ) { - return _SimpleBlobDetector_Detect_Async( - self, - src, - callback, - ); - } - - late final _SimpleBlobDetector_Detect_AsyncPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(SimpleBlobDetector, Mat, - CvCallback_1)>>('SimpleBlobDetector_Detect_Async'); - late final _SimpleBlobDetector_Detect_Async = - _SimpleBlobDetector_Detect_AsyncPtr.asFunction< - ffi.Pointer Function( - SimpleBlobDetector, Mat, CvCallback_1)>(); - ffi.Pointer Sobel( Mat src, Mat dst, @@ -22848,6 +22744,20 @@ class CvNative { late final _TrackerMIL_Create = _TrackerMIL_CreatePtr.asFunction< ffi.Pointer Function(ffi.Pointer)>(); + ffi.Pointer TrackerMIL_Create_Async( + CvCallback_1 callback, + ) { + return _TrackerMIL_Create_Async( + callback, + ); + } + + late final _TrackerMIL_Create_AsyncPtr = + _lookup Function(CvCallback_1)>>( + 'TrackerMIL_Create_Async'); + late final _TrackerMIL_Create_Async = _TrackerMIL_Create_AsyncPtr.asFunction< + ffi.Pointer Function(CvCallback_1)>(); + ffi.Pointer TrackerMIL_Init( TrackerMIL self, Mat image, @@ -22867,6 +22777,27 @@ class CvNative { late final _TrackerMIL_Init = _TrackerMIL_InitPtr.asFunction< ffi.Pointer Function(TrackerMIL, Mat, Rect)>(); + ffi.Pointer TrackerMIL_Init_Async( + TrackerMIL self, + Mat image, + Rect bbox, + CvCallback_0 callback, + ) { + return _TrackerMIL_Init_Async( + self, + image, + bbox, + callback, + ); + } + + late final _TrackerMIL_Init_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + TrackerMIL, Mat, Rect, CvCallback_0)>>('TrackerMIL_Init_Async'); + late final _TrackerMIL_Init_Async = _TrackerMIL_Init_AsyncPtr.asFunction< + ffi.Pointer Function(TrackerMIL, Mat, Rect, CvCallback_0)>(); + ffi.Pointer TrackerMIL_Update( TrackerMIL self, Mat image, @@ -22889,6 +22820,25 @@ class CvNative { ffi.Pointer Function( TrackerMIL, Mat, ffi.Pointer, ffi.Pointer)>(); + ffi.Pointer TrackerMIL_Update_Async( + TrackerMIL self, + Mat image, + CvCallback_2 callback, + ) { + return _TrackerMIL_Update_Async( + self, + image, + callback, + ); + } + + late final _TrackerMIL_Update_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + TrackerMIL, Mat, CvCallback_2)>>('TrackerMIL_Update_Async'); + late final _TrackerMIL_Update_Async = _TrackerMIL_Update_AsyncPtr.asFunction< + ffi.Pointer Function(TrackerMIL, Mat, CvCallback_2)>(); + ffi.Pointer Undistort( Mat src, Mat dst, @@ -25668,6 +25618,25 @@ class CvNative { ffi.Pointer Function( VideoCapture, int, ffi.Pointer)>(); + ffi.Pointer VideoCapture_Get_Async( + VideoCapture self, + int prop, + CvCallback_1 callback, + ) { + return _VideoCapture_Get_Async( + self, + prop, + callback, + ); + } + + late final _VideoCapture_Get_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VideoCapture, ffi.Int, CvCallback_1)>>('VideoCapture_Get_Async'); + late final _VideoCapture_Get_Async = _VideoCapture_Get_AsyncPtr.asFunction< + ffi.Pointer Function(VideoCapture, int, CvCallback_1)>(); + ffi.Pointer VideoCapture_Grab( VideoCapture self, int skip, @@ -25685,22 +25654,56 @@ class CvNative { late final _VideoCapture_Grab = _VideoCapture_GrabPtr.asFunction< ffi.Pointer Function(VideoCapture, int)>(); + ffi.Pointer VideoCapture_Grab_Async( + VideoCapture self, + CvCallback_1 callback, + ) { + return _VideoCapture_Grab_Async( + self, + callback, + ); + } + + late final _VideoCapture_Grab_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VideoCapture, CvCallback_1)>>('VideoCapture_Grab_Async'); + late final _VideoCapture_Grab_Async = _VideoCapture_Grab_AsyncPtr.asFunction< + ffi.Pointer Function(VideoCapture, CvCallback_1)>(); + ffi.Pointer VideoCapture_IsOpened( VideoCapture self, ffi.Pointer rval, ) { - return _VideoCapture_IsOpened( + return _VideoCapture_IsOpened( + self, + rval, + ); + } + + late final _VideoCapture_IsOpenedPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VideoCapture, ffi.Pointer)>>('VideoCapture_IsOpened'); + late final _VideoCapture_IsOpened = _VideoCapture_IsOpenedPtr.asFunction< + ffi.Pointer Function(VideoCapture, ffi.Pointer)>(); + + ffi.Pointer VideoCapture_IsOpened_Async( + VideoCapture self, + CvCallback_1 callback, + ) { + return _VideoCapture_IsOpened_Async( self, - rval, + callback, ); } - late final _VideoCapture_IsOpenedPtr = _lookup< + late final _VideoCapture_IsOpened_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VideoCapture, ffi.Pointer)>>('VideoCapture_IsOpened'); - late final _VideoCapture_IsOpened = _VideoCapture_IsOpenedPtr.asFunction< - ffi.Pointer Function(VideoCapture, ffi.Pointer)>(); + VideoCapture, CvCallback_1)>>('VideoCapture_IsOpened_Async'); + late final _VideoCapture_IsOpened_Async = _VideoCapture_IsOpened_AsyncPtr + .asFunction Function(VideoCapture, CvCallback_1)>(); ffi.Pointer VideoCapture_New( ffi.Pointer rval, @@ -25738,6 +25741,27 @@ class CvNative { ffi.Pointer Function( ffi.Pointer, int, ffi.Pointer)>(); + ffi.Pointer VideoCapture_NewFromFile_Async( + ffi.Pointer filename, + int apiPreference, + CvCallback_1 callback, + ) { + return _VideoCapture_NewFromFile_Async( + filename, + apiPreference, + callback, + ); + } + + late final _VideoCapture_NewFromFile_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Int, + CvCallback_1)>>('VideoCapture_NewFromFile_Async'); + late final _VideoCapture_NewFromFile_Async = + _VideoCapture_NewFromFile_AsyncPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, CvCallback_1)>(); + ffi.Pointer VideoCapture_NewFromIndex( int index, int apiPreference, @@ -25759,6 +25783,40 @@ class CvNative { ffi.Pointer Function( int, int, ffi.Pointer)>(); + ffi.Pointer VideoCapture_NewFromIndex_Async( + int index, + int apiPreference, + CvCallback_1 callback, + ) { + return _VideoCapture_NewFromIndex_Async( + index, + apiPreference, + callback, + ); + } + + late final _VideoCapture_NewFromIndex_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Int, ffi.Int, + CvCallback_1)>>('VideoCapture_NewFromIndex_Async'); + late final _VideoCapture_NewFromIndex_Async = + _VideoCapture_NewFromIndex_AsyncPtr.asFunction< + ffi.Pointer Function(int, int, CvCallback_1)>(); + + ffi.Pointer VideoCapture_New_Async( + CvCallback_1 callback, + ) { + return _VideoCapture_New_Async( + callback, + ); + } + + late final _VideoCapture_New_AsyncPtr = + _lookup Function(CvCallback_1)>>( + 'VideoCapture_New_Async'); + late final _VideoCapture_New_Async = _VideoCapture_New_AsyncPtr.asFunction< + ffi.Pointer Function(CvCallback_1)>(); + ffi.Pointer VideoCapture_Open( VideoCapture self, ffi.Pointer uri, @@ -25822,6 +25880,49 @@ class CvNative { ffi.Pointer Function( VideoCapture, int, int, ffi.Pointer)>(); + ffi.Pointer VideoCapture_OpenDeviceWithAPI_Async( + VideoCapture self, + int device, + int apiPreference, + CvCallback_1 callback, + ) { + return _VideoCapture_OpenDeviceWithAPI_Async( + self, + device, + apiPreference, + callback, + ); + } + + late final _VideoCapture_OpenDeviceWithAPI_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VideoCapture, ffi.Int, ffi.Int, + CvCallback_1)>>('VideoCapture_OpenDeviceWithAPI_Async'); + late final _VideoCapture_OpenDeviceWithAPI_Async = + _VideoCapture_OpenDeviceWithAPI_AsyncPtr.asFunction< + ffi.Pointer Function( + VideoCapture, int, int, CvCallback_1)>(); + + ffi.Pointer VideoCapture_OpenDevice_Async( + VideoCapture self, + int device, + CvCallback_1 callback, + ) { + return _VideoCapture_OpenDevice_Async( + self, + device, + callback, + ); + } + + late final _VideoCapture_OpenDevice_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VideoCapture, ffi.Int, + CvCallback_1)>>('VideoCapture_OpenDevice_Async'); + late final _VideoCapture_OpenDevice_Async = + _VideoCapture_OpenDevice_AsyncPtr.asFunction< + ffi.Pointer Function(VideoCapture, int, CvCallback_1)>(); + ffi.Pointer VideoCapture_OpenWithAPI( VideoCapture self, ffi.Pointer uri, @@ -25845,6 +25946,49 @@ class CvNative { ffi.Pointer Function(VideoCapture, ffi.Pointer, int, ffi.Pointer)>(); + ffi.Pointer VideoCapture_OpenWithAPI_Async( + VideoCapture self, + ffi.Pointer uri, + int apiPreference, + CvCallback_1 callback, + ) { + return _VideoCapture_OpenWithAPI_Async( + self, + uri, + apiPreference, + callback, + ); + } + + late final _VideoCapture_OpenWithAPI_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VideoCapture, ffi.Pointer, + ffi.Int, CvCallback_1)>>('VideoCapture_OpenWithAPI_Async'); + late final _VideoCapture_OpenWithAPI_Async = + _VideoCapture_OpenWithAPI_AsyncPtr.asFunction< + ffi.Pointer Function( + VideoCapture, ffi.Pointer, int, CvCallback_1)>(); + + ffi.Pointer VideoCapture_Open_Async( + VideoCapture self, + ffi.Pointer uri, + CvCallback_1 callback, + ) { + return _VideoCapture_Open_Async( + self, + uri, + callback, + ); + } + + late final _VideoCapture_Open_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VideoCapture, ffi.Pointer, + CvCallback_1)>>('VideoCapture_Open_Async'); + late final _VideoCapture_Open_Async = _VideoCapture_Open_AsyncPtr.asFunction< + ffi.Pointer Function( + VideoCapture, ffi.Pointer, CvCallback_1)>(); + ffi.Pointer VideoCapture_Read( VideoCapture self, Mat buf, @@ -25865,6 +26009,23 @@ class CvNative { ffi.Pointer Function( VideoCapture, Mat, ffi.Pointer)>(); + ffi.Pointer VideoCapture_Read_Async( + VideoCapture self, + CvCallback_2 callback, + ) { + return _VideoCapture_Read_Async( + self, + callback, + ); + } + + late final _VideoCapture_Read_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VideoCapture, CvCallback_2)>>('VideoCapture_Read_Async'); + late final _VideoCapture_Read_Async = _VideoCapture_Read_AsyncPtr.asFunction< + ffi.Pointer Function(VideoCapture, CvCallback_2)>(); + ffi.Pointer VideoCapture_Release( VideoCapture self, ) { @@ -25879,6 +26040,23 @@ class CvNative { late final _VideoCapture_Release = _VideoCapture_ReleasePtr.asFunction< ffi.Pointer Function(VideoCapture)>(); + ffi.Pointer VideoCapture_Release_Async( + VideoCapture self, + CvCallback_0 callback, + ) { + return _VideoCapture_Release_Async( + self, + callback, + ); + } + + late final _VideoCapture_Release_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VideoCapture, CvCallback_0)>>('VideoCapture_Release_Async'); + late final _VideoCapture_Release_Async = _VideoCapture_Release_AsyncPtr + .asFunction Function(VideoCapture, CvCallback_0)>(); + ffi.Pointer VideoCapture_Set( VideoCapture self, int prop, @@ -25898,6 +26076,28 @@ class CvNative { late final _VideoCapture_Set = _VideoCapture_SetPtr.asFunction< ffi.Pointer Function(VideoCapture, int, double)>(); + ffi.Pointer VideoCapture_Set_Async( + VideoCapture self, + int prop, + double param, + CvCallback_1 callback, + ) { + return _VideoCapture_Set_Async( + self, + prop, + param, + callback, + ); + } + + late final _VideoCapture_Set_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VideoCapture, ffi.Int, ffi.Double, + CvCallback_1)>>('VideoCapture_Set_Async'); + late final _VideoCapture_Set_Async = _VideoCapture_Set_AsyncPtr.asFunction< + ffi.Pointer Function( + VideoCapture, int, double, CvCallback_1)>(); + void VideoWriter_Close( VideoWriterPtr self, ) { @@ -25936,6 +26136,30 @@ class CvNative { ffi.Pointer Function( int, int, int, int, ffi.Pointer)>(); + ffi.Pointer VideoWriter_Fourcc_Async( + int c1, + int c2, + int c3, + int c4, + CvCallback_1 callback, + ) { + return _VideoWriter_Fourcc_Async( + c1, + c2, + c3, + c4, + callback, + ); + } + + late final _VideoWriter_Fourcc_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Char, ffi.Char, ffi.Char, ffi.Char, + CvCallback_1)>>('VideoWriter_Fourcc_Async'); + late final _VideoWriter_Fourcc_Async = + _VideoWriter_Fourcc_AsyncPtr.asFunction< + ffi.Pointer Function(int, int, int, int, CvCallback_1)>(); + ffi.Pointer VideoWriter_IsOpened( VideoWriter self, ffi.Pointer rval, @@ -25953,6 +26177,23 @@ class CvNative { late final _VideoWriter_IsOpened = _VideoWriter_IsOpenedPtr.asFunction< ffi.Pointer Function(VideoWriter, ffi.Pointer)>(); + ffi.Pointer VideoWriter_IsOpened_Async( + VideoWriter self, + CvCallback_1 callback, + ) { + return _VideoWriter_IsOpened_Async( + self, + callback, + ); + } + + late final _VideoWriter_IsOpened_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VideoWriter, CvCallback_1)>>('VideoWriter_IsOpened_Async'); + late final _VideoWriter_IsOpened_Async = _VideoWriter_IsOpened_AsyncPtr + .asFunction Function(VideoWriter, CvCallback_1)>(); + ffi.Pointer VideoWriter_New( ffi.Pointer rval, ) { @@ -25968,6 +26209,20 @@ class CvNative { late final _VideoWriter_New = _VideoWriter_NewPtr.asFunction< ffi.Pointer Function(ffi.Pointer)>(); + ffi.Pointer VideoWriter_New_Async( + CvCallback_1 callback, + ) { + return _VideoWriter_New_Async( + callback, + ); + } + + late final _VideoWriter_New_AsyncPtr = + _lookup Function(CvCallback_1)>>( + 'VideoWriter_New_Async'); + late final _VideoWriter_New_Async = _VideoWriter_New_AsyncPtr.asFunction< + ffi.Pointer Function(CvCallback_1)>(); + ffi.Pointer VideoWriter_Open( VideoWriter self, ffi.Pointer name, @@ -26002,6 +26257,43 @@ class CvNative { ffi.Pointer Function(VideoWriter, ffi.Pointer, ffi.Pointer, double, int, int, bool)>(); + ffi.Pointer VideoWriter_Open_Async( + VideoWriter self, + ffi.Pointer name, + ffi.Pointer codec, + double fps, + int width, + int height, + bool isColor, + CvCallback_1 callback, + ) { + return _VideoWriter_Open_Async( + self, + name, + codec, + fps, + width, + height, + isColor, + callback, + ); + } + + late final _VideoWriter_Open_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VideoWriter, + ffi.Pointer, + ffi.Pointer, + ffi.Double, + ffi.Int, + ffi.Int, + ffi.Bool, + CvCallback_1)>>('VideoWriter_Open_Async'); + late final _VideoWriter_Open_Async = _VideoWriter_Open_AsyncPtr.asFunction< + ffi.Pointer Function(VideoWriter, ffi.Pointer, + ffi.Pointer, double, int, int, bool, CvCallback_1)>(); + ffi.Pointer VideoWriter_Release( VideoWriter self, ) { @@ -26016,6 +26308,23 @@ class CvNative { late final _VideoWriter_Release = _VideoWriter_ReleasePtr.asFunction< ffi.Pointer Function(VideoWriter)>(); + ffi.Pointer VideoWriter_Release_Async( + VideoWriter self, + CvCallback_0 callback, + ) { + return _VideoWriter_Release_Async( + self, + callback, + ); + } + + late final _VideoWriter_Release_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VideoWriter, CvCallback_0)>>('VideoWriter_Release_Async'); + late final _VideoWriter_Release_Async = _VideoWriter_Release_AsyncPtr + .asFunction Function(VideoWriter, CvCallback_0)>(); + ffi.Pointer VideoWriter_Write( VideoWriter self, Mat img, @@ -26032,6 +26341,25 @@ class CvNative { late final _VideoWriter_Write = _VideoWriter_WritePtr.asFunction< ffi.Pointer Function(VideoWriter, Mat)>(); + ffi.Pointer VideoWriter_Write_Async( + VideoWriter self, + Mat img, + CvCallback_0 callback, + ) { + return _VideoWriter_Write_Async( + self, + img, + callback, + ); + } + + late final _VideoWriter_Write_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VideoWriter, Mat, CvCallback_0)>>('VideoWriter_Write_Async'); + late final _VideoWriter_Write_Async = _VideoWriter_Write_AsyncPtr.asFunction< + ffi.Pointer Function(VideoWriter, Mat, CvCallback_0)>(); + ffi.Pointer WarpAffine( Mat src, Mat dst, @@ -29799,18 +30127,8 @@ class _SymbolAddresses { _SymbolAddresses(this._library); ffi.Pointer> get AKAZE_Close => _library._AKAZE_ClosePtr; - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function(AKAZEPtr, CvCallback_0)>> - get AKAZE_Close_Async => _library._AKAZE_Close_AsyncPtr; ffi.Pointer> get AgastFeatureDetector_Close => _library._AgastFeatureDetector_ClosePtr; - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - AgastFeatureDetectorPtr, CvCallback_0)>> - get AgastFeatureDetector_Close_Async => - _library._AgastFeatureDetector_Close_AsyncPtr; ffi.Pointer> get AlignMTB_Close => _library._AlignMTB_ClosePtr; ffi.Pointer> @@ -29824,16 +30142,8 @@ class _SymbolAddresses { get AsyncArray_Close => _library._AsyncArray_ClosePtr; ffi.Pointer> get BFMatcher_Close => _library._BFMatcher_ClosePtr; - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function(BFMatcherPtr, CvCallback_0)>> - get BFMatcher_Close_Async => _library._BFMatcher_Close_AsyncPtr; ffi.Pointer> get BRISK_Close => _library._BRISK_ClosePtr; - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function(BRISKPtr, CvCallback_0)>> - get BRISK_Close_Async => _library._BRISK_Close_AsyncPtr; ffi.Pointer> get BackgroundSubtractorKNN_Close => _library._BackgroundSubtractorKNN_ClosePtr; @@ -29857,34 +30167,14 @@ class _SymbolAddresses { get FaceRecognizerSF_Close => _library._FaceRecognizerSF_ClosePtr; ffi.Pointer> get FastFeatureDetector_Close => _library._FastFeatureDetector_ClosePtr; - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - FastFeatureDetectorPtr, CvCallback_0)>> - get FastFeatureDetector_Close_Async => - _library._FastFeatureDetector_Close_AsyncPtr; ffi.Pointer> get FlannBasedMatcher_Close => _library._FlannBasedMatcher_ClosePtr; - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function( - FlannBasedMatcherPtr, CvCallback_0)>> - get FlannBasedMatcher_Close_Async => - _library._FlannBasedMatcher_Close_AsyncPtr; ffi.Pointer> get GFTTDetector_Close => _library._GFTTDetector_ClosePtr; - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function(GFTTDetectorPtr, CvCallback_0)>> - get GFTTDetector_Close_Async => _library._GFTTDetector_Close_AsyncPtr; ffi.Pointer> get HOGDescriptor_Close => _library._HOGDescriptor_ClosePtr; ffi.Pointer> get KAZE_Close => _library._KAZE_ClosePtr; - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function(KAZEPtr, CvCallback_0)>> - get KAZE_Close_Async => _library._KAZE_Close_AsyncPtr; ffi.Pointer> get KalmanFilter_Close => _library._KalmanFilter_ClosePtr; ffi.Pointer> @@ -29893,10 +30183,6 @@ class _SymbolAddresses { get Layer_Close_Async => _library._Layer_Close_AsyncPtr; ffi.Pointer> get MSER_Close => _library._MSER_ClosePtr; - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function(MSERPtr, CvCallback_0)>> - get MSER_Close_Async => _library._MSER_Close_AsyncPtr; ffi.Pointer> get Mat_Close => _library._Mat_ClosePtr; ffi.Pointer)>> @@ -29909,20 +30195,12 @@ class _SymbolAddresses { get Net_Close_Async => _library._Net_Close_AsyncPtr; ffi.Pointer> get ORB_Close => _library._ORB_ClosePtr; - ffi.Pointer< - ffi - .NativeFunction Function(ORBPtr, CvCallback_0)>> - get ORB_Close_Async => _library._ORB_Close_AsyncPtr; ffi.Pointer> get QRCodeDetector_Close => _library._QRCodeDetector_ClosePtr; ffi.Pointer> get Rng_Close => _library._Rng_ClosePtr; ffi.Pointer> get SIFT_Close => _library._SIFT_ClosePtr; - ffi.Pointer< - ffi.NativeFunction< - ffi.Pointer Function(SIFTPtr, CvCallback_0)>> - get SIFT_Close_Async => _library._SIFT_Close_AsyncPtr; ffi.Pointer> get SimpleBlobDetector_Close => _library._SimpleBlobDetector_ClosePtr; get Stitcher_Close => _library._Stitcher_ClosePtr; diff --git a/lib/src/video/video_async.dart b/lib/src/video/video_async.dart new file mode 100644 index 00000000..ecda36ad --- /dev/null +++ b/lib/src/video/video_async.dart @@ -0,0 +1,378 @@ +library cv; + +import 'dart:ffi' as ffi; + +import 'package:ffi/ffi.dart'; + +import '../constants.g.dart'; +import '../core/base.dart'; +import '../core/mat.dart'; +import '../core/mat_type.dart'; +import '../core/point.dart'; +import '../core/rect.dart'; +import '../core/size.dart'; +import '../core/termcriteria.dart'; +import '../core/vec.dart'; +import '../opencv.g.dart' as cvg; +import 'video.dart'; + +extension BackgroundSubtractorMOG2Async on BackgroundSubtractorMOG2 { + static Future emptyAsync() async => cvRunAsync( + CFFI.BackgroundSubtractorMOG2_Create_Async, + (c, p) => c.complete(BackgroundSubtractorMOG2(p.cast())), + ); + + static Future createAsync({ + int history = 500, + double varThreshold = 16, + bool detectShadows = true, + }) async => + cvRunAsync( + (callback) => CFFI.BackgroundSubtractorMOG2_CreateWithParams_Async( + history, + varThreshold, + detectShadows, + callback, + ), + (c, p) => c.complete(BackgroundSubtractorMOG2(p.cast())), + ); + + Future applyAsync(Mat src) async => cvRunAsync( + (callback) => CFFI.BackgroundSubtractorMOG2_Apply_Async(ref, src.ref, callback), + matCompleter, + ); +} + +extension BackgroundSubtractorKNNAsync on BackgroundSubtractorKNN { + static Future emptyAsync() async => cvRunAsync( + CFFI.BackgroundSubtractorMOG2_Create_Async, + (c, p) => c.complete(BackgroundSubtractorKNN(p.cast())), + ); + + static Future createAsync({ + int history = 500, + double varThreshold = 16, + bool detectShadows = true, + }) async => + cvRunAsync( + (callback) => CFFI.BackgroundSubtractorKNN_CreateWithParams_Async( + history, + varThreshold, + detectShadows, + callback, + ), + (c, p) => c.complete(BackgroundSubtractorKNN(p.cast())), + ); + + Future applyAsync(Mat src) async => cvRunAsync( + (callback) => CFFI.BackgroundSubtractorKNN_Apply_Async(ref, src.ref, callback), + matCompleter, + ); +} + +/// NewBackgroundSubtractorMOG2 returns a new BackgroundSubtractor algorithm +/// of type MOG2. MOG2 is a Gaussian Mixture-based Background/Foreground +/// Segmentation Algorithm. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/de/de1/group__video__motion.html#ga2beb2dee7a073809ccec60f145b6b29c +/// https://docs.opencv.org/master/d7/d7b/classcv_1_1BackgroundSubtractorMOG2.html +Future createBackgroundSubtractorMOG2Async({ + int history = 500, + double varThreshold = 16, + bool detectShadows = true, +}) async => + cvRunAsync( + (callback) => CFFI.BackgroundSubtractorMOG2_CreateWithParams_Async( + history, + varThreshold, + detectShadows, + callback, + ), + (c, p) => c.complete(BackgroundSubtractorMOG2(p.cast())), + ); + +/// 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 +Future calcOpticalFlowFarnebackAsync( + InputArray prev, + InputArray next, + InputOutputArray flow, + double pyrScale, + int levels, + int winsize, + int iterations, + int polyN, + double polySigma, + int flags, +) async => + cvRunAsync0( + (callback) => CFFI.CalcOpticalFlowFarneback_Async( + prev.ref, + next.ref, + flow.ref, + pyrScale, + levels, + winsize, + iterations, + polyN, + polySigma, + flags, + callback, + ), + (c) => c.complete(flow), + ); + +/// 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 +Future<(VecPoint2f nextPts, VecUChar status, VecFloat 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.ref, + winSize.cvd.ref, + maxLevel, + criteria.cvd.ref, + flags, + minEigThreshold, + callback, + ), + (completer, p, p1) => completer.complete( + ( + nextPts, + VecUChar.fromPointer(p.cast()), + VecFloat.fromPointer(p1.cast()), + ), + ), + ); + +/// FindTransformECC finds the geometric transform (warp) between two images in terms of the ECC criterion. +/// +/// For futther details, please see: +/// https://docs.opencv.org/4.x/dc/d6b/group__video__track.html#ga1aa357007eaec11e9ed03500ecbcbe47 +Future<(double ret, Mat warpMatrix)> findTransformECCAsync( + InputArray templateImage, + InputArray inputImage, + InputOutputArray warpMatrix, + int motionType, + (int, int, double) criteria, + InputArray inputMask, + int gaussFiltSize, +) async => + cvRunAsync( + (callback) => CFFI.FindTransformECC_Async( + templateImage.ref, + inputImage.ref, + warpMatrix.ref, + motionType, + criteria.cvd.ref, + inputMask.ref, + gaussFiltSize, + callback, + ), (completer, p) { + final rval = p.cast().value; + calloc.free(p); + completer.complete((rval, warpMatrix)); + }); + +/// Tracker is the base interface for object tracking. +/// +/// see: https://docs.opencv.org/master/d0/d0a/classcv_1_1Tracker.html +extension TrackerMILAsync on TrackerMIL { + static Future createAsync() async => cvRunAsync( + CFFI.TrackerMIL_Create_Async, + (completer, p) => completer.complete(TrackerMIL(p.cast())), + ); + + Future initAsync(InputArray image, Rect boundingBox) async { + assert(boundingBox.x >= 0, "boundingBox.x must be >= 0"); + assert(boundingBox.y >= 0, "boundingBox.y must be >= 0"); + assert( + boundingBox.right <= image.cols, + "boundingBox.right=${boundingBox.right} must be <= image.cols=${image.cols}", + ); + assert( + boundingBox.bottom <= image.rows, + "boundingBox.bottom=${boundingBox.bottom} must be <= image.rows=${image.rows}", + ); + + cvRun(() => CFFI.TrackerMIL_Init(ref, image.ref, boundingBox.ref)); + } + + /// Update the tracker, find the new most likely bounding box for the target. + /// https://docs.opencv.org/4.x/d0/d0a/classcv_1_1Tracker.html#a92d2012f576e6c06eb2e257d110a6529 + Future<(bool, Rect)> updateAsync(Mat img) async => cvRunAsync2( + (callback) => CFFI.TrackerMIL_Update_Async(ref, img.ref, callback), + (completer, p, p1) { + final rval = p.cast().value; + calloc.free(p); + completer.complete((rval, Rect.fromPointer(p1.cast()))); + }, + ); +} + +/// KalmanFilter implements a standard Kalman filter http://en.wikipedia.org/wiki/Kalman_filter. +/// However, you can modify transitionMatrix, controlMatrix, and measurementMatrix +/// to get an extended Kalman filter functionality. +/// +/// For further details, please see: +/// https://docs.opencv.org/4.6.0/dd/d6a/classcv_1_1KalmanFilter.html +extension KalmanFilterAsync on KalmanFilter { + static Future createAsync( + int dynamParams, + int measureParams, { + int controlParams = 0, + int type = MatType.CV_32F, + }) async => + cvRunAsync( + (callback) => CFFI.KalmanFilter_New_Async(dynamParams, measureParams, controlParams, type, callback), + (completer, p) => completer.complete(KalmanFilter(p.cast())), + ); + + Future correctAsync(Mat measurement) async => + cvRunAsync((callback) => CFFI.KalmanFilter_Correct_Async(ref, measurement.ref, callback), matCompleter); + + Future predictAsync({Mat? control}) async => cvRunAsync( + (callback) => control == null + ? CFFI.KalmanFilter_Predict_Async(ref, callback) + : CFFI.KalmanFilter_PredictWithParams_Async(ref, control.ref, callback), + matCompleter, + ); + + Future initAsync( + int dynamParams, + int measureParams, { + int controlParams = 0, + int type = MatType.CV_32F, + }) async => + cvRunAsync0( + (callback) => CFFI.KalmanFilter_InitWithParams_Async( + ref, + dynamParams, + measureParams, + controlParams, + type, + callback, + ), + (c) => c.complete(), + ); + + // corrected state (x(k)): x(k)=x'(k)+K(k)*(z(k)-H*x'(k)) + Future getStatePost() async => + cvRunAsync((callback) => CFFI.KalmanFilter_GetStatePost_Async(ref, callback), matCompleter); + + Future setStatePost(Mat m) async => cvRunAsync0( + (callback) => CFFI.KalmanFilter_SetStatePost_Async(ref, m.ref, callback), + (c) => c.complete(), + ); + + Future getStatePre() async => + cvRunAsync((callback) => CFFI.KalmanFilter_GetStatePre_Async(ref, callback), matCompleter); + + Future setStatePre(Mat m) async => cvRunAsync0( + (callback) => CFFI.KalmanFilter_SetStatePre_Async(ref, m.ref, callback), + (c) => c.complete(), + ); + + Future getTransitionMatrix() async => + cvRunAsync((callback) => CFFI.KalmanFilter_GetTransitionMatrix_Async(ref, callback), matCompleter); + + Future setTransitionMatrix(Mat m) async => cvRunAsync0( + (callback) => CFFI.KalmanFilter_SetTransitionMatrix_Async(ref, m.ref, callback), + (c) => c.complete(), + ); + + Future getTemp1() async => + cvRunAsync((callback) => CFFI.KalmanFilter_GetTemp1_Async(ref, callback), matCompleter); + + Future getTemp2() async => + cvRunAsync((callback) => CFFI.KalmanFilter_GetTemp2_Async(ref, callback), matCompleter); + + Future getTemp3() async => + cvRunAsync((callback) => CFFI.KalmanFilter_GetTemp3_Async(ref, callback), matCompleter); + + Future getTemp4() async => + cvRunAsync((callback) => CFFI.KalmanFilter_GetTemp4_Async(ref, callback), matCompleter); + + Future getTemp5() async => + cvRunAsync((callback) => CFFI.KalmanFilter_GetTemp5_Async(ref, callback), matCompleter); + + Future getProcessNoiseCov() async => + cvRunAsync((callback) => CFFI.KalmanFilter_GetProcessNoiseCov_Async(ref, callback), matCompleter); + + Future setProcessNoiseCov(Mat m) async => cvRunAsync0( + (callback) => CFFI.KalmanFilter_SetProcessNoiseCov_Async(ref, m.ref, callback), + (c) => c.complete(), + ); + + Future getMeasurementNoiseCov() async => + cvRunAsync((callback) => CFFI.KalmanFilter_GetMeasurementNoiseCov_Async(ref, callback), matCompleter); + + Future setMeasurementNoiseCov(Mat m) async => cvRunAsync0( + (callback) => CFFI.KalmanFilter_SetMeasurementNoiseCov_Async(ref, m.ref, callback), + (c) => c.complete(), + ); + + Future getMeasurementMatrix() async => + cvRunAsync((callback) => CFFI.KalmanFilter_GetMeasurementMatrix_Async(ref, callback), matCompleter); + + Future setMeasurementMatrix(Mat m) async => cvRunAsync0( + (callback) => CFFI.KalmanFilter_SetMeasurementMatrix_Async(ref, m.ref, callback), + (c) => c.complete(), + ); + + Future getGain() async => + cvRunAsync((callback) => CFFI.KalmanFilter_GetGain_Async(ref, callback), matCompleter); + + Future setGain(Mat m) async => cvRunAsync0( + (callback) => CFFI.KalmanFilter_SetGain_Async(ref, m.ref, callback), + (c) => c.complete(), + ); + + Future getErrorCovPre() async => + cvRunAsync((callback) => CFFI.KalmanFilter_GetErrorCovPre_Async(ref, callback), matCompleter); + + Future setErrorCovPre(Mat m) async => cvRunAsync0( + (callback) => CFFI.KalmanFilter_SetErrorCovPre_Async(ref, m.ref, callback), + (c) => c.complete(), + ); + + Future getErrorCovPost() async => + cvRunAsync((callback) => CFFI.KalmanFilter_GetErrorCovPost_Async(ref, callback), matCompleter); + + Future setErrorCovPost(Mat m) async => cvRunAsync0( + (callback) => CFFI.KalmanFilter_SetErrorCovPost_Async(ref, m.ref, callback), + (c) => c.complete(), + ); + + Future getControlMatrix() async => + cvRunAsync((callback) => CFFI.KalmanFilter_GetControlMatrix_Async(ref, callback), matCompleter); + + Future setControlMatrix(Mat m) async => cvRunAsync0( + (callback) => CFFI.KalmanFilter_SetControlMatrix_Async(ref, m.ref, callback), + (c) => c.complete(), + ); +} diff --git a/lib/src/video/videoio.dart b/lib/src/video/videoio.dart index 77056afe..e54b8b37 100644 --- a/lib/src/video/videoio.dart +++ b/lib/src/video/videoio.dart @@ -17,6 +17,8 @@ class VideoCapture extends CvStruct { } } + factory VideoCapture.fromPointer(cvg.VideoCapturePtr ptr) => VideoCapture._(ptr, false); + factory VideoCapture.empty() { final p = calloc(); cvRun(() => CFFI.VideoCapture_New(p)); @@ -155,6 +157,8 @@ class VideoWriter extends CvStruct { } } + factory VideoWriter.fromPointer(cvg.VideoWriterPtr ptr) => VideoWriter._(ptr, false); + factory VideoWriter.empty() { final p = calloc(); cvRun(() => CFFI.VideoWriter_New(p)); diff --git a/lib/src/video/videoio_async.dart b/lib/src/video/videoio_async.dart new file mode 100644 index 00000000..611a1dd0 --- /dev/null +++ b/lib/src/video/videoio_async.dart @@ -0,0 +1,149 @@ +library cv; + +import 'dart:convert'; +import 'dart:ffi' as ffi; + +import 'package:ffi/ffi.dart'; + +import '../constants.g.dart'; +import '../core/base.dart'; +import '../core/mat.dart'; +import '../opencv.g.dart' as cvg; +import 'videoio.dart'; + +extension VideoCaptureAsync on VideoCapture { + static Future emptyAsync() async => cvRunAsync( + CFFI.VideoCapture_New_Async, + (completer, p) => completer.complete(VideoCapture.fromPointer(p.cast())), + ); + + /// Opens a video file or a capturing device or an IP video stream for video capturing with API Preference. + /// + /// https://docs.opencv.org/4.x/d8/dfe/classcv_1_1VideoCapture.html#a57c0e81e83e60f36c83027dc2a188e80 + static Future fromFileAsync(String filename, {int apiPreference = CAP_ANY}) async { + final cname = filename.toNativeUtf8().cast(); + final rval = cvRunAsync( + (callback) => CFFI.VideoCapture_NewFromFile_Async(cname, apiPreference, callback), + (completer, p) => completer.complete(VideoCapture.fromPointer(p.cast())), + ); + calloc.free(cname); + return rval; + } + + static Future fromDeviceAsync(int device, {int apiPreference = CAP_ANY}) async => cvRunAsync( + (callback) => CFFI.VideoCapture_NewFromIndex_Async(device, apiPreference, callback), + (completer, p) => completer.complete(VideoCapture.fromPointer(p.cast())), + ); + + /// Returns the specified [VideoCapture] property. + /// + /// https://docs.opencv.org/4.x/d8/dfe/classcv_1_1VideoCapture.html#aa6480e6972ef4c00d74814ec841a2939 + Future getAsync(int propId) async => + cvRunAsync((callback) => CFFI.VideoCapture_Get_Async(ref, propId, callback), doubleCompleter); + + Future setAsync(int prop, double value) async => cvRunAsync( + (callback) => CFFI.VideoCapture_Set_Async(ref, prop, value, callback), + boolCompleter, + ); + + // String getBackendName()=>CFFI.videocapture + + /// Grabs the next frame from video file or capturing device. + /// + /// https://docs.opencv.org/4.x/d8/dfe/classcv_1_1VideoCapture.html#aa6480e6972ef4c00d74814ec841a2939 + Future grabAsync() async => + cvRunAsync((callback) => CFFI.VideoCapture_Grab_Async(ref, callback), boolCompleter); + + Future<(bool, Mat)> readAsync() async => + cvRunAsync2((callback) => CFFI.VideoCapture_Read_Async(ref, callback), (completer, p, p1) { + final rval = p.cast().value; + calloc.free(p); + completer.complete((rval, Mat.fromPointer(p1.cast()))); + }); + + /// Opens a video file or a capturing device or an IP video stream for video capturing with API Preference and parameters. + /// + /// This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. + /// + /// https://docs.opencv.org/4.x/d8/dfe/classcv_1_1VideoCapture.html#aa6480e6972ef4c00d74814ec841a2939 + Future openAsync(String uri, {int apiPreference = CAP_ANY}) { + final cname = uri.toNativeUtf8().cast(); + final rval = cvRunAsync( + (callback) => CFFI.VideoCapture_OpenWithAPI_Async(ref, cname, apiPreference, callback), + boolCompleter, + ); + calloc.free(cname); + return rval; + } + + /// Opens a camera for video capturing with API Preference and parameters. + /// + /// https://docs.opencv.org/4.x/d8/dfe/classcv_1_1VideoCapture.html#a10867868137c2d142aac30a0648d00fe + Future openIndexAsync(int index, {int apiPreference = CAP_ANY}) async => cvRunAsync( + (callback) => CFFI.VideoCapture_OpenDeviceWithAPI_Async(ref, index, apiPreference, callback), + boolCompleter, + ); + + Future releaseAsync() async => cvRunAsync0( + (callback) => CFFI.VideoCapture_Release_Async(ref, callback), + (completer) => completer.complete(), + ); +} + +extension VideoWriterAsync on VideoWriter { + static Future emptyAsync() async => cvRunAsync( + CFFI.VideoWriter_New_Async, + (c, p) => c.complete(VideoWriter.fromPointer(p.cast())), + ); + + static Future fromFileAsync( + String filename, + String codec, + double fps, + (int, int) frameSize, { + bool isColor = true, + }) async { + final vw = await cvRunAsync( + CFFI.VideoWriter_New_Async, + (c, p) => c.complete(VideoWriter.fromPointer(p.cast())), + ); + await vw.openAsync(filename, codec, fps, frameSize, isColor: isColor); + return vw; + } + + Future openAsync( + String filename, + String codec, + double fps, + (int, int) frameSize, { + bool isColor = true, + }) async { + final name = filename.toNativeUtf8().cast(); + final codec_ = codec.toNativeUtf8().cast(); + final rval = cvRunAsync( + (callback) => + CFFI.VideoWriter_Open_Async(ref, name, codec_, fps, frameSize.$1, frameSize.$2, isColor, callback), + boolCompleter, + ); + calloc.free(name); + calloc.free(codec_); + return rval; + } + + Future writeAsync(InputArray image) async => + cvRunAsync0((callback) => CFFI.VideoWriter_Write_Async(ref, image.ref, callback), voidCompleter); + + static Future fourccAsync(String cc) async { + final cc_ = ascii.encode(cc); + if (cc_.length != 4) return -1; + return cvRunAsync( + (callback) => CFFI.VideoWriter_Fourcc_Async(cc_[0], cc_[1], cc_[2], cc_[3], callback), + intCompleter, + ); + } + + Future releaseAsync() async => cvRunAsync0( + (callback) => CFFI.VideoWriter_Release_Async(ref, callback), + voidCompleter, + ); +} diff --git a/src/video/video_async.cpp b/src/video/video_async.cpp new file mode 100644 index 00000000..f6669550 --- /dev/null +++ b/src/video/video_async.cpp @@ -0,0 +1,376 @@ +/* + Created by Rainyl. + Licensed: Apache 2.0 license. Copyright (c) 2024 Rainyl. +*/ + +#include "video_async.h" +#include + +CvStatus *BackgroundSubtractorMOG2_Create_Async(CvCallback_1 callback) { + BEGIN_WRAP + callback(new BackgroundSubtractorMOG2{ + new cv::Ptr(cv::createBackgroundSubtractorMOG2()) + }); + END_WRAP +} +CvStatus *BackgroundSubtractorMOG2_CreateWithParams_Async( + int history, double varThreshold, bool detectShadows, CvCallback_1 callback +) { + BEGIN_WRAP + callback(new BackgroundSubtractorMOG2{new cv::Ptr( + cv::createBackgroundSubtractorMOG2(history, varThreshold, detectShadows) + )}); + END_WRAP +} +// void BackgroundSubtractorMOG2_Close(BackgroundSubtractorMOG2Ptr self) +// { +// self->ptr->reset(); +// CVD_FREE(self); +// } + +CvStatus *BackgroundSubtractorMOG2_Apply_Async( + BackgroundSubtractorMOG2 self, Mat src, CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat dst; + (*self.ptr)->apply(*src.ptr, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *BackgroundSubtractorKNN_Create_Async(CvCallback_1 callback) { + BEGIN_WRAP + callback(new BackgroundSubtractorKNN{ + new cv::Ptr(cv::createBackgroundSubtractorKNN()) + }); + END_WRAP +} +CvStatus *BackgroundSubtractorKNN_CreateWithParams_Async( + int history, double dist2Threshold, bool detectShadows, CvCallback_1 callback +) { + BEGIN_WRAP + callback(new BackgroundSubtractorKNN{new cv::Ptr( + cv::createBackgroundSubtractorKNN(history, dist2Threshold, detectShadows) + )}); + END_WRAP +} +// void BackgroundSubtractorKNN_Close(BackgroundSubtractorKNNPtr self) +// { +// self->ptr->reset(); +// CVD_FREE(self); +// } + +CvStatus * +BackgroundSubtractorKNN_Apply_Async(BackgroundSubtractorKNN self, Mat src, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + (*self.ptr)->apply(*src.ptr, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *CalcOpticalFlowPyrLK_Async( + Mat prevImg, + Mat nextImg, + VecPoint2f prevPts, + VecPoint2f nextPts, + Size winSize, + int maxLevel, + TermCriteria criteria, + int flags, + double minEigThreshold, + CvCallback_2 callback +) { + BEGIN_WRAP + std::vector _status; + std::vector _err; + auto tc = cv::TermCriteria(criteria.type, criteria.maxCount, criteria.epsilon); + cv::calcOpticalFlowPyrLK( + *prevImg.ptr, + *nextImg.ptr, + *prevPts.ptr, + *nextPts.ptr, + _status, + _err, + cv::Size(winSize.width, winSize.height), + maxLevel, + tc, + flags, + minEigThreshold + ); + callback( + new VecUChar{new std::vector(_status)}, new VecFloat{new std::vector(_err)} + ); + END_WRAP +} +CvStatus *CalcOpticalFlowFarneback_Async( + Mat prevImg, + Mat nextImg, + Mat flow, + double pyrScale, + int levels, + int winsize, + int iterations, + int polyN, + double polySigma, + int flags, + CvCallback_0 callback +) { + BEGIN_WRAP + cv::calcOpticalFlowFarneback( + *prevImg.ptr, + *nextImg.ptr, + *flow.ptr, + pyrScale, + levels, + winsize, + iterations, + polyN, + polySigma, + flags + ); + callback(); + END_WRAP +} + +CvStatus *FindTransformECC_Async( + Mat templateImage, + Mat inputImage, + Mat warpMatrix, + int motionType, + TermCriteria criteria, + Mat inputMask, + int gaussFiltSize, + CvCallback_1 callback +) { + BEGIN_WRAP + auto tc = cv::TermCriteria(criteria.type, criteria.maxCount, criteria.epsilon); + double rval = cv::findTransformECC( + *templateImage.ptr, + *inputImage.ptr, + *warpMatrix.ptr, + motionType, + tc, + *inputMask.ptr, + gaussFiltSize + ); + callback(new double(rval)); + END_WRAP +} + +CvStatus *TrackerMIL_Init_Async(TrackerMIL self, Mat image, Rect bbox, CvCallback_0 callback) { + BEGIN_WRAP + auto rect = cv::Rect(bbox.x, bbox.y, bbox.width, bbox.height); + (*self.ptr)->init(*image.ptr, rect); + callback(); + END_WRAP +} +CvStatus *TrackerMIL_Update_Async(TrackerMIL self, Mat image, CvCallback_2 callback) { + BEGIN_WRAP + cv::Rect bb; + bool rval = (*self.ptr)->update(*image.ptr, bb); + callback(new bool(rval), new Rect{bb.x, bb.y, bb.width, bb.height}); + END_WRAP +} + +CvStatus *TrackerMIL_Create_Async(CvCallback_1 callback) { + BEGIN_WRAP + callback(new TrackerMIL{new cv::Ptr(cv::TrackerMIL::create())}); + END_WRAP +} +// void TrackerMIL_Close(TrackerMILPtr self) +// { +// self->ptr->reset(); +// CVD_FREE(self); +// } + +CvStatus *KalmanFilter_New_Async( + int dynamParams, int measureParams, int controlParams, int type, CvCallback_1 callback +) { + BEGIN_WRAP + callback(new KalmanFilter{new cv::KalmanFilter(dynamParams, measureParams, controlParams, type)}); + END_WRAP +} +// void KalmanFilter_Close(KalmanFilterPtr self) { CVD_FREE(self); } + +CvStatus *KalmanFilter_Init_Async( + KalmanFilter self, int dynamParams, int measureParams, CvCallback_0 callback +) { + BEGIN_WRAP + self.ptr->init(dynamParams, measureParams); + callback(); + END_WRAP +} +CvStatus *KalmanFilter_InitWithParams_Async( + KalmanFilter self, + int dynamParams, + int measureParams, + int controlParams, + int type, + CvCallback_0 callback +) { + BEGIN_WRAP + self.ptr->init(dynamParams, measureParams, controlParams, type); + callback(); + END_WRAP +} +CvStatus *KalmanFilter_Predict_Async(KalmanFilter self, CvCallback_1 callback) { + BEGIN_WRAP + auto result = self.ptr->predict(); + callback(new Mat{new cv::Mat(result)}); + END_WRAP +} +CvStatus * +KalmanFilter_PredictWithParams_Async(KalmanFilter self, Mat control, CvCallback_1 callback) { + BEGIN_WRAP + auto result = self.ptr->predict(*control.ptr); + callback(new Mat{new cv::Mat(result)}); + END_WRAP +} +CvStatus *KalmanFilter_Correct_Async(KalmanFilter self, Mat measurement, CvCallback_1 callback) { + BEGIN_WRAP + auto result = self.ptr->correct(*measurement.ptr); + callback(new Mat{new cv::Mat(result)}); + END_WRAP +} + +CvStatus *KalmanFilter_GetStatePre_Async(KalmanFilter self, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(self.ptr->statePre)}); + END_WRAP +} +CvStatus *KalmanFilter_GetStatePost_Async(KalmanFilter self, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(self.ptr->statePost)}); + END_WRAP +} +CvStatus *KalmanFilter_GetTransitionMatrix_Async(KalmanFilter self, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(self.ptr->transitionMatrix)}); + END_WRAP +} +CvStatus *KalmanFilter_GetControlMatrix_Async(KalmanFilter self, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(self.ptr->controlMatrix)}); + END_WRAP +} +CvStatus *KalmanFilter_GetMeasurementMatrix_Async(KalmanFilter self, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(self.ptr->measurementMatrix)}); + END_WRAP +} +CvStatus *KalmanFilter_GetProcessNoiseCov_Async(KalmanFilter self, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(self.ptr->processNoiseCov)}); + END_WRAP +} +CvStatus *KalmanFilter_GetMeasurementNoiseCov_Async(KalmanFilter self, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(self.ptr->measurementNoiseCov)}); + END_WRAP +} +CvStatus *KalmanFilter_GetErrorCovPre_Async(KalmanFilter self, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(self.ptr->errorCovPre)}); + END_WRAP +} +CvStatus *KalmanFilter_GetGain_Async(KalmanFilter self, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(self.ptr->gain)}); + END_WRAP +} +CvStatus *KalmanFilter_GetErrorCovPost_Async(KalmanFilter self, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(self.ptr->errorCovPost)}); + END_WRAP +} +CvStatus *KalmanFilter_GetTemp1_Async(KalmanFilter self, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(self.ptr->temp1)}); + END_WRAP +} +CvStatus *KalmanFilter_GetTemp2_Async(KalmanFilter self, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(self.ptr->temp2)}); + END_WRAP +} +CvStatus *KalmanFilter_GetTemp3_Async(KalmanFilter self, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(self.ptr->temp3)}); + END_WRAP +} +CvStatus *KalmanFilter_GetTemp4_Async(KalmanFilter self, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(self.ptr->temp4)}); + END_WRAP +} +CvStatus *KalmanFilter_GetTemp5_Async(KalmanFilter self, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(self.ptr->temp5)}); + END_WRAP +} + +CvStatus *KalmanFilter_SetStatePre_Async(KalmanFilter self, Mat value, CvCallback_0 callback) { + BEGIN_WRAP + self.ptr->statePre = *value.ptr; + callback(); + END_WRAP +} +CvStatus *KalmanFilter_SetStatePost_Async(KalmanFilter self, Mat value, CvCallback_0 callback) { + BEGIN_WRAP + self.ptr->statePost = *value.ptr; + callback(); + END_WRAP +} +CvStatus * +KalmanFilter_SetTransitionMatrix_Async(KalmanFilter self, Mat value, CvCallback_0 callback) { + BEGIN_WRAP + self.ptr->transitionMatrix = *value.ptr; + callback(); + END_WRAP +} +CvStatus *KalmanFilter_SetControlMatrix_Async(KalmanFilter self, Mat value, CvCallback_0 callback) { + BEGIN_WRAP + self.ptr->controlMatrix = *value.ptr; + callback(); + END_WRAP +} +CvStatus * +KalmanFilter_SetMeasurementMatrix_Async(KalmanFilter self, Mat value, CvCallback_0 callback) { + BEGIN_WRAP + self.ptr->measurementMatrix = *value.ptr; + callback(); + END_WRAP +} +CvStatus * +KalmanFilter_SetProcessNoiseCov_Async(KalmanFilter self, Mat value, CvCallback_0 callback) { + BEGIN_WRAP + self.ptr->processNoiseCov = *value.ptr; + callback(); + END_WRAP +} +CvStatus * +KalmanFilter_SetMeasurementNoiseCov_Async(KalmanFilter self, Mat value, CvCallback_0 callback) { + BEGIN_WRAP + self.ptr->measurementNoiseCov = *value.ptr; + callback(); + END_WRAP +} +CvStatus *KalmanFilter_SetErrorCovPre_Async(KalmanFilter self, Mat value, CvCallback_0 callback) { + BEGIN_WRAP + self.ptr->errorCovPre = *value.ptr; + callback(); + END_WRAP +} +CvStatus *KalmanFilter_SetGain_Async(KalmanFilter self, Mat value, CvCallback_0 callback) { + BEGIN_WRAP + self.ptr->gain = *value.ptr; + callback(); + END_WRAP +} +CvStatus *KalmanFilter_SetErrorCovPost_Async(KalmanFilter self, Mat value, CvCallback_0 callback) { + BEGIN_WRAP + self.ptr->errorCovPost = *value.ptr; + callback(); + END_WRAP +} diff --git a/src/video/video_async.h b/src/video/video_async.h new file mode 100644 index 00000000..402f06de --- /dev/null +++ b/src/video/video_async.h @@ -0,0 +1,137 @@ +/* + Created by Rainyl. + Licensed: Apache 2.0 license. Copyright _Async(c) 2024 Rainyl. +*/ + +#ifndef CVD_VIDEO_ASYNC_H_ +#define CVD_VIDEO_ASYNC_H_ + +#include "core/types.h" +#include "video.h" + +#ifdef __cplusplus +extern "C" { +#endif + +CvStatus *BackgroundSubtractorMOG2_Create_Async(CvCallback_1 callback); +CvStatus *BackgroundSubtractorMOG2_CreateWithParams_Async( + int history, double varThreshold, bool detectShadows, CvCallback_1 callback +); +// void BackgroundSubtractorMOG2_Close_Async(BackgroundSubtractorMOG2Ptr self); +CvStatus * +BackgroundSubtractorMOG2_Apply_Async(BackgroundSubtractorMOG2 self, Mat src, CvCallback_1 callback); + +CvStatus *BackgroundSubtractorKNN_Create_Async(CvCallback_1 callback); +CvStatus *BackgroundSubtractorKNN_CreateWithParams_Async( + int history, double dist2Threshold, bool detectShadows, CvCallback_1 callback +); +// void BackgroundSubtractorKNN_Close_Async(BackgroundSubtractorKNNPtr self); +CvStatus * +BackgroundSubtractorKNN_Apply_Async(BackgroundSubtractorKNN self, Mat src, CvCallback_1 callback); + +CvStatus *CalcOpticalFlowPyrLK_Async( + Mat prevImg, + Mat nextImg, + VecPoint2f prevPts, + VecPoint2f nextPts, + Size winSize, + int maxLevel, + TermCriteria criteria, + int flags, + double minEigThreshold, + CvCallback_2 callback +); +CvStatus *CalcOpticalFlowFarneback_Async( + Mat prevImg, + Mat nextImg, + Mat flow, + double pyrScale, + int levels, + int winsize, + int iterations, + int polyN, + double polySigma, + int flags, + CvCallback_0 callback +); + +CvStatus *FindTransformECC_Async( + Mat templateImage, + Mat inputImage, + Mat warpMatrix, + int motionType, + TermCriteria criteria, + Mat inputMask, + int gaussFiltSize, + CvCallback_1 callback +); + +CvStatus *TrackerMIL_Init_Async(TrackerMIL self, Mat image, Rect bbox, CvCallback_0 callback); +CvStatus *TrackerMIL_Update_Async(TrackerMIL self, Mat image, CvCallback_2 callback); +CvStatus *TrackerMIL_Create_Async(CvCallback_1 callback); +// void TrackerMIL_Close_Async(TrackerMILPtr self); + +CvStatus *KalmanFilter_New_Async( + int dynamParams, int measureParams, int controlParams, int type, CvCallback_1 callback +); +// void KalmanFilter_Close_Async(KalmanFilterPtr self); + +CvStatus *KalmanFilter_Init_Async( + KalmanFilter self, int dynamParams, int measureParams, CvCallback_0 callback +); +CvStatus *KalmanFilter_InitWithParams_Async( + KalmanFilter self, + int dynamParams, + int measureParams, + int controlParams, + int type, + CvCallback_0 callback +); +CvStatus *KalmanFilter_Predict_Async(KalmanFilter self, CvCallback_1 callback); +CvStatus * +KalmanFilter_PredictWithParams_Async(KalmanFilter self, Mat control, CvCallback_1 callback); +CvStatus *KalmanFilter_Correct_Async(KalmanFilter self, Mat measurement, CvCallback_1 callback); + +CvStatus *KalmanFilter_GetStatePre_Async(KalmanFilter self, CvCallback_1 callback); +CvStatus *KalmanFilter_GetStatePost_Async(KalmanFilter self, CvCallback_1 callback); +CvStatus *KalmanFilter_GetTransitionMatrix_Async(KalmanFilter self, CvCallback_1 callback); +CvStatus *KalmanFilter_GetControlMatrix_Async(KalmanFilter self, CvCallback_1 callback); +CvStatus *KalmanFilter_GetMeasurementMatrix_Async(KalmanFilter self, CvCallback_1 callback); +CvStatus *KalmanFilter_GetProcessNoiseCov_Async(KalmanFilter self, CvCallback_1 callback); +CvStatus *KalmanFilter_GetMeasurementNoiseCov_Async(KalmanFilter self, CvCallback_1 callback); +CvStatus *KalmanFilter_GetErrorCovPre_Async(KalmanFilter self, CvCallback_1 callback); +CvStatus *KalmanFilter_GetGain_Async(KalmanFilter self, CvCallback_1 callback); +CvStatus *KalmanFilter_GetErrorCovPost_Async(KalmanFilter self, CvCallback_1 callback); +CvStatus *KalmanFilter_GetTemp1_Async(KalmanFilter self, CvCallback_1 callback); +CvStatus *KalmanFilter_GetTemp2_Async(KalmanFilter self, CvCallback_1 callback); +CvStatus *KalmanFilter_GetTemp3_Async(KalmanFilter self, CvCallback_1 callback); +CvStatus *KalmanFilter_GetTemp4_Async(KalmanFilter self, CvCallback_1 callback); +CvStatus *KalmanFilter_GetTemp5_Async(KalmanFilter self, CvCallback_1 callback); + +CvStatus *KalmanFilter_SetStatePre_Async(KalmanFilter self, Mat value, CvCallback_0 callback); +CvStatus *KalmanFilter_SetStatePost_Async(KalmanFilter self, Mat value, CvCallback_0 callback); +CvStatus *KalmanFilter_SetTransitionMatrix_Async( + KalmanFilter self, Mat value, CvCallback_0 callback +); +CvStatus * +KalmanFilter_SetControlMatrix_Async(KalmanFilter self, Mat value, CvCallback_0 callback); +CvStatus *KalmanFilter_SetMeasurementMatrix_Async( + KalmanFilter self, Mat value, CvCallback_0 callback +); +CvStatus *KalmanFilter_SetProcessNoiseCov_Async( + KalmanFilter self, Mat value, CvCallback_0 callback +); +CvStatus *KalmanFilter_SetMeasurementNoiseCov_Async( + KalmanFilter self, Mat value, CvCallback_0 callback +); +CvStatus * +KalmanFilter_SetErrorCovPre_Async(KalmanFilter self, Mat value, CvCallback_0 callback); +CvStatus *KalmanFilter_SetGain_Async(KalmanFilter self, Mat value, CvCallback_0 callback); +CvStatus * +KalmanFilter_SetErrorCovPost_Async(KalmanFilter self, Mat value, CvCallback_0 callback); + +#ifdef __cplusplus +} +#endif + +#endif // CVD_VIDEO_ASYNC_H_ diff --git a/src/video/videoio_async.cpp b/src/video/videoio_async.cpp new file mode 100644 index 00000000..79dafd16 --- /dev/null +++ b/src/video/videoio_async.cpp @@ -0,0 +1,131 @@ +/* + Modified by Rainyl. + Licensed: Apache 2.0 license. Copyright (c) 2024 Rainyl. +*/ + +#include "videoio_async.h" + +// VideoCapture +CvStatus *VideoCapture_New_Async(CvCallback_1 callback) { + BEGIN_WRAP + callback(new VideoCapture{new cv::VideoCapture()}); + END_WRAP +} +CvStatus * +VideoCapture_NewFromFile_Async(const char *filename, int apiPreference, CvCallback_1 callback) { + BEGIN_WRAP + callback(new VideoCapture{new cv::VideoCapture(filename, apiPreference)}); + END_WRAP +} +CvStatus *VideoCapture_NewFromIndex_Async(int index, int apiPreference, CvCallback_1 callback) { + BEGIN_WRAP + callback(new VideoCapture{new cv::VideoCapture(index, apiPreference)}); + END_WRAP +} +// void VideoCapture_Close(VideoCapturePtr self) { CVD_FREE(self); } + +CvStatus *VideoCapture_Open_Async(VideoCapture self, const char *uri, CvCallback_1 callback) { + BEGIN_WRAP + callback(new bool(self.ptr->open(uri))); + END_WRAP +} +CvStatus *VideoCapture_OpenWithAPI_Async( + VideoCapture self, const char *uri, int apiPreference, CvCallback_1 callback +) { + BEGIN_WRAP + callback(new bool(self.ptr->open(uri, apiPreference))); + END_WRAP +} +CvStatus *VideoCapture_OpenDevice_Async(VideoCapture self, int device, CvCallback_1 callback) { + BEGIN_WRAP + callback(new bool(self.ptr->open(device))); + END_WRAP +} +CvStatus *VideoCapture_OpenDeviceWithAPI_Async( + VideoCapture self, int device, int apiPreference, CvCallback_1 callback +) { + BEGIN_WRAP + callback(new bool(self.ptr->open(device, apiPreference))); + END_WRAP +} +CvStatus *VideoCapture_Set_Async(VideoCapture self, int prop, double param, CvCallback_1 callback) { + BEGIN_WRAP + callback(new bool(self.ptr->set(prop, param))); + END_WRAP +} +CvStatus *VideoCapture_Get_Async(VideoCapture self, int prop, CvCallback_1 callback) { + BEGIN_WRAP + callback(new double(self.ptr->get(prop))); + END_WRAP +} +CvStatus *VideoCapture_IsOpened_Async(VideoCapture self, CvCallback_1 callback) { + BEGIN_WRAP + callback(new bool(self.ptr->isOpened())); + END_WRAP +} +CvStatus *VideoCapture_Read_Async(VideoCapture self, CvCallback_2 callback) { + BEGIN_WRAP + cv::Mat dst; + bool rval = self.ptr->read(dst); + callback(new bool(rval), new Mat{new cv::Mat(dst)}); + END_WRAP +} +CvStatus *VideoCapture_Release_Async(VideoCapture self, CvCallback_0 callback) { + BEGIN_WRAP + self.ptr->release(); + callback(); + END_WRAP +} +CvStatus *VideoCapture_Grab_Async(VideoCapture self, CvCallback_1 callback) { + BEGIN_WRAP + callback(new bool(self.ptr->grab())); + END_WRAP +} + +// VideoWriter +CvStatus *VideoWriter_New_Async(CvCallback_1 callback) { + BEGIN_WRAP + callback(new VideoWriter{new cv::VideoWriter()}); + END_WRAP +} +// void VideoWriter_Close_Async(VideoWriterPtr self) { CVD_FREE(self); } + +CvStatus *VideoWriter_Open_Async( + VideoWriter self, + const char *name, + const char *codec, + double fps, + int width, + int height, + bool isColor, + CvCallback_1 callback +) { + BEGIN_WRAP + int codecCode = cv::VideoWriter::fourcc(codec[0], codec[1], codec[2], codec[3]); + bool rval = self.ptr->open(name, codecCode, fps, cv::Size(width, height), isColor); + callback(new bool(rval)); + END_WRAP +} +CvStatus *VideoWriter_IsOpened_Async(VideoWriter self, CvCallback_1 callback) { + BEGIN_WRAP + callback(new bool(self.ptr->isOpened())); + END_WRAP +} +CvStatus *VideoWriter_Write_Async(VideoWriter self, Mat img, CvCallback_0 callback) { + BEGIN_WRAP + self.ptr->write(*img.ptr); + callback(); + END_WRAP +} +CvStatus *VideoWriter_Release_Async(VideoWriter self, CvCallback_0 callback) { + BEGIN_WRAP + self.ptr->release(); + callback(); + END_WRAP +} +CvStatus *VideoWriter_Fourcc_Async(char c1, char c2, char c3, char c4, CvCallback_1 callback) { + BEGIN_WRAP + int rval = cv::VideoWriter::fourcc(c1, c2, c3, c4); + callback(new int(rval)); + END_WRAP +} diff --git a/src/video/videoio_async.h b/src/video/videoio_async.h new file mode 100644 index 00000000..b091d14d --- /dev/null +++ b/src/video/videoio_async.h @@ -0,0 +1,60 @@ +/* + Created by Rainyl. + Licensed: Apache 2.0 license. Copyright _Async(c) 2024 Rainyl. +*/ + +#ifndef CVD_VIDEOIO_ASYNC_H_ +#define CVD_VIDEOIO_ASYNC_H_ + +#include "core/core.h" +#include "core/types.h" +#include "videoio.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// VideoCapture +CvStatus *VideoCapture_New_Async(CvCallback_1 callback); +CvStatus * +VideoCapture_NewFromFile_Async(const char *filename, int apiPreference, CvCallback_1 callback); +CvStatus *VideoCapture_NewFromIndex_Async(int index, int apiPreference, CvCallback_1 callback); +// void VideoCapture_Close_Async(VideoCapturePtr self); +CvStatus *VideoCapture_Open_Async(VideoCapture self, const char *uri, CvCallback_1 callback); +CvStatus *VideoCapture_OpenWithAPI_Async( + VideoCapture self, const char *uri, int apiPreference, CvCallback_1 callback +); +CvStatus *VideoCapture_OpenDevice_Async(VideoCapture self, int device, CvCallback_1 callback); +CvStatus *VideoCapture_OpenDeviceWithAPI_Async( + VideoCapture self, int device, int apiPreference, CvCallback_1 callback +); +CvStatus *VideoCapture_Set_Async(VideoCapture self, int prop, double param, CvCallback_1 callback); +CvStatus *VideoCapture_Get_Async(VideoCapture self, int prop, CvCallback_1 callback); +CvStatus *VideoCapture_IsOpened_Async(VideoCapture self, CvCallback_1 callback); +CvStatus *VideoCapture_Read_Async(VideoCapture self, CvCallback_2 callback); +CvStatus *VideoCapture_Release_Async(VideoCapture self, CvCallback_0 callback); +CvStatus *VideoCapture_Grab_Async(VideoCapture self, CvCallback_1 callback); + +// VideoWriter +CvStatus *VideoWriter_New_Async(CvCallback_1 callback); +// void VideoWriter_Close_Async(VideoWriterPtr self, CvCallback_0 callback); +CvStatus *VideoWriter_Open_Async( + VideoWriter self, + const char *name, + const char *codec, + double fps, + int width, + int height, + bool isColor, + CvCallback_1 callback +); +CvStatus *VideoWriter_IsOpened_Async(VideoWriter self, CvCallback_1 callback); +CvStatus *VideoWriter_Write_Async(VideoWriter self, Mat img, CvCallback_0 callback); +CvStatus *VideoWriter_Release_Async(VideoWriter self, CvCallback_0 callback); +CvStatus *VideoWriter_Fourcc_Async(char c1, char c2, char c3, char c4, CvCallback_1 callback); + +#ifdef __cplusplus +} +#endif + +#endif // CVD_VIDEOIO_ASYNC_H_ diff --git a/test/perf_mat.dart b/test/perf_mat.dart index a6418a92..0ff3ae39 100644 --- a/test/perf_mat.dart +++ b/test/perf_mat.dart @@ -2,8 +2,9 @@ import 'package:opencv_dart/opencv_dart.dart' as cv; -void main() { - const counts = 10000; +const counts = 10000; + +void testSync() { final mat = cv.Mat.zeros(1000, 1000, cv.MatType.CV_8UC3); final sw = Stopwatch()..start(); for (var count = 0; count < counts; count++) { @@ -13,7 +14,27 @@ void main() { } sw.stop(); print( - "All: ${sw.elapsedMicroseconds}μs, counts: $counts, per: ${sw.elapsedMicroseconds / counts} μs", + "[Sync] All: ${sw.elapsedMicroseconds}μs, counts: $counts, per: ${sw.elapsedMicroseconds / counts} μs", + ); + print("[Sync] Finished"); +} + +Future testAsync() async { + final mat = cv.Mat.zeros(1000, 1000, cv.MatType.CV_8UC3); + final sw = Stopwatch()..start(); + for (var count = 0; count < counts; count++) { + final mat1 = await cv.cvtColorAsync(mat, cv.COLOR_BGR2YCrCb); + // manually dispose will reduce the memory consumption + mat1.dispose(); + } + sw.stop(); + print( + "[Sync] All: ${sw.elapsedMicroseconds}μs, counts: $counts, per: ${sw.elapsedMicroseconds / counts} μs", ); - print("Finished"); + print("[Sync] Finished"); +} + +void main() { + testSync(); + testAsync(); } diff --git a/test/video/video_async_test.dart b/test/video/video_async_test.dart new file mode 100644 index 00000000..624eaa46 --- /dev/null +++ b/test/video/video_async_test.dart @@ -0,0 +1,227 @@ +import 'package:opencv_dart/opencv_dart.dart' as cv; +import 'package:test/test.dart'; + +void main() async { + // video + test('cv.BackgroundSubtractorMOG2Async', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + final bgSubtractor = await cv.BackgroundSubtractorMOG2Async.emptyAsync(); + final dst = await bgSubtractor.applyAsync(img); + expect(dst.isEmpty, false); + + final bgSub1 = await cv.BackgroundSubtractorMOG2Async.createAsync( + history: 250, + varThreshold: 8, + detectShadows: false, + ); + final dst1 = await bgSub1.applyAsync(img); + expect(dst1.isEmpty, false); + + bgSub1.dispose(); + }); + + test('cv.BackgroundSubtractorKNNAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + final bgSubtractor = await cv.BackgroundSubtractorKNNAsync.emptyAsync(); + final dst = await bgSubtractor.applyAsync(img); + expect(dst.isEmpty, false); + + final bgSub1 = await cv.BackgroundSubtractorKNNAsync.createAsync( + history: 250, + varThreshold: 8, + detectShadows: false, + ); + final dst1 = await bgSub1.applyAsync(img); + expect(dst1.isEmpty, false); + + bgSubtractor.dispose(); + }); + + test('cv.calcOpticalFlowFarnebackAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_GRAYSCALE); + expect(img.isEmpty, false); + final next = img.clone(); + final flow = cv.Mat.empty(); + await cv.calcOpticalFlowFarnebackAsync(img, next, flow, 0.4, 1, 12, 2, 8, 1.2, 0); + expect(flow.isEmpty, false); + expect((flow.rows, flow.cols), (img.rows, img.cols)); + }); + + test('cv.calcOpticalFlowPyrLKAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_GRAYSCALE); + expect(img.isEmpty, false); + final img2 = img.clone(); + final corners = await cv.goodFeaturesToTrackAsync(img, 10, 0.01, 10); + const tc = (cv.TERM_COUNT + cv.TERM_EPS, 40, 0.03); + await cv.cornerSubPixAsync(img, corners, (5, 5), (-1, -1), tc); + final (next, status, error) = await cv.calcOpticalFlowPyrLKAsync(img, img2, corners, cv.VecPoint2f()); + expect(next.isNotEmpty, true); + expect(status.isEmpty, false); + expect(error.isEmpty, false); + }); + + test('cv.findTransformECCAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_GRAYSCALE); + expect(img.isEmpty, false); + final testImg = await cv.resizeAsync(img, (216, 216)); + final translationGround = cv.Mat.eye(2, 3, cv.MatType.CV_32FC1); + translationGround.set(0, 2, 11.4159); + translationGround.setF32(1, 2, 17.1828); + + final wrappedImage = await cv.warpAffineAsync( + testImg, + translationGround, + (200, 200), + flags: cv.INTER_LINEAR + cv.WARP_INVERSE_MAP, + borderMode: cv.BORDER_CONSTANT, + borderValue: cv.Scalar.default_(), + ); + + final mapTranslation = cv.Mat.eye(2, 3, cv.MatType.CV_32FC1); + const criteria = (cv.TERM_COUNT + cv.TERM_EPS, 50, 0.01); + final inputMask = cv.Mat.empty(); + await cv.findTransformECCAsync( + wrappedImage, + testImg, + mapTranslation, + cv.MOTION_TRANSLATION, + criteria, + inputMask, + 5, + ); + + expect( + (mapTranslation.rows, mapTranslation.cols), + (translationGround.rows, translationGround.cols), + ); + }); + + test('cv.TrackerMILAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + final rect = cv.Rect(100, 150, 200, 241); + final tracker = await cv.TrackerMILAsync.createAsync(); + await tracker.initAsync(img, rect); + final (ok, _) = await tracker.updateAsync(img); + expect(ok, true); + + rect.dispose(); + tracker.dispose(); + }); + + test('cv.KalmanFilterAsync', () async { + final kf = await cv.KalmanFilterAsync.createAsync(2, 1, controlParams: 1); + await kf.initAsync(2, 1, controlParams: 1); + final measurement = cv.Mat.zeros(1, 1, cv.MatType.CV_32FC1); + final prediction = await kf.predictAsync(); + expect(prediction.isEmpty, false); + final statePos = await kf.correctAsync(measurement); + expect(statePos.isEmpty, false); + + // getters and setters + final statePost = await kf.getStatePost(); + expect(statePost.isEmpty, false); + await kf.setStatePost(statePost); + + final statePre = await kf.getStatePre(); + expect(statePre.isEmpty, false); + await kf.setStatePre(statePre); + + final transitionMatrix = await kf.getTransitionMatrix(); + expect(transitionMatrix.isEmpty, false); + await kf.setTransitionMatrix(transitionMatrix); + + final temp1 = await kf.getTemp1(); + expect(temp1.isEmpty, false); + final temp2 = await kf.getTemp2(); + expect(temp2.isEmpty, false); + final temp3 = await kf.getTemp3(); + expect(temp3.isEmpty, false); + final temp4 = await kf.getTemp4(); + expect(temp4.isEmpty, false); + final temp5 = await kf.getTemp5(); + expect(temp5.isEmpty, false); + + final processNoiseCov = await kf.getProcessNoiseCov(); + expect(processNoiseCov.isEmpty, false); + await kf.setProcessNoiseCov(processNoiseCov); + + final measurementNoiseCov = await kf.getMeasurementNoiseCov(); + expect(measurementNoiseCov.isEmpty, false); + await kf.setMeasurementNoiseCov(measurementNoiseCov); + + final measurementMatrix = await kf.getMeasurementMatrix(); + expect(measurementMatrix.isEmpty, false); + await kf.setMeasurementMatrix(measurementMatrix); + + final gain = await kf.getGain(); + expect(gain.isEmpty, false); + await kf.setGain(gain); + + final errorCovPost = await kf.getErrorCovPost(); + expect(errorCovPost.isEmpty, false); + await kf.setErrorCovPost(errorCovPost); + + final errorCovPre = await kf.getErrorCovPre(); + expect(errorCovPre.isEmpty, false); + await kf.setErrorCovPre(errorCovPre); + + final controlMatrix = await kf.getControlMatrix(); + expect(controlMatrix.isEmpty, false); + await kf.setControlMatrix(controlMatrix); + + kf.dispose(); + }); + + // videoio + test('cv.VideoWriterAsync.emptyAsync', () async { + final writer = await cv.VideoWriterAsync.emptyAsync(); + expect(writer.isOpened, equals(false)); + await writer.openAsync("test/images/small2.mp4", "mp4v", 60, (400, 300)); + await writer.releaseAsync(); + + expect(await cv.VideoWriterAsync.fourccAsync("MJPG"), closeTo(1196444237, 1e-3)); + + writer.dispose(); + }); + + test('cv.VideoWriterAsync.openAsync', () async { + final writer = await cv.VideoWriterAsync.fromFileAsync("test/images/small2.mp4", "mp4v", 60, (400, 300)); + final frame = cv.Mat.ones(400, 300, cv.MatType.CV_8UC3); + await writer.writeAsync(frame); + await writer.releaseAsync(); + }); + + test('cv.VideoCaptureAsync.emptyAsync', () async { + final vc = await cv.VideoCaptureAsync.emptyAsync(); + expect(vc.isOpened, false); + final success = await vc.openAsync("test/images/small.mp4", apiPreference: cv.CAP_ANY); + expect(success, true); + await vc.releaseAsync(); + + vc.dispose(); + }); + + test('cv.VideoCaptureAsync.fromFileAsync', () async { + final vc = await cv.VideoCaptureAsync.fromFileAsync("test/images/small.mp4", apiPreference: cv.CAP_ANY); + final (success, frame) = await vc.readAsync(); + expect(success, true); + expect(frame.isEmpty, false); + expect(vc.codec, "h264"); + + expect(cv.VideoCapture.toCodec("h264"), closeTo(875967080, 1e-3)); + // cv.imwrite("cv.VideoCapture.fromFile.png", frame); + }); + + // Disable for github + test('cv.VideoCaptureAsync.fromDeviceAsync', skip: true, () async { + final vc = await cv.VideoCaptureAsync.fromDeviceAsync(0); + expect(vc.isOpened, true); + final (res, frame) = await vc.readAsync(); + expect(res, true); + expect(frame.isEmpty, false); + // cv.imwrite("cv.VideoCapture.fromDevice_1.png", frame); + }); +} diff --git a/test/video_test.dart b/test/video/video_test.dart similarity index 100% rename from test/video_test.dart rename to test/video/video_test.dart