diff --git a/.github/workflows/build_test_release.yaml b/.github/workflows/build_test_release.yaml index 86cd6228..84c2284a 100644 --- a/.github/workflows/build_test_release.yaml +++ b/.github/workflows/build_test_release.yaml @@ -79,7 +79,7 @@ jobs: build-ubuntu: name: build-ubuntu-android-armv7 - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: setup @@ -92,7 +92,7 @@ jobs: libswscale-dev libgflags-dev \ libjpeg-dev libpng-dev libtiff-dev python3-pip - python3 -m pip install conan + python3 -m pip install conan --break-system-packages conan profile detect -f - uses: actions/checkout@v4 with: diff --git a/.github/workflows/formatter.yaml b/.github/workflows/formatter.yaml new file mode 100644 index 00000000..be590a48 --- /dev/null +++ b/.github/workflows/formatter.yaml @@ -0,0 +1,24 @@ +on: + push: + pull_request: + +name: Format Code + +jobs: + build: + name: format code + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Set up Flutter + uses: subosito/flutter-action@v1 + - name: Format code + run: | + dart format --line-length 110 \ + $(find lib test -name '*.dart' -not -name '*.g.dart' -and -not -name '*.freezed.dart') + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: "dart format ✅" + branch: ${{ github.head_ref }} diff --git a/conanfile.py b/conanfile.py index fe35a5a8..4bfddda8 100644 --- a/conanfile.py +++ b/conanfile.py @@ -97,6 +97,8 @@ def build_requirements(self): self.tool_requires("cmake/3.28.1") if self.settings.os != "Windows": self.tool_requires("ninja/1.11.1") + # if self.settings.os == "Linux": + # self.tool_requires("ffmpeg/6.1") if self.settings.os == "Android": ndk_path = os.environ.get("ANDROID_NDK_HOME", None) or os.environ.get( "ANDROID_NDK_ROOT", None diff --git a/example/lib/main.dart b/example/lib/main.dart index b78a5397..a26402f9 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -40,12 +40,18 @@ class _MyAppState extends State { gray = cv.cvtColor(im, cv.COLOR_BGR2GRAY); blur = cv.gaussianBlur(im, (7, 7), 2, sigmaY: 2); } - return ( - cv.imencode(cv.ImageFormat.png.ext, gray), - cv.imencode(cv.ImageFormat.png.ext, blur) - ); + return (cv.imencode(".png", gray), cv.imencode(".png", blur)); }); + Future<(cv.Mat, cv.Mat)> heavyTaskAsync(cv.Mat im) async { + late cv.Mat gray, blur; + for (var i = 0; i < 1000; i++) { + gray = await cv.cvtColorAsync(im, cv.COLOR_BGR2GRAY); + blur = await cv.gaussianBlurAsync(im, (7, 7), 2, sigmaY: 2); + } + return (gray, blur); + } + @override Widget build(BuildContext context) { return MaterialApp( @@ -80,9 +86,13 @@ class _MyAppState extends State { final data = await DefaultAssetBundle.of(context).load("images/lenna.png"); final bytes = data.buffer.asUint8List(); // heavy computation - final (gray, blur) = await heavyTask(bytes); + // final (gray, blur) = await heavyTask(bytes); + // setState(() { + // images = [bytes, gray, blur]; + // }); + final (gray, blur) = await heavyTaskAsync(cv.imdecode(bytes, cv.IMREAD_COLOR)); setState(() { - images = [bytes, gray, blur]; + images = [bytes, cv.imencode(".png", gray), cv.imencode(".png", blur)]; }); }, child: const Text("Process"), diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart index e69de29b..8b137891 100644 --- a/example/test/widget_test.dart +++ b/example/test/widget_test.dart @@ -0,0 +1 @@ + diff --git a/ffigen.yaml b/ffigen.yaml index c4204fed..0fc4ad90 100644 --- a/ffigen.yaml +++ b/ffigen.yaml @@ -15,46 +15,74 @@ sort: true headers: entry-points: - src/calib3d/calib3d.h + - src/calib3d/calib3d_async.h - src/core/core.h + - src/core/core_async.h - src/core/exception.h - src/core/svd.h + - src/core/svd_async.h + - src/core/types.h - src/core/vec.h - src/core/version.h - src/dnn/asyncarray.h - src/dnn/dnn.h + - src/dnn/dnn_async.h - src/extra/aruco.h - src/extra/img_hash.h - src/extra/wechat_qrcode.h - src/features2d/features2d.h + - src/features2d/features2d_async.h + - src/gapi/gapi.h - src/highgui/highgui.h - src/imgcodecs/imgcodecs.h + - src/imgcodecs/imgcodecs_async.h - src/imgproc/imgproc.h + - src/imgproc/imgproc_async.h - src/objdetect/objdetect.h + - src/objdetect/objdetect_async.h - src/photo/photo.h + - src/photo/photo_async.h - 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 - src/core/core.h + - src/core/core_async.h - src/core/exception.h - src/core/svd.h + - src/core/svd_async.h - src/core/vec.h - src/core/version.h - src/dnn/asyncarray.h - src/dnn/dnn.h + - src/dnn/dnn_async.h - src/extra/aruco.h - src/extra/img_hash.h - src/extra/wechat_qrcode.h - src/features2d/features2d.h + - src/features2d/features2d_async.h + - src/gapi/gapi.h - src/highgui/highgui.h - src/imgcodecs/imgcodecs.h + - src/imgcodecs/imgcodecs_async.h - src/imgproc/imgproc.h + - src/imgproc/imgproc_async.h - src/objdetect/objdetect.h + - src/objdetect/objdetect_async.h - src/photo/photo.h + - src/photo/photo_async.h - 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 9798b99b..2de504ac 100644 --- a/lib/opencv_dart.dart +++ b/lib/opencv_dart.dart @@ -1 +1,56 @@ -export 'src/opencv.dart'; +library cv; + +export 'src/calib3d/calib3d.dart'; +export 'src/calib3d/calib3d_async.dart'; +export 'src/calib3d/fisheye.dart'; +export 'src/constants.g.dart'; +export 'src/contrib/aruco.dart'; +export 'src/contrib/aruco_dict.dart'; +export 'src/contrib/img_hash.dart'; +export 'src/contrib/wechat_qrcode.dart'; +export 'src/core/array.dart'; +export 'src/core/asyncarray.dart'; +export 'src/core/base.dart'; +export 'src/core/contours.dart'; +export 'src/core/core.dart'; +export 'src/core/core_async.dart'; +export 'src/core/cv_vec.dart'; +export 'src/core/dmatch.dart'; +export 'src/core/error_code.dart'; +export 'src/core/exception.dart'; +export 'src/core/keypoint.dart'; +export 'src/core/mat.dart'; +export 'src/core/mat_async.dart'; +export 'src/core/mat_type.dart'; +export 'src/core/moments.dart'; +export 'src/core/point.dart'; +export 'src/core/rect.dart'; +export 'src/core/rng.dart'; +export 'src/core/rng_async.dart'; +export 'src/core/scalar.dart'; +export 'src/core/size.dart'; +export 'src/core/vec.dart'; +export 'src/dnn/dnn.dart'; +export 'src/dnn/dnn_async.dart'; +export 'src/features2d/features2d.dart'; +export 'src/features2d/features2d_async.dart'; +export 'src/highgui/highgui.dart'; +export 'src/imgcodecs/imgcodecs.dart'; +export 'src/imgcodecs/imgcodecs_async.dart'; +export 'src/imgproc/clahe.dart'; +export 'src/imgproc/clahe_async.dart'; +export 'src/imgproc/imgproc.dart'; +export 'src/imgproc/imgproc_async.dart'; +export 'src/imgproc/subdiv2d.dart'; +export 'src/imgproc/subdiv2d_async.dart'; +export 'src/objdetect/objdetect.dart'; +export 'src/objdetect/objdetect_async.dart'; +export 'src/photo/photo.dart'; +export 'src/photo/photo_async.dart'; +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/opencv_gapi.dart b/lib/opencv_gapi.dart new file mode 100644 index 00000000..e6e5bdcd --- /dev/null +++ b/lib/opencv_gapi.dart @@ -0,0 +1,6 @@ +library cv.gapi; + +export 'src/gapi/gapi.dart'; +export 'src/gapi/gcomputation.dart'; +export 'src/gapi/gmat.dart'; +export 'src/gapi/gscalar.dart'; diff --git a/lib/src/calib3d/calib3d.dart b/lib/src/calib3d/calib3d.dart index 654a86ca..e8aafb83 100644 --- a/lib/src/calib3d/calib3d.dart +++ b/lib/src/calib3d/calib3d.dart @@ -14,86 +14,6 @@ import '../core/size.dart'; import '../core/termcriteria.dart'; import '../opencv.g.dart' as cvg; -class Fisheye { - /// FisheyeUndistortImage transforms an image to compensate for fisheye lens distortion - /// https://docs.opencv.org/3.4/db/d58/group__calib3d__fisheye.html#ga167df4b00a6fd55287ba829fbf9913b9 - static Mat undistortImage( - InputArray distorted, - InputArray K, - InputArray D, { - OutputArray? undistorted, - InputArray? knew, - Size newSize = (0, 0), - }) { - return using((arena) { - knew ??= Mat.empty(); - undistorted ??= Mat.empty(); - cvRun( - () => CFFI.Fisheye_UndistortImageWithParams( - distorted.ref, - undistorted!.ref, - K.ref, - D.ref, - knew!.ref, - newSize.toSize(arena).ref, - ), - ); - return undistorted!; - }); - } - - /// FisheyeUndistortPoints transforms points to compensate for fisheye lens distortion - /// - /// For further details, please see: - /// https://docs.opencv.org/master/db/d58/group__calib3d__fisheye.html#gab738cdf90ceee97b2b52b0d0e7511541 - static Mat undistortPoints( - InputArray distorted, - InputArray K, - InputArray D, { - OutputArray? undistorted, - InputArray? R, - InputArray? P, - }) { - R ??= Mat.empty(); - P ??= Mat.empty(); - undistorted ??= Mat.empty(); - cvRun(() => CFFI.Fisheye_UndistortPoints(distorted.ref, undistorted!.ref, K.ref, D.ref, R!.ref, P!.ref)); - return undistorted; - } - - /// EstimateNewCameraMatrixForUndistortRectify estimates new camera matrix for undistortion or rectification. - /// - /// For further details, please see: - /// https://docs.opencv.org/master/db/d58/group__calib3d__fisheye.html#ga384940fdf04c03e362e94b6eb9b673c9 - static Mat estimateNewCameraMatrixForUndistortRectify( - InputArray K, - InputArray D, - Size imageSize, - InputArray R, { - OutputArray? P, - double balance = 0.0, - Size newSize = (0, 0), - double fovScale = 1.0, - }) { - return using((arena) { - P ??= Mat.empty(); - cvRun( - () => CFFI.Fisheye_EstimateNewCameraMatrixForUndistortRectify( - K.ref, - D.ref, - imageSize.toSize(arena).ref, - R.ref, - P!.ref, - balance, - newSize.toSize(arena).ref, - fovScale, - ), - ); - return P!; - }); - } -} - /// InitUndistortRectifyMap computes the joint undistortion and rectification transformation and represents the result in the form of maps for remap /// /// For further details, please see: @@ -103,28 +23,26 @@ class Fisheye { InputArray distCoeffs, InputArray R, InputArray newCameraMatrix, - Size size, + (int, int) size, int m1type, { OutputArray? map1, OutputArray? map2, }) { - return using<(Mat, Mat)>((arena) { - map1 ??= Mat.empty(); - map2 ??= Mat.empty(); - cvRun( - () => CFFI.InitUndistortRectifyMap( - cameraMatrix.ref, - distCoeffs.ref, - R.ref, - newCameraMatrix.ref, - size.toSize(arena).ref, - m1type, - map1!.ref, - map2!.ref, - ), - ); - return (map1!, map2!); - }); + map1 ??= Mat.empty(); + map2 ??= Mat.empty(); + cvRun( + () => CFFI.InitUndistortRectifyMap( + cameraMatrix.ref, + distCoeffs.ref, + R.ref, + newCameraMatrix.ref, + size.cvd.ref, + m1type, + map1!.ref, + map2!.ref, + ), + ); + return (map1, map2); } /// GetOptimalNewCameraMatrixWithParams computes and returns the optimal new camera matrix based on the free scaling parameter. @@ -134,28 +52,26 @@ class Fisheye { (Mat rval, Rect validPixROI) getOptimalNewCameraMatrix( InputArray cameraMatrix, InputArray distCoeffs, - Size imageSize, + (int, int) imageSize, double alpha, { - Size newImgSize = (0, 0), + (int, int) newImgSize = (0, 0), bool centerPrincipalPoint = false, }) { - return using<(Mat, Rect)>((arena) { - final validPixROI = calloc(); - final matPtr = calloc(); - cvRun( - () => CFFI.GetOptimalNewCameraMatrixWithParams( - cameraMatrix.ref, - distCoeffs.ref, - imageSize.toSize(arena).ref, - alpha, - newImgSize.toSize(arena).ref, - validPixROI, - centerPrincipalPoint, - matPtr, - ), - ); - return (Mat.fromPointer(matPtr), Rect.fromPointer(validPixROI)); - }); + final validPixROI = calloc(); + final matPtr = calloc(); + cvRun( + () => CFFI.GetOptimalNewCameraMatrixWithParams( + cameraMatrix.ref, + distCoeffs.ref, + imageSize.cvd.ref, + alpha, + newImgSize.cvd.ref, + validPixROI, + centerPrincipalPoint, + matPtr, + ), + ); + return (Mat.fromPointer(matPtr), Rect.fromPointer(validPixROI)); } // CalibrateCamera finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern. @@ -165,35 +81,35 @@ class Fisheye { (double rmsErr, Mat cameraMatrix, Mat distCoeffs, Mat rvecs, Mat tvecs) calibrateCamera( Contours3f objectPoints, Contours2f imagePoints, - Size imageSize, + (int, int) imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs, { Mat? rvecs, Mat? tvecs, int flags = 0, - TermCriteria criteria = (TERM_COUNT + TERM_EPS, 30, 1e-4), + (int type, int count, double eps) criteria = (TERM_COUNT + TERM_EPS, 30, 1e-4), }) { - return using<(double, Mat, Mat, Mat, Mat)>((arena) { - rvecs ??= Mat.empty(); - tvecs ??= Mat.empty(); - final rmsErr = arena(); + rvecs ??= Mat.empty(); + tvecs ??= Mat.empty(); + final cRmsErr = calloc(); - cvRun( - () => CFFI.CalibrateCamera( - objectPoints.ref, - imagePoints.ref, - imageSize.toSize(arena).ref, - cameraMatrix.ref, - distCoeffs.ref, - rvecs!.ref, - tvecs!.ref, - flags, - criteria.toNativePtr(arena).ref, - rmsErr, - ), - ); - return (rmsErr.value, cameraMatrix, distCoeffs, rvecs!, tvecs!); - }); + cvRun( + () => CFFI.CalibrateCamera( + objectPoints.ref, + imagePoints.ref, + imageSize.cvd.ref, + cameraMatrix.ref, + distCoeffs.ref, + rvecs!.ref, + tvecs!.ref, + flags, + criteria.cvd.ref, + cRmsErr, + ), + ); + final rmsErr = cRmsErr.value; + calloc.free(cRmsErr); + return (rmsErr, cameraMatrix, distCoeffs, rvecs, tvecs); } // Transforms an image to compensate for lens distortion. @@ -226,23 +142,14 @@ Mat undistortPoints( OutputArray? dst, InputArray? R, InputArray? P, - TermCriteria criteria = (TERM_COUNT + TERM_EPS, 30, 1e-4), + (int type, int count, double eps) criteria = (TERM_COUNT + TERM_EPS, 30, 1e-4), }) { R ??= Mat.empty(); P ??= Mat.empty(); dst ??= Mat.empty(); - cvRunArena( - (arena) => cvRun( - () => CFFI.UndistortPoints( - src.ref, - dst!.ref, - cameraMatrix.ref, - distCoeffs.ref, - R!.ref, - P!.ref, - criteria.toNativePtr(arena).ref, - ), - ), + final tc = criteria.cvd; + cvRun( + () => CFFI.UndistortPoints(src.ref, dst!.ref, cameraMatrix.ref, distCoeffs.ref, R!.ref, P!.ref, tc.ref), ); return dst; } @@ -253,48 +160,31 @@ Mat undistortPoints( // https://docs.opencv.org/master/d9/d0c/group__calib3d.html#ga93efa9b0aa890de240ca32b11253dd4a (bool success, Mat corners) findChessboardCorners( InputArray image, - Size patternSize, { + (int, int) patternSize, { OutputArray? corners, int flags = CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE, }) { - return using<(bool, Mat)>((arena) { - corners ??= Mat.empty(); - final r = arena(); - cvRun( - () => CFFI.FindChessboardCorners( - image.ref, - patternSize.toSize(arena).ref, - corners!.ref, - flags, - r, - ), - ); - return (r.value, corners!); - }); + corners ??= Mat.empty(); + final r = calloc(); + cvRun(() => CFFI.FindChessboardCorners(image.ref, patternSize.cvd.ref, corners!.ref, flags, r)); + final rval = r.value; + calloc.free(r); + return (rval, corners); } // Finds the positions of internal corners of the chessboard using a sector based approach. // https://docs.opencv.org/4.x/d9/d0c/group__calib3d.html#gadc5bcb05cb21cf1e50963df26986d7c9 (bool, Mat corners) findChessboardCornersSB( InputArray image, - Size patternSize, + (int, int) patternSize, int flags, { OutputArray? corners, }) { corners ??= Mat.empty(); - final rval = cvRunArena((arena) { - final b = arena(); - cvRun( - () => CFFI.FindChessboardCornersSB( - image.ref, - patternSize.toSize(arena).ref, - corners!.ref, - flags, - b, - ), - ); - return b.value; - }); + final b = calloc(); + cvRun(() => CFFI.FindChessboardCornersSB(image.ref, patternSize.cvd.ref, corners!.ref, flags, b)); + final rval = b.value; + calloc.free(b); return (rval, corners); } @@ -302,27 +192,26 @@ Mat undistortPoints( // https://docs.opencv.org/4.x/d9/d0c/group__calib3d.html#gadc5bcb05cb21cf1e50963df26986d7c9 (bool, Mat corners, Mat meta) findChessboardCornersSBWithMeta( InputArray image, - Size patternSize, + (int, int) patternSize, int flags, { OutputArray? corners, OutputArray? meta, }) { corners ??= Mat.empty(); meta ??= Mat.empty(); - final rval = cvRunArena((arena) { - final b = arena(); - cvRun( - () => CFFI.FindChessboardCornersSBWithMeta( - image.ref, - patternSize.toSize(arena).ref, - corners!.ref, - flags, - meta!.ref, - b, - ), - ); - return b.value; - }); + final b = calloc(); + cvRun( + () => CFFI.FindChessboardCornersSBWithMeta( + image.ref, + patternSize.cvd.ref, + corners!.ref, + flags, + meta!.ref, + b, + ), + ); + final rval = b.value; + calloc.free(b); return (rval, corners, meta); } @@ -332,21 +221,12 @@ Mat undistortPoints( // https://docs.opencv.org/master/d9/d0c/group__calib3d.html#ga6a10b0bb120c4907e5eabbcd22319022 Mat drawChessboardCorners( InputOutputArray image, - Size patternSize, + (int, int) patternSize, InputArray corners, bool patternWasFound, ) { - return cvRunArena((arena) { - cvRun( - () => CFFI.DrawChessboardCorners( - image.ref, - patternSize.toSize(arena).ref, - corners.ref, - patternWasFound, - ), - ); - return image; - }); + cvRun(() => CFFI.DrawChessboardCorners(image.ref, patternSize.cvd.ref, corners.ref, patternWasFound)); + return image; } // EstimateAffinePartial2D computes an optimal limited affine transformation @@ -364,24 +244,22 @@ Mat drawChessboardCorners( int refineIters = 10, OutputArray? inliers, }) { - return cvRunArena<(Mat, Mat)>((arena) { - inliers ??= Mat.empty(); - final p = calloc(); - cvRun( - () => CFFI.EstimateAffinePartial2DWithParams( - from.ref, - to.ref, - inliers!.ref, - method, - ransacReprojThreshold, - maxIters, - confidence, - refineIters, - p, - ), - ); - return (Mat.fromPointer(p), inliers!); - }); + inliers ??= Mat.empty(); + final p = calloc(); + cvRun( + () => CFFI.EstimateAffinePartial2DWithParams( + from.ref, + to.ref, + inliers!.ref, + method, + ransacReprojThreshold, + maxIters, + confidence, + refineIters, + p, + ), + ); + return (Mat.fromPointer(p), inliers); } // EstimateAffine2D Computes an optimal affine transformation between two 2D point sets. @@ -398,22 +276,20 @@ Mat drawChessboardCorners( int refineIters = 10, OutputArray? inliers, }) { - return cvRunArena<(Mat, Mat)>((arena) { - inliers ??= Mat.empty(); - final p = calloc(); - cvRun( - () => CFFI.EstimateAffine2DWithParams( - from.ref, - to.ref, - inliers!.ref, - method, - ransacReprojThreshold, - maxIters, - confidence, - refineIters, - p, - ), - ); - return (Mat.fromPointer(p), inliers!); - }); + inliers ??= Mat.empty(); + final p = calloc(); + cvRun( + () => CFFI.EstimateAffine2DWithParams( + from.ref, + to.ref, + inliers!.ref, + method, + ransacReprojThreshold, + maxIters, + confidence, + refineIters, + p, + ), + ); + return (Mat.fromPointer(p), inliers); } diff --git a/lib/src/calib3d/calib3d_async.dart b/lib/src/calib3d/calib3d_async.dart new file mode 100644 index 00000000..6526e846 --- /dev/null +++ b/lib/src/calib3d/calib3d_async.dart @@ -0,0 +1,285 @@ +library cv; + +import 'dart:ffi' as ffi; + +import 'package:ffi/ffi.dart'; + +import '../constants.g.dart'; +import '../core/base.dart'; +import '../core/contours.dart'; +import '../core/mat.dart'; +import '../core/point.dart'; +import '../core/rect.dart'; +import '../core/size.dart'; +import '../core/termcriteria.dart'; + +/// InitUndistortRectifyMap computes the joint undistortion and rectification transformation and represents the result in the form of maps for remap +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d9/d0c/group__calib3d.html#ga7dfb72c9cf9780a347fbe3d1c47e5d5a +Future<(Mat, Mat)> initUndistortRectifyMapAsync( + InputArray cameraMatrix, + InputArray distCoeffs, + InputArray R, + InputArray newCameraMatrix, + (int, int) size, + int m1type, +) async => + cvRunAsync2<(Mat, Mat)>( + (callback) => CFFI.initUndistortRectifyMap_Async( + cameraMatrix.ref, + distCoeffs.ref, + R.ref, + newCameraMatrix.ref, + size.cvd.ref, + m1type, + callback, + ), + matCompleter2, + ); + +/// GetOptimalNewCameraMatrixWithParams computes and returns the optimal new camera matrix based on the free scaling parameter. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d9/d0c/group__calib3d.html#ga7a6c4e032c97f03ba747966e6ad862b1 +Future<(Mat rval, Rect validPixROI)> getOptimalNewCameraMatrixAsync( + InputArray cameraMatrix, + InputArray distCoeffs, + (int, int) imageSize, + double alpha, { + (int, int) newImgSize = (0, 0), + bool centerPrincipalPoint = false, +}) async => + cvRunAsync2( + (callback) => CFFI.getOptimalNewCameraMatrix_Async( + cameraMatrix.ref, + distCoeffs.ref, + imageSize.cvd.ref, + alpha, + newImgSize.cvd.ref, + centerPrincipalPoint, + callback, + ), + (c, p, p1) => c.complete((Mat.fromPointer(p.cast()), Rect.fromPointer(p1.cast()))), + ); + +// CalibrateCamera finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern. +// +// For further details, please see: +// https://docs.opencv.org/master/d9/d0c/group__calib3d.html#ga3207604e4b1a1758aa66acb6ed5aa65d +Future<(double rmsErr, Mat cameraMatrix, Mat distCoeffs, Mat rvecs, Mat tvecs)> calibrateCameraAsync( + Contours3f objectPoints, + Contours2f imagePoints, + (int, int) imageSize, + InputOutputArray cameraMatrix, + InputOutputArray distCoeffs, { + Mat? rvecs, + Mat? tvecs, + int flags = 0, + (int type, int count, double eps) criteria = (TERM_COUNT + TERM_EPS, 30, 1e-4), +}) async => + cvRunAsync5( + (callback) => CFFI.calibrateCamera_Async( + objectPoints.ref, + imagePoints.ref, + imageSize.cvd.ref, + cameraMatrix.ref, + distCoeffs.ref, + flags, + criteria.cvd.ref, + callback, + ), + (c, p, p1, p2, p3, p4) { + final rmsErr = p.cast().value; + calloc.free(p); + final cameraMatrix = Mat.fromPointer(p1.cast()); + final distCoeffs = Mat.fromPointer(p2.cast()); + final rvecs = Mat.fromPointer(p3.cast()); + final tvecs = Mat.fromPointer(p4.cast()); + return c.complete((rmsErr, cameraMatrix, distCoeffs, rvecs, tvecs)); + }, + ); + +// Transforms an image to compensate for lens distortion. +// The function transforms an image to compensate radial and tangential lens distortion. +// The function is simply a combination of initUndistortRectifyMap (with unity R ) and remap (with bilinear interpolation). See the former function for details of the transformation being performed. +// Those pixels in the destination image, for which there is no correspondent pixels in the source image, are filled with zeros (black color). +// A particular subset of the source image that will be visible in the corrected image can be regulated by newCameraMatrix. You can use getOptimalNewCameraMatrix to compute the appropriate newCameraMatrix depending on your requirements. +// The camera matrix and the distortion parameters can be determined using calibrateCamera. If the resolution of images is different from the resolution used at the calibration stage, fx,fy,cx and cy need to be scaled accordingly, while the distortion coefficients remain the same. +Future undistortAsync( + InputArray src, + InputArray cameraMatrix, + InputArray distCoeffs, { + InputArray? newCameraMatrix, +}) async => + cvRunAsync( + (callback) => CFFI.undistort_Async( + src.ref, + cameraMatrix.ref, + distCoeffs.ref, + newCameraMatrix?.ref ?? Mat.empty().ref, + callback, + ), + matCompleter, + ); + +// UndistortPoints transforms points to compensate for lens distortion +// +// For further details, please see: +// https://docs.opencv.org/master/d9/d0c/group__calib3d.html#ga55c716492470bfe86b0ee9bf3a1f0f7e +Future undistortPointsAsync( + InputArray src, + InputArray cameraMatrix, + InputArray distCoeffs, { + InputArray? R, + InputArray? P, + (int type, int count, double eps) criteria = (TERM_COUNT + TERM_EPS, 30, 1e-4), +}) async => + cvRunAsync( + (callback) => CFFI.undistortPoints_Async( + src.ref, + cameraMatrix.ref, + distCoeffs.ref, + R?.ref ?? Mat.empty().ref, + P?.ref ?? Mat.empty().ref, + criteria.cvd.ref, + callback, + ), + matCompleter, + ); + +// FindChessboardCorners finds the positions of internal corners of the chessboard. +// +// For further details, please see: +// https://docs.opencv.org/master/d9/d0c/group__calib3d.html#ga93efa9b0aa890de240ca32b11253dd4a +Future<(bool success, Mat corners)> findChessboardCornersAsync( + InputArray image, + (int, int) patternSize, { + int flags = CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE, +}) async => + cvRunAsync2( + (callback) => CFFI.findChessboardCorners_Async( + image.ref, + patternSize.cvd.ref, + flags, + callback, + ), + (c, p, p1) { + final rval = p.cast().value; + calloc.free(p); + final corners = Mat.fromPointer(p1.cast()); + return c.complete((rval, corners)); + }, + ); + +// Finds the positions of internal corners of the chessboard using a sector based approach. +// https://docs.opencv.org/4.x/d9/d0c/group__calib3d.html#gadc5bcb05cb21cf1e50963df26986d7c9 +Future<(bool, Mat corners)> findChessboardCornersSBAsync( + InputArray image, + (int, int) patternSize, + int flags, +) async => + cvRunAsync2( + (callback) => CFFI.findChessboardCornersSB_Async( + image.ref, + patternSize.cvd.ref, + flags, + callback, + ), + (c, p, p1) { + final rval = p.cast().value; + calloc.free(p); + final corners = Mat.fromPointer(p1.cast()); + return c.complete((rval, corners)); + }, + ); + +// Finds the positions of internal corners of the chessboard using a sector based approach. +// https://docs.opencv.org/4.x/d9/d0c/group__calib3d.html#gadc5bcb05cb21cf1e50963df26986d7c9 +Future<(bool, Mat corners, Mat meta)> findChessboardCornersSBWithMetaAsync( + InputArray image, + (int, int) patternSize, + int flags, +) async => + cvRunAsync3( + (callback) => + CFFI.findChessboardCornersSBWithMeta_Async(image.ref, patternSize.cvd.ref, flags, callback), + (c, p, p1, p2) { + final rval = p.cast().value; + calloc.free(p); + final corners = Mat.fromPointer(p1.cast()); + final meta = Mat.fromPointer(p2.cast()); + return c.complete((rval, corners, meta)); + }, + ); + +// DrawChessboardCorners renders the detected chessboard corners. +// +// For further details, please see: +// https://docs.opencv.org/master/d9/d0c/group__calib3d.html#ga6a10b0bb120c4907e5eabbcd22319022 +Future drawChessboardCornersAsync( + InputOutputArray image, + (int, int) patternSize, + InputArray corners, + bool patternWasFound, +) async => + cvRunAsync0( + (callback) => + CFFI.drawChessboardCorners_Async(image.ref, patternSize.cvd.ref, patternWasFound, callback), + (c) => c.complete(image), + ); + +// EstimateAffinePartial2D computes an optimal limited affine transformation +// with 4 degrees of freedom between two 2D point sets. +// +// For further details, please see: +// https://docs.opencv.org/master/d9/d0c/group__calib3d.html#gad767faff73e9cbd8b9d92b955b50062d +Future<(Mat, Mat inliers)> estimateAffinePartial2DAsync( + VecPoint2f from, + VecPoint2f to, { + int method = RANSAC, + double ransacReprojThreshold = 3, + int maxIters = 2000, + double confidence = 0.99, + int refineIters = 10, +}) async => + cvRunAsync2( + (callback) => CFFI.estimateAffinePartial2DWithParams_Async( + from.ref, + to.ref, + method, + ransacReprojThreshold, + maxIters, + confidence, + refineIters, + callback, + ), + matCompleter2, + ); + +// EstimateAffine2D Computes an optimal affine transformation between two 2D point sets. +// +// For further details, please see: +// https://docs.opencv.org/4.0.0/d9/d0c/group__calib3d.html#ga27865b1d26bac9ce91efaee83e94d4dd +Future<(Mat, Mat inliers)> estimateAffine2DAsync( + VecPoint2f from, + VecPoint2f to, { + int method = RANSAC, + double ransacReprojThreshold = 3, + int maxIters = 2000, + double confidence = 0.99, + int refineIters = 10, +}) async => + cvRunAsync2( + (callback) => CFFI.estimateAffine2DWithParams_Async( + from.ref, + to.ref, + method, + ransacReprojThreshold, + maxIters, + confidence, + refineIters, + callback, + ), + matCompleter2, + ); diff --git a/lib/src/calib3d/fisheye.dart b/lib/src/calib3d/fisheye.dart new file mode 100644 index 00000000..b1ee844c --- /dev/null +++ b/lib/src/calib3d/fisheye.dart @@ -0,0 +1,145 @@ +library cv; + +import '../core/base.dart'; +import '../core/mat.dart'; +import '../core/size.dart'; + +class Fisheye { + /// FisheyeUndistortImage transforms an image to compensate for fisheye lens distortion + /// https://docs.opencv.org/3.4/db/d58/group__calib3d__fisheye.html#ga167df4b00a6fd55287ba829fbf9913b9 + static Mat undistortImage( + InputArray distorted, + InputArray K, + InputArray D, { + OutputArray? undistorted, + InputArray? knew, + (int, int) newSize = (0, 0), + }) { + knew ??= Mat.empty(); + undistorted ??= Mat.empty(); + cvRun( + () => CFFI.Fisheye_UndistortImageWithParams( + distorted.ref, + undistorted!.ref, + K.ref, + D.ref, + knew!.ref, + newSize.cvd.ref, + ), + ); + return undistorted; + } + + /// async version of [undistortImage] + static Future undistortImageAsync( + InputArray distorted, + InputArray K, + InputArray D, { + InputArray? knew, + (int, int) newSize = (0, 0), + }) => + cvRunAsync( + (callback) => CFFI.fisheye_undistortImageWithParams_Async( + distorted.ref, + K.ref, + D.ref, + knew?.ref ?? Mat.empty().ref, + newSize.cvd.ref, + callback, + ), + matCompleter, + ); + + /// FisheyeUndistortPoints transforms points to compensate for fisheye lens distortion + /// + /// For further details, please see: + /// https://docs.opencv.org/master/db/d58/group__calib3d__fisheye.html#gab738cdf90ceee97b2b52b0d0e7511541 + static Mat undistortPoints( + InputArray distorted, + InputArray K, + InputArray D, { + OutputArray? undistorted, + InputArray? R, + InputArray? P, + }) { + R ??= Mat.empty(); + P ??= Mat.empty(); + undistorted ??= Mat.empty(); + cvRun(() => CFFI.Fisheye_UndistortPoints(distorted.ref, undistorted!.ref, K.ref, D.ref, R!.ref, P!.ref)); + return undistorted; + } + + /// async version of [undistortPoints] + static Future undistortPointsAsync( + InputArray distorted, + InputArray K, + InputArray D, { + InputArray? R, + InputArray? P, + }) async => + cvRunAsync( + (callback) => CFFI.fisheye_undistortPoints_Async( + distorted.ref, + K.ref, + D.ref, + R?.ref ?? Mat.empty().ref, + P?.ref ?? Mat.empty().ref, + callback, + ), + matCompleter, + ); + + /// EstimateNewCameraMatrixForUndistortRectify estimates new camera matrix for undistortion or rectification. + /// + /// For further details, please see: + /// https://docs.opencv.org/master/db/d58/group__calib3d__fisheye.html#ga384940fdf04c03e362e94b6eb9b673c9 + static Mat estimateNewCameraMatrixForUndistortRectify( + InputArray K, + InputArray D, + (int, int) imageSize, + InputArray R, { + OutputArray? P, + double balance = 0.0, + (int, int) newSize = (0, 0), + double fovScale = 1.0, + }) { + P ??= Mat.empty(); + cvRun( + () => CFFI.Fisheye_EstimateNewCameraMatrixForUndistortRectify( + K.ref, + D.ref, + imageSize.cvd.ref, + R.ref, + P!.ref, + balance, + newSize.cvd.ref, + fovScale, + ), + ); + return P; + } + + /// async version of [estimateNewCameraMatrixForUndistortRectify] + static Future estimateNewCameraMatrixForUndistortRectifyAsync( + InputArray K, + InputArray D, + (int, int) imageSize, + InputArray R, { + double balance = 0.0, + (int, int) newSize = (0, 0), + double fovScale = 1.0, + }) async => + cvRunAsync( + (callback) => CFFI.fisheye_estimateNewCameraMatrixForUndistortRectify_Async( + K.ref, + D.ref, + imageSize.cvd.ref, + R.ref, + balance, + newSize.cvd.ref, + fovScale, + callback, + ), + matCompleter, + ); +} diff --git a/lib/src/contrib/aruco_dict.dart b/lib/src/contrib/aruco_dict.dart index e0ced4a6..6d5b6283 100644 --- a/lib/src/contrib/aruco_dict.dart +++ b/lib/src/contrib/aruco_dict.dart @@ -95,8 +95,7 @@ class ArucoDictionary extends CvStruct { @override cvg.ArucoDictionary get ref => ptr.ref; - static final finalizer = - OcvFinalizer(CFFI.addresses.ArucoDictionary_Close); + static final finalizer = OcvFinalizer(CFFI.addresses.ArucoDictionary_Close); void dispose() { finalizer.detach(this); diff --git a/lib/src/core/array.dart b/lib/src/core/array.dart index 55b243aa..0ca6db22 100644 --- a/lib/src/core/array.dart +++ b/lib/src/core/array.dart @@ -15,6 +15,7 @@ abstract class NativeArray int length; late final ffi.Pointer ptr; + void dispose(); ffi.Pointer asVoid() => ptr.cast(); @override List get props => [ptr.address]; diff --git a/lib/src/core/base.dart b/lib/src/core/base.dart index c53d4e58..03da61c6 100644 --- a/lib/src/core/base.dart +++ b/lib/src/core/base.dart @@ -3,6 +3,7 @@ library cv; +import 'dart:async'; import 'dart:ffi' as ffi; import 'dart:ffi'; import 'dart:io'; @@ -10,7 +11,7 @@ import 'dart:io'; import 'package:equatable/equatable.dart'; import 'package:ffi/ffi.dart'; -import "../opencv.g.dart" show CvStatus, CvNative; +import "../opencv.g.dart" as cvg; import "exception.dart" show CvException; const _libraryName = "opencv_dart"; @@ -35,20 +36,24 @@ const int CV_I32_MIN = -2147483648; const double CV_F32_MAX = 3.4028234663852886e+38; const double CV_F64_MAX = 1.7976931348623157e+308; +// load native library ffi.DynamicLibrary loadNativeLibrary() { if (Platform.isIOS) return ffi.DynamicLibrary.process(); final defaultLibPath = switch (Platform.operatingSystem) { "windows" => "$_libraryName.dll", "linux" || "android" || "fuchsia" => "lib$_libraryName.so", "macos" => "lib$_libraryName.dylib", - _ => throw UnsupportedError("Platform ${Platform.operatingSystem} not supported") + _ => throw UnsupportedError( + "Platform ${Platform.operatingSystem} not supported", + ) }; final libPath = Platform.environment["OPENCV_DART_LIB_PATH"] ?? defaultLibPath; return ffi.DynamicLibrary.open(libPath); } -final CFFI = CvNative(loadNativeLibrary()); +final CFFI = cvg.CvNative(loadNativeLibrary()); +// base structures abstract class CvObject implements ffi.Finalizable {} abstract class ICvStruct extends CvObject { @@ -62,8 +67,8 @@ abstract class CvStruct extends ICvStruct with Equatabl CvStruct.fromPointer(super.ptr) : super.fromPointer(); } -void cvRun(ffi.Pointer Function() func) { - final s = func(); +// error handler +void throwIfFailed(ffi.Pointer s) { final code = s.ref.code; // String err = s.ref.err.cast().toDartString(); final msg = s.ref.msg.cast().toDartString(); @@ -76,8 +81,155 @@ void cvRun(ffi.Pointer Function() func) { } } -R cvRunArena(R Function(Arena arena) computation, - [Allocator wrappedAllocator = calloc, bool keep = false]) { +// sync runner +void cvRun(ffi.Pointer Function() func) => throwIfFailed(func()); + +// async runner +typedef VoidPtr = ffi.Pointer; +Future cvRunAsync0( + ffi.Pointer Function(cvg.CvCallback_0 callback) func, + void Function(Completer completer) onComplete, +) { + final completer = Completer(); + late final NativeCallable ccallback; + void onResponse() { + onComplete(completer); + ccallback.close(); + } + + ccallback = ffi.NativeCallable.listener(onResponse); + throwIfFailed(func(ccallback.nativeFunction)); + return completer.future; +} + +Future cvRunAsync( + ffi.Pointer Function(cvg.CvCallback_1 callback) func, + void Function(Completer completer, VoidPtr p) onComplete, +) { + final completer = Completer(); + late final NativeCallable ccallback; + void onResponse(VoidPtr p) { + onComplete(completer, p); + ccallback.close(); + } + + ccallback = ffi.NativeCallable.listener(onResponse); + throwIfFailed(func(ccallback.nativeFunction)); + return completer.future; +} + +const cvRunAsync1 = cvRunAsync; + +Future cvRunAsync2( + ffi.Pointer Function(cvg.CvCallback_2 callback) func, + void Function(Completer completer, VoidPtr p, VoidPtr p1) onComplete, +) { + final completer = Completer(); + late final NativeCallable ccallback; + void onResponse(VoidPtr p, VoidPtr p1) { + onComplete(completer, p, p1); + ccallback.close(); + } + + ccallback = ffi.NativeCallable.listener(onResponse); + throwIfFailed(func(ccallback.nativeFunction)); + return completer.future; +} + +Future cvRunAsync3( + ffi.Pointer Function(cvg.CvCallback_3 callback) func, + void Function(Completer completer, VoidPtr p, VoidPtr p1, VoidPtr p2) onComplete, +) { + final completer = Completer(); + late final NativeCallable ccallback; + void onResponse(VoidPtr p, VoidPtr p1, VoidPtr p2) { + onComplete(completer, p, p1, p2); + ccallback.close(); + } + + ccallback = ffi.NativeCallable.listener(onResponse); + throwIfFailed(func(ccallback.nativeFunction)); + return completer.future; +} + +Future cvRunAsync4( + ffi.Pointer Function(cvg.CvCallback_4 callback) func, + void Function( + Completer completer, + VoidPtr p, + VoidPtr p1, + VoidPtr p2, + VoidPtr p3, + ) onComplete, +) { + final completer = Completer(); + late final NativeCallable ccallback; + void onResponse(VoidPtr p, VoidPtr p1, VoidPtr p2, VoidPtr p3) { + onComplete(completer, p, p1, p2, p3); + ccallback.close(); + } + + ccallback = ffi.NativeCallable.listener(onResponse); + throwIfFailed(func(ccallback.nativeFunction)); + return completer.future; +} + +Future cvRunAsync5( + ffi.Pointer Function(cvg.CvCallback_5 callback) func, + void Function( + Completer completer, + VoidPtr p, + VoidPtr p1, + VoidPtr p2, + VoidPtr p3, + VoidPtr p4, + ) onComplete, +) { + final completer = Completer(); + late final NativeCallable ccallback; + void onResponse(VoidPtr p, VoidPtr p1, VoidPtr p2, VoidPtr p3, VoidPtr p4) { + onComplete(completer, p, p1, p2, p3, p4); + ccallback.close(); + } + + ccallback = ffi.NativeCallable.listener(onResponse); + throwIfFailed(func(ccallback.nativeFunction)); + return completer.future; +} + +// 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); + completer.complete(value); +} + +void doubleCompleter(Completer completer, VoidPtr p) { + final value = p.cast().value; + calloc.free(p); + completer.complete(value); +} + +void floatCompleter(Completer completer, VoidPtr p) { + final value = p.cast().value; + calloc.free(p); + completer.complete(value); +} + +// Arena wrapper +R cvRunArena( + R Function(Arena arena) computation, [ + Allocator wrappedAllocator = calloc, + bool keep = false, +]) { final arena = Arena(wrappedAllocator); bool isAsync = false; try { @@ -94,12 +246,16 @@ R cvRunArena(R Function(Arena arena) computation, } } +// finalizers typedef NativeFinalizerFunctionT = ffi.Pointer>; -ffi.NativeFinalizer OcvFinalizer(NativeFinalizerFunctionT func) => +ffi.NativeFinalizer OcvFinalizer( + NativeFinalizerFunctionT func, +) => ffi.NativeFinalizer(func.cast()); +// native types typedef U8 = ffi.UnsignedChar; typedef I8 = ffi.Char; typedef U16 = ffi.UnsignedShort; @@ -109,43 +265,7 @@ typedef I32 = ffi.Int; typedef F32 = ffi.Float; typedef F64 = ffi.Double; +// others extension PointerCharExtension on ffi.Pointer { String toDartString() => cast().toDartString(); } - -enum ImageFormat { - // Windows bitmaps - *.bmp, *.dib (always supported) - bmp(ext: ".bmp"), - dib(ext: ".dib"), - // JPEG files - *.jpeg, *.jpg, *.jpe (see the Note section) - jpg(ext: ".jpg"), - jpeg(ext: ".jpeg"), - jpe(ext: ".jpe"), - // JPEG 2000 files - *.jp2 (see the Note section) - jp2(ext: ".jp2"), - // Portable Network Graphics - *.png (see the Note section) - png(ext: ".png"), - // WebP - *.webp (see the Note section) - webp(ext: ".webp"), - // Portable image format - *.pbm, *.pgm, *.ppm *.pxm, *.pnm (always supported) - pbm(ext: ".pbm"), - pgm(ext: ".pgm"), - ppm(ext: ".ppm"), - pxm(ext: ".pxm"), - pnm(ext: ".pnm"), - // Sun rasters - *.sr, *.ras (always supported) - sr(ext: ".sr"), - ras(ext: ".ras"), - // TIFF files - *.tiff, *.tif (see the Note section) - tiff(ext: ".tiff"), - tif(ext: ".tif"), - // OpenEXR Image files - *.exr (see the Note section) - exr(ext: ".exr"), - // Radiance HDR - *.hdr, *.pic (always supported) - hdr(ext: ".hdr"), - pic(ext: ".pic"); - // Raster and Vector geospatial data supported by GDAL (see the Note section) - - const ImageFormat({required this.ext}); - final String ext; -} diff --git a/lib/src/core/core.dart b/lib/src/core/core.dart index d9b0afa4..c6059703 100644 --- a/lib/src/core/core.dart +++ b/lib/src/core/core.dart @@ -43,11 +43,9 @@ String getBuildInformation() { /// For further details, please see: /// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga6fef31bc8c4071cbc114a758a2b79c14 Mat absDiff(Mat src1, Mat src2, [Mat? dst]) { - return cvRunArena((arena) { - dst ??= Mat.empty(); - cvRun(() => CFFI.Mat_AbsDiff(src1.ref, src2.ref, dst!.ref)); - return dst!; - }); + dst ??= Mat.empty(); + cvRun(() => CFFI.Mat_AbsDiff(src1.ref, src2.ref, dst!.ref)); + return dst; } /// Add calculates the per-element sum of two arrays or an array and a scalar. @@ -55,11 +53,9 @@ Mat absDiff(Mat src1, Mat src2, [Mat? dst]) { /// For further details, please see: /// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga10ac1bfb180e2cfda1701d06c24fdbd6 Mat add(Mat src1, Mat src2, [Mat? dst]) { - return cvRunArena((arena) { - dst ??= Mat.empty(); - cvRun(() => CFFI.Mat_Add(src1.ref, src2.ref, dst!.ref)); - return dst!; - }); + dst ??= Mat.empty(); + cvRun(() => CFFI.Mat_Add(src1.ref, src2.ref, dst!.ref)); + return dst; } /// AddWeighted calculates the weighted sum of two arrays. @@ -206,11 +202,11 @@ Mat bitwiseXOR( /// For further details, please see: /// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga247f571aa6244827d3d798f13892da58 int borderInterpolate(int p, int len, int borderType) { - return cvRunArena((arena) { - final ptr = arena(); - cvRun(() => CFFI.Mat_BorderInterpolate(p, len, borderType, ptr)); - return ptr.value; - }); + final ptr = calloc(); + cvRun(() => CFFI.Mat_BorderInterpolate(p, len, borderType, ptr)); + final v = ptr.value; + calloc.free(ptr); + return v; } /// CalcCovarMatrix calculates the covariance matrix of a set of vectors. @@ -665,7 +661,7 @@ Mat insertChannel(InputArray src, InputOutputArray dst, int coi) { InputArray data, int K, InputOutputArray bestLabels, - TermCriteria criteria, + (int, int, double) criteria, int attempts, int flags, { OutputArray? centers, @@ -678,7 +674,7 @@ Mat insertChannel(InputArray src, InputOutputArray dst, int coi) { data.ref, K, bestLabels.ref, - criteria.toNativePtr(arena).ref, + TermCriteria.fromRecord(criteria).ref, attempts, flags, centers!.ref, @@ -698,7 +694,7 @@ Mat insertChannel(InputArray src, InputOutputArray dst, int coi) { VecPoint2f pts, int K, InputOutputArray bestLabels, - TermCriteria criteria, + (int, int, double) criteria, int attempts, int flags, { OutputArray? centers, @@ -711,7 +707,7 @@ Mat insertChannel(InputArray src, InputOutputArray dst, int coi) { pts.ref, K, bestLabels.ref, - criteria.toNativePtr(arena).ref, + TermCriteria.fromRecord(criteria).ref, attempts, flags, centers!.ref, @@ -785,14 +781,12 @@ Mat max(InputArray src1, InputArray src2, {OutputArray? dst}) { /// For further details, please see: /// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga846c858f4004d59493d7c6a4354b301d (Scalar mean, Scalar stddev) meanStdDev(InputArray src, {InputArray? mask}) { - return cvRunArena<(Scalar, Scalar)>((arena) { - final mean = calloc(); - final stddev = calloc(); - mask == null - ? cvRun(() => CFFI.Mat_MeanStdDev(src.ref, mean, stddev)) - : cvRun(() => CFFI.Mat_MeanStdDevWithMask(src.ref, mean, stddev, mask.ref)); - return (Scalar.fromPointer(mean), Scalar.fromPointer(stddev)); - }); + final mean = calloc(); + final stddev = calloc(); + mask == null + ? cvRun(() => CFFI.Mat_MeanStdDev(src.ref, mean, stddev)) + : cvRun(() => CFFI.Mat_MeanStdDevWithMask(src.ref, mean, stddev, mask.ref)); + return (Scalar.fromPointer(mean), Scalar.fromPointer(stddev)); } /// Merge creates one multi-channel array out of several single-channel ones. @@ -853,10 +847,8 @@ Mat min(InputArray src1, InputArray src2, {OutputArray? dst}) { /// For further details, please see: /// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga51d768c270a1cdd3497255017c4504be VecMat mixChannels(VecMat src, VecMat dst, VecInt fromTo) { - return cvRunArena((arena) { - cvRun(() => CFFI.Mat_MixChannels(src.ref, dst.ref, fromTo.ref)); - return dst; - }); + cvRun(() => CFFI.Mat_MixChannels(src.ref, dst.ref, fromTo.ref)); + return dst; } /// Mulspectrums performs the per-element multiplication of two Fourier spectrums. @@ -1119,11 +1111,9 @@ Mat subtract( /// For further details, please see: /// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga3419ac19c7dcd2be4bd552a23e147dd8 Scalar trace(InputArray mtx) { - return cvRunArena((arena) { - final ptr = calloc(); - cvRun(() => CFFI.Mat_Trace(mtx.ref, ptr)); - return Scalar.fromPointer(ptr); - }); + final ptr = calloc(); + cvRun(() => CFFI.Mat_Trace(mtx.ref, ptr)); + return Scalar.fromPointer(ptr); } /// Transform performs the matrix transformation of every array element. diff --git a/lib/src/core/core_async.dart b/lib/src/core/core_async.dart new file mode 100644 index 00000000..0588c3c5 --- /dev/null +++ b/lib/src/core/core_async.dart @@ -0,0 +1,1029 @@ +// ignore_for_file: non_constant_identifier_names + +library cv; + +import 'dart:ffi' as ffi; + +import 'package:ffi/ffi.dart'; + +import '../constants.g.dart'; +import '../opencv.g.dart' as cvg; +import 'base.dart'; +import 'mat.dart'; +import 'mat_type.dart'; +import 'point.dart'; +import 'rng.dart'; +import 'scalar.dart'; +import 'termcriteria.dart'; +import 'vec.dart'; + +/// get version +Future openCvVersionAsync() async => cvRunAsync(CFFI.openCVVersion_Async, (c, p) { + final s = p.cast>().value.toDartString(); + calloc.free(p); + c.complete(s); + }); + +/// Returns full configuration time cmake output. +/// +/// Returned value is raw cmake output including version control system revision, compiler version, compiler flags, enabled modules and third party libraries, etc. Output format depends on target architecture. +Future getBuildInformationAsync() async => cvRunAsync(CFFI.getBuildInfo_Async, (c, p) { + final s = p.cast>().value.toDartString(); + calloc.free(p); + c.complete(s); + }); + +/// AbsDiff calculates the per-element absolute difference between two arrays +/// or between an array and a scalar. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga6fef31bc8c4071cbc114a758a2b79c14 +Future absDiffAsync(Mat src1, Mat src2) async => cvRunAsync( + (callback) => CFFI.core_AbsDiff_Async(src1.ref, src2.ref, callback), + matCompleter, + ); + +/// Add calculates the per-element sum of two arrays or an array and a scalar. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga10ac1bfb180e2cfda1701d06c24fdbd6 +Future addAsync(Mat src1, Mat src2, {Mat? mask, int dtype = -1}) async => cvRunAsync( + (callback) => CFFI.core_Add_Async(src1.ref, src2.ref, mask?.ref ?? Mat.empty().ref, dtype, callback), + matCompleter, + ); + +/// AddWeighted calculates the weighted sum of two arrays. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#gafafb2513349db3bcff51f54ee5592a19 +Future addWeightedAsync( + InputArray src1, + double alpha, + InputArray src2, + double beta, + double gamma, { + int dtype = -1, +}) async => + cvRunAsync( + (callback) => CFFI.core_AddWeighted_Async(src1.ref, alpha, src2.ref, beta, gamma, dtype, callback), + matCompleter, + ); + +/// BitwiseAnd computes bitwise conjunction of the two arrays (dst = src1 & src2). +/// Calculates the per-element bit-wise conjunction of two arrays +/// or an array and a scalar. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga60b4d04b251ba5eb1392c34425497e14 +Future bitwiseANDAsync( + InputArray src1, + InputArray src2, { + InputArray? mask, +}) async => + cvRunAsync( + (callback) => mask == null + ? CFFI.core_BitwiseAnd_Async(src1.ref, src2.ref, callback) + : CFFI.core_BitwiseAndWithMask_Async(src1.ref, src2.ref, mask.ref, callback), + matCompleter, + ); + +/// BitwiseNot inverts every bit of an array. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga0002cf8b418479f4cb49a75442baee2f +Future bitwiseNOTAsync(InputArray src, {InputArray? mask}) async => cvRunAsync( + (callback) => mask == null + ? CFFI.core_BitwiseNot_Async(src.ref, callback) + : CFFI.core_BitwiseNotWithMask_Async(src.ref, mask.ref, callback), + matCompleter, + ); + +/// BitwiseOr calculates the per-element bit-wise disjunction of two arrays +/// or an array and a scalar. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#gab85523db362a4e26ff0c703793a719b4 +Future bitwiseORAsync(InputArray src1, InputArray src2, {InputArray? mask}) async => cvRunAsync( + (callback) => mask == null + ? CFFI.core_BitwiseOr_Async(src1.ref, src2.ref, callback) + : CFFI.core_BitwiseOrWithMask_Async(src1.ref, src2.ref, mask.ref, callback), + matCompleter, + ); + +/// BitwiseXor calculates the per-element bit-wise "exclusive or" operation +/// on two arrays or an array and a scalar. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga84b2d8188ce506593dcc3f8cd00e8e2c +Future bitwiseXORAsync(InputArray src1, InputArray src2, {InputArray? mask}) async => cvRunAsync( + (callback) => mask == null + ? CFFI.core_BitwiseXor_Async(src1.ref, src2.ref, callback) + : CFFI.core_BitwiseXorWithMask_Async(src1.ref, src2.ref, mask.ref, callback), + matCompleter, + ); + +/// BatchDistance is a naive nearest neighbor finder. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga4ba778a1c57f83233b1d851c83f5a622 +Future<(Mat dist, Mat nidx)> batchDistanceAsync( + InputArray src1, + InputArray src2, + int dtype, { + int normType = NORM_L2, + int K = 0, + InputArray? mask, + int update = 0, + bool crosscheck = false, +}) async => + cvRunAsync2<(Mat, Mat)>( + (callback) => CFFI.core_BatchDistance_Async( + src1.ref, + src2.ref, + dtype, + normType, + K, + mask?.ref ?? Mat.empty().ref, + update, + crosscheck, + callback, + ), + matCompleter2, + ); + +/// BorderInterpolate computes the source location of an extrapolated pixel. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga247f571aa6244827d3d798f13892da58 +Future borderInterpolateAsync(int p, int len, int borderType) async => cvRunAsync( + (callback) => CFFI.core_BorderInterpolate_Async(p, len, borderType, callback), + intCompleter, + ); + +/// CalcCovarMatrix calculates the covariance matrix of a set of vectors. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga017122d912af19d7d0d2cccc2d63819f +Future<(Mat covar, Mat mean)> calcCovarMatrixAsync( + InputArray samples, + InputOutputArray mean, + int flags, { + int ctype = MatType.CV_64F, +}) async => + cvRunAsync<(Mat, Mat)>( + (callback) => CFFI.core_CalcCovarMatrix_Async( + samples.ref, + mean.ref, + flags, + ctype, + callback, + ), + (c, p) => c.complete((Mat.fromPointer(p.cast()), mean)), + ); + +/// CartToPolar calculates the magnitude and angle of 2D vectors. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#gac5f92f48ec32cacf5275969c33ee837d +Future<(Mat magnitude, Mat angle)> cartToPolarAsync( + InputArray x, + InputArray y, { + bool angleInDegrees = false, +}) async => + cvRunAsync2<(Mat, Mat)>( + (callback) => CFFI.core_CartToPolar_Async( + x.ref, + y.ref, + angleInDegrees, + callback, + ), + matCompleter2, + ); + +/// CheckRange checks every element of an input array for invalid values. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga2bd19d89cae59361416736f87e3c7a64 +Future<(bool, Point)> checkRangeAsync( + InputArray a, { + bool quiet = true, + double minVal = -CV_F64_MAX, + double maxVal = CV_F64_MAX, +}) async => + cvRunAsync2((callback) => CFFI.core_CheckRange_Async(a.ref, quiet, minVal, maxVal, callback), + (completer, p, p1) { + final rval = p.cast().value; + calloc.free(p); + completer.complete((rval, Point.fromPointer(p1.cast()))); + }); + +/// Compare performs the per-element comparison of two arrays +/// or an array and scalar value. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga303cfb72acf8cbb36d884650c09a3a97 +Future compareAsync(InputArray src1, InputArray src2, int cmpop) async => + cvRunAsync((callback) => CFFI.core_Compare_Async(src1.ref, src2.ref, cmpop, callback), matCompleter); + +/// CountNonZero counts non-zero array elements. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#gaa4b89393263bb4d604e0fe5986723914 +Future countNonZeroAsync(Mat src) async => + cvRunAsync((callback) => CFFI.core_CountNonZero_Async(src.ref, callback), intCompleter); + +/// CompleteSymm copies the lower or the upper half of a square matrix to its another half. +/// +/// For further details, please see: +/// https://docs.opencv.org/4.x/d2/de8/group__core__array.html#ga6847337c0c55769e115a70e0f011b5ca +Future completeSymmAsync(InputOutputArray m, {bool lowerToUpper = false}) async => cvRunAsync0( + (callback) => CFFI.core_CompleteSymm_Async(m.ref, lowerToUpper, callback), + (c) => c.complete(m), + ); + +/// ConvertScaleAbs scales, calculates absolute values, and converts the result to 8-bit. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga3460e9c9f37b563ab9dd550c4d8c4e7d +Future convertScaleAbsAsync( + InputArray src, { + double alpha = 1, + double beta = 0, +}) async => + cvRunAsync((callback) => CFFI.core_ConvertScaleAbs_Async(src.ref, alpha, beta, callback), matCompleter); + +/// CopyMakeBorder forms a border around an image (applies padding). +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga2ac1049c2c3dd25c2b41bffe17658a36 +Future copyMakeBorderAsync( + InputArray src, + int top, + int bottom, + int left, + int right, + int borderType, { + Scalar? value, +}) async => + cvRunAsync( + (callback) => CFFI.core_CopyMakeBorder_Async( + src.ref, + top, + bottom, + left, + right, + borderType, + value?.ref ?? Scalar.default_().ref, + callback, + ), + matCompleter, + ); + +/// DCT performs a forward or inverse discrete Cosine transform of 1D or 2D array. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga85aad4d668c01fbd64825f589e3696d4 +Future dctAsync(InputArray src, {int flags = 0}) async => + cvRunAsync((callback) => CFFI.core_DCT_Async(src.ref, flags, callback), matCompleter); + +/// Determinant returns the determinant of a square floating-point matrix. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#gaf802bd9ca3e07b8b6170645ef0611d0c +Future determinantAsync(InputArray mtx) async => + cvRunAsync((callback) => CFFI.core_Determinant_Async(mtx.ref, callback), doubleCompleter); + +/// DFT performs a forward or inverse Discrete Fourier Transform (DFT) +/// of a 1D or 2D floating-point array. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#gadd6cf9baf2b8b704a11b5f04aaf4f39d +Future dftAsync( + InputArray src, { + int flags = 0, + int nonzeroRows = 0, +}) async => + cvRunAsync((callback) => CFFI.core_DFT_Async(src.ref, flags, nonzeroRows, callback), matCompleter); + +/// Divide performs the per-element division +/// on two arrays or an array and a scalar. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga6db555d30115642fedae0cda05604874 +Future divideAsync( + InputArray src1, + InputArray src2, { + double scale = 1, + int dtype = -1, +}) async => + cvRunAsync( + (callback) => CFFI.core_Divide_Async(src1.ref, src2.ref, scale, dtype, callback), + matCompleter, + ); + +/// Eigen calculates eigenvalues and eigenvectors of a symmetric matrix. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga9fa0d58657f60eaa6c71f6fbb40456e3 +Future<(bool ret, Mat eigenvalues, Mat eigenvectors)> eigenAsync(InputArray src) async => + cvRunAsync3((callback) => CFFI.core_Eigen_Async(src.ref, callback), (completer, p, p1, p2) { + final rval = p.cast().value; + calloc.free(p); + completer.complete((rval, Mat.fromPointer(p1.cast()), Mat.fromPointer(p2.cast()))); + }); + +/// EigenNonSymmetric calculates eigenvalues and eigenvectors of a non-symmetric matrix (real eigenvalues only). +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#gaf51987e03cac8d171fbd2b327cf966f6 +Future<(Mat eigenvalues, Mat eigenvectors)> eigenNonSymmetricAsync(InputArray src) async => cvRunAsync2( + (callback) => CFFI.core_EigenNonSymmetric_Async(src.ref, callback), + matCompleter2, + ); + +Future<(Mat mean, Mat result)> PCABackProjectAsync(Mat src, Mat mean, Mat eigenVectors) async => cvRunAsync( + (callback) => CFFI.core_PCABackProject_Async(src.ref, mean.ref, eigenVectors.ref, callback), + (completer, p) => completer.complete((mean, Mat.fromPointer(p.cast()))), + ); + +/// PCACompute performs PCA. +/// +/// The computed eigenvalues are sorted from the largest to the smallest and the corresponding +/// eigenvectors are stored as eigenvectors rows. +/// +/// Note: Calling with maxComponents == 0 (opencv default) will cause all components to be retained. +/// +/// For further details, please see: +/// https://docs.opencv.org/4.x/d2/de8/group__core__array.html#ga27a565b31d820b05dcbcd47112176b6e +Future<(Mat mean, Mat eigenvalues, Mat eigenvectors)> PCAComputeAsync( + InputArray data, + InputOutputArray mean, { + int maxComponents = 0, +}) async => + cvRunAsync2((callback) => CFFI.core_PCACompute_Async(data.ref, mean.ref, maxComponents, callback), + (completer, p, p1) { + completer.complete( + ( + mean, + Mat.fromPointer(p.cast()), + Mat.fromPointer(p1.cast()), + ), + ); + }); + +Future<(Mat mean, Mat eigenvectors)> PCACompute1Async( + InputArray data, + InputOutputArray mean, { + int maxComponents = 0, +}) async => + cvRunAsync( + (callback) => CFFI.core_PCACompute_1_Async(data.ref, mean.ref, maxComponents, callback), + (completer, p) => completer.complete((mean, Mat.fromPointer(p.cast()))), + ); + +Future<(Mat mean, Mat eigenvectors)> PCACompute2Async( + InputArray data, + InputOutputArray mean, { + double retainedVariance = 0, +}) async => + cvRunAsync( + (callback) => CFFI.core_PCACompute_3_Async(data.ref, mean.ref, retainedVariance, callback), + (completer, p) => completer.complete((mean, Mat.fromPointer(p.cast()))), + ); + +Future<(Mat mean, Mat eigenvalues, Mat eigenvectors)> PCACompute3Async( + InputArray data, + InputOutputArray mean, { + double retainedVariance = 0, +}) async => + cvRunAsync2( + (callback) => CFFI.core_PCACompute_2_Async(data.ref, mean.ref, retainedVariance, callback), + (completer, p, p1) => + completer.complete((mean, Mat.fromPointer(p.cast()), Mat.fromPointer(p1.cast()))), + ); + +Future<(Mat mean, Mat result)> PCAProjectAsync(InputArray src, InputArray mean, InputArray eigenVectors) => + cvRunAsync((callback) => CFFI.core_PCAProject_Async(src.ref, mean.ref, eigenVectors.ref, callback), + (completer, p) { + completer.complete((mean, Mat.fromPointer(p.cast()))); + }); + +/// Exp calculates the exponent of every array element. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga3e10108e2162c338f1b848af619f39e5 +Future expAsync(InputArray src) async => + cvRunAsync((callback) => CFFI.core_Exp_Async(src.ref, callback), matCompleter); + +/// ExtractChannel extracts a single channel from src (coi is 0-based index). +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#gacc6158574aa1f0281878c955bcf35642 +Future extractChannelAsync(InputArray src, int coi) async => + cvRunAsync((callback) => CFFI.core_ExtractChannel_Async(src.ref, coi, callback), matCompleter); + +/// FindNonZero returns the list of locations of non-zero pixels. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#gaed7df59a3539b4cc0fe5c9c8d7586190 +Future findNonZeroAsync(InputArray src) async => + cvRunAsync((callback) => CFFI.core_FindNonZero_Async(src.ref, callback), matCompleter); + +/// Flip flips a 2D array around horizontal(0), vertical(1), or both axes(-1). +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#gaca7be533e3dac7feb70fc60635adf441 +Future flipAsync(InputArray src, int flipCode) async => + cvRunAsync((callback) => CFFI.core_Flip_Async(src.ref, flipCode, callback), matCompleter); + +/// Gemm performs generalized matrix multiplication. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#gacb6e64071dffe36434e1e7ee79e7cb35 +Future gemmAsync( + InputArray src1, + InputArray src2, + double alpha, + InputArray src3, + double beta, { + int flags = 0, +}) async => + cvRunAsync( + (callback) => CFFI.core_Gemm_Async(src1.ref, src2.ref, alpha, src3.ref, beta, flags, callback), + matCompleter, + ); + +/// GetOptimalDFTSize returns the optimal Discrete Fourier Transform (DFT) size +/// for a given vector size. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga6577a2e59968936ae02eb2edde5de299 +Future getOptimalDFTSizeAsync(int vecsize) async => + cvRunAsync((callback) => CFFI.core_GetOptimalDFTSize_Async(vecsize, callback), intCompleter); + +/// Hconcat applies horizontal concatenation to given matrices. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#gaab5ceee39e0580f879df645a872c6bf7 +Future hconcatAsync(InputArray src1, InputArray src2) async => + cvRunAsync((callback) => CFFI.core_Hconcat_Async(src1.ref, src2.ref, callback), matCompleter); + +/// Vconcat applies vertical concatenation to given matrices. +/// +/// For further details, please see: +/// https://docs.opencv.org/4.x/d2/de8/group__core__array.html#gaad07cede730cdde64b90e987aad179b8 +Future vconcatAsync(InputArray src1, InputArray src2) async => + cvRunAsync((callback) => CFFI.core_Vconcat_Async(src1.ref, src2.ref, callback), matCompleter); + +/// Rotate rotates a 2D array in multiples of 90 degrees +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga4ad01c0978b0ce64baa246811deeac24 +Future rotateAsync(InputArray src, int rotateCode) async => + cvRunAsync((callback) => CFFI.core_Rotate_Async(src.ref, rotateCode, callback), matCompleter); + +/// IDCT calculates the inverse Discrete Cosine Transform of a 1D or 2D array. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga77b168d84e564c50228b69730a227ef2 +Future idctAsync( + InputArray src, { + int flags = 0, +}) async => + cvRunAsync((callback) => CFFI.core_Idct_Async(src.ref, flags, callback), matCompleter); + +/// IDFT calculates the inverse Discrete Fourier Transform of a 1D or 2D array. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#gaa708aa2d2e57a508f968eb0f69aa5ff1 +Future idftAsync( + InputArray src, { + int flags = 0, + int nonzeroRows = 0, +}) async => + cvRunAsync((callback) => CFFI.core_Idft_Async(src.ref, flags, nonzeroRows, callback), matCompleter); + +/// InRange checks if array elements lie between the elements of two Mat arrays. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga48af0ab51e36436c5d04340e036ce981 +Future inRangeAsync( + InputArray src, + InputArray lowerb, + InputArray upperb, +) async => + cvRunAsync( + (callback) => CFFI.core_InRange_Async(src.ref, lowerb.ref, upperb.ref, callback), + matCompleter, + ); + +/// InRangeWithScalar checks if array elements lie between the elements of two Scalars +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga48af0ab51e36436c5d04340e036ce981 +Future inRangebyScalarAsync( + InputArray src, + Scalar lowerb, + Scalar upperb, +) async => + cvRunAsync( + (callback) => CFFI.core_InRangeWithScalar_Async(src.ref, lowerb.ref, upperb.ref, callback), + matCompleter, + ); + +/// InsertChannel inserts a single channel to dst (coi is 0-based index) +/// (it replaces channel i with another in dst). +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga1d4bd886d35b00ec0b764cb4ce6eb515 +Future insertChannelAsync(InputArray src, InputOutputArray dst, int coi) async => cvRunAsync0( + (callback) => CFFI.core_InsertChannel_Async(src.ref, dst.ref, coi, callback), + (c) => c.complete(dst), + ); + +/// Invert finds the inverse or pseudo-inverse of a matrix. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#gad278044679d4ecf20f7622cc151aaaa2 +Future<(double rval, Mat dst)> invertAsync( + InputArray src, { + int flags = DECOMP_LU, +}) async => + cvRunAsync2<(double, Mat)>((callback) => CFFI.core_Invert_Async(src.ref, flags, callback), (c, p, p1) { + final rval = p.cast().value; + calloc.free(p); + c.complete((rval, Mat.fromPointer(p1.cast()))); + }); + +/// KMeans finds centers of clusters and groups input samples around the clusters. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d5/d38/group__core__cluster.html#ga9a34dc06c6ec9460e90860f15bcd2f88 +Future<(double rval, Mat bestLabels, Mat centers)> kmeansAsync( + InputArray data, + int K, + InputOutputArray bestLabels, + (int, int, double) criteria, + int attempts, + int flags, +) async => + cvRunAsync2( + (callback) => + CFFI.core_KMeans_Async(data.ref, K, bestLabels.ref, criteria.cvd.ref, attempts, flags, callback), + (completer, p, p1) { + final rval = p.cast().value; + calloc.free(p); + completer.complete((rval, bestLabels, Mat.fromPointer(p1.cast()))); + }); + +/// KMeansPoints finds centers of clusters and groups input samples around the clusters. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d5/d38/group__core__cluster.html#ga9a34dc06c6ec9460e90860f15bcd2f88 +Future<(double rval, Mat bestLabels, Mat centers)> kmeansByPointsAsync( + VecPoint2f pts, + int K, + InputOutputArray bestLabels, + (int, int, double) criteria, + int attempts, + int flags, +) async => + cvRunAsync2( + (callback) => CFFI.core_KMeans_Points_Async( + pts.ref, + K, + bestLabels.ref, + criteria.cvd.ref, + attempts, + flags, + callback, + ), (completer, p, p1) { + final rval = p.cast().value; + calloc.free(p); + completer.complete((rval, bestLabels, Mat.fromPointer(p1.cast()))); + }); + +/// Log calculates the natural logarithm of every array element. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga937ecdce4679a77168730830a955bea7 +Future logAsync(InputArray src) async => + cvRunAsync((callback) => CFFI.core_Log_Async(src.ref, callback), matCompleter); + +/// Performs a look-up table transform of an array. Support CV_8U, CV_8S, CV_16U, CV_16S +/// +/// The function LUT fills the output array with values from the look-up table. Indices of the entries +/// are taken from the input array. That is, the function processes each element of src as follows: +/// +/// $\texttt{dst} (I) \leftarrow \texttt{lut(src(I) + d)}$ +/// +/// where +/// +/// $d = \fork{0}{if \(\texttt{src}\) has depth \(\texttt{CV_8U}\)}{128}{if \(\texttt{src}\) has depth \(\texttt{CV_8S}\)}$ +/// +/// [src] input array of 8-bit elements. +/// [lut] look-up table of 256 elements; in case of multi-channel input array, the table should +/// either have a single channel (in this case the same table is used for all channels) or the same +/// number of channels as in the input array. +/// +/// https://docs.opencv.org/4.x/d2/de8/group__core__array.html#gab55b8d062b7f5587720ede032d34156f +Future LUTAsync(InputArray src, InputArray lut) async => + cvRunAsync((callback) => CFFI.core_LUT_Async(src.ref, lut.ref, callback), matCompleter); + +/// Magnitude calculates the magnitude of 2D vectors. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga6d3b097586bca4409873d64a90fe64c3 +Future magnitudeAsync(InputArray x, InputArray y) async => + cvRunAsync((callback) => CFFI.core_Magnitude_Async(x.ref, y.ref, callback), matCompleter); + +/// Max calculates per-element maximum of two arrays or an array and a scalar. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#gacc40fa15eac0fb83f8ca70b7cc0b588d +Future maxAsync(InputArray src1, InputArray src2) async => + cvRunAsync((callback) => CFFI.core_Max_Async(src1.ref, src2.ref, callback), matCompleter); + +/// MeanStdDev calculates a mean and standard deviation of array elements. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga846c858f4004d59493d7c6a4354b301d +Future<(Scalar mean, Scalar stddev)> meanStdDevAsync(InputArray src, {InputArray? mask}) async => cvRunAsync2( + (callback) => mask == null + ? CFFI.core_MeanStdDev_Async(src.ref, callback) + : CFFI.core_MeanStdDevWithMask_Async(src.ref, mask.ref, callback), + (c, p, p1) => + c.complete((Scalar.fromPointer(p.cast()), Scalar.fromPointer(p1.cast()))), + ); + +/// Merge creates one multi-channel array out of several single-channel ones. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga7d7b4d6c6ee504b30a20b1680029c7b4 +Future mergeAsync(VecMat mv) async => + cvRunAsync((callback) => CFFI.core_Merge_Async(mv.ref, callback), matCompleter); + +/// Min calculates per-element minimum of two arrays or an array and a scalar. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga9af368f182ee76d0463d0d8d5330b764 +Future minAsync(InputArray src1, InputArray src2) async => + cvRunAsync((callback) => CFFI.core_Min_Async(src1.ref, src2.ref, callback), matCompleter); + +/// MinMaxIdx finds the global minimum and maximum in an array. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga7622c466c628a75d9ed008b42250a73f +Future<(double minVal, double maxVal, int minIdx, int maxIdx)> minMaxIdxAsync( + InputArray src, { + InputArray? mask, +}) async => + cvRunAsync4( + (callback) => mask == null + ? CFFI.core_MinMaxIdx_Async(src.ref, callback) + : CFFI.core_MinMaxIdx_Mask_Async(src.ref, mask.ref, callback), (c, p, p1, p2, p3) { + final minv = p.cast().value; + calloc.free(p); + final maxv = p1.cast().value; + calloc.free(p1); + final mini = p2.cast().value; + calloc.free(p2); + final maxi = p3.cast().value; + calloc.free(p3); + c.complete((minv, maxv, mini, maxi)); + }); + +/// MinMaxLoc finds the global minimum and maximum in an array. +/// +/// For further details, please see: +/// https://docs.opencv.org/trunk/d2/de8/group__core__array.html#gab473bf2eb6d14ff97e89b355dac20707 +Future<(double minVal, double maxVal, Point minLoc, Point maxLoc)> minMaxLocAsync( + InputArray src, { + InputArray? mask, +}) async => + cvRunAsync4( + (callback) => mask == null + ? CFFI.core_MinMaxLoc_Async(src.ref, callback) + : CFFI.core_MinMaxLoc_Mask_Async(src.ref, mask.ref, callback), (c, p, p1, p2, p3) { + final minv = p.cast().value; + calloc.free(p); + final maxv = p1.cast().value; + calloc.free(p1); + c.complete((minv, maxv, Point.fromPointer(p2.cast()), Point.fromPointer(p3.cast()))); + }); + +/// Copies specified channels from input arrays to the specified channels of output arrays. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga51d768c270a1cdd3497255017c4504be +Future mixChannelsAsync(VecMat src, VecMat dst, VecInt fromTo) async => cvRunAsync0( + (callback) => CFFI.core_MixChannels_Async(src.ref, dst.ref, fromTo.ref, callback), + (c) => c.complete(dst), + ); + +/// Mulspectrums performs the per-element multiplication of two Fourier spectrums. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga3ab38646463c59bf0ce962a9d51db64f +Future mulSpectrumsAsync( + InputArray a, + InputArray b, + int flags, { + bool conjB = false, +}) async => + cvRunAsync( + (callback) => CFFI.core_MulSpectrums_Async(a.ref, b.ref, flags, conjB, callback), + matCompleter, + ); + +/// Multiply calculates the per-element scaled product of two arrays. +/// Both input arrays must be of the same size and the same type. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga979d898a58d7f61c53003e162e7ad89f +Future multiplyAsync( + InputArray src1, + InputArray src2, { + double scale = 1, + int dtype = -1, +}) async => + cvRunAsync( + (callback) => CFFI.core_MultiplyWithParams_Async(src1.ref, src2.ref, scale, dtype, callback), + matCompleter, + ); + +/// Normalize normalizes the norm or value range of an array. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga87eef7ee3970f86906d69a92cbf064bd +Future normalizeAsync( + InputArray src, + InputOutputArray dst, { + double alpha = 1, + double beta = 0, + int normType = NORM_L2, + int dtype = -1, + InputArray? mask, +}) async => + cvRunAsync0( + (callback) => mask == null + ? CFFI.core_Normalize_Async(src.ref, dst.ref, alpha, beta, normType, dtype, callback) + : CFFI.core_Normalize_Mask_Async( + src.ref, + dst.ref, + alpha, + beta, + normType, + dtype, + mask.ref, + callback, + ), + (c) => c.complete(dst), + ); + +/// Norm calculates the absolute norm of an array. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga7c331fb8dd951707e184ef4e3f21dd33 +Future normAsync( + InputArray src1, { + int normType = NORM_L2, + InputArray? mask, +}) async => + cvRunAsync( + (callback) => mask == null + ? CFFI.core_Norm_Async(src1.ref, normType, callback) + : CFFI.core_Norm_Mask_Async(src1.ref, normType, mask.ref, callback), + doubleCompleter, + ); + +/// Norm calculates the absolute difference/relative norm of two arrays. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga7c331fb8dd951707e184ef4e3f21dd33 +Future norm1Async( + InputArray src1, + InputArray src2, { + int normType = NORM_L2, + // InputArray? mask, +}) async => + cvRunAsync( + (callback) => CFFI.core_NormWithMats_Async(src1.ref, src2.ref, normType, callback), + doubleCompleter, + ); + +/// PerspectiveTransform performs the perspective matrix transformation of vectors. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#gad327659ac03e5fd6894b90025e6900a7 +Future perspectiveTransformAsync(InputArray src, InputArray m) async => + cvRunAsync((callback) => CFFI.core_PerspectiveTransform_Async(src.ref, m.ref, callback), matCompleter); + +/// Solve solves one or more linear systems or least-squares problems. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga12b43690dbd31fed96f213eefead2373 +Future<(bool ret, Mat dst)> solveAsync( + InputArray src1, + InputArray src2, { + int flags = DECOMP_LU, +}) async => + cvRunAsync2((callback) => CFFI.core_Solve_Async(src1.ref, src2.ref, flags, callback), (c, p, p1) { + final rval = p.cast().value; + calloc.free(p); + c.complete((rval, Mat.fromPointer(p1.cast()))); + }); + +/// SolveCubic finds the real roots of a cubic equation. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga1c3b0b925b085b6e96931ee309e6a1da +Future<(int rval, Mat roots)> solveCubicAsync(InputArray coeffs) async => + cvRunAsync2((callback) => CFFI.core_SolveCubic_Async(coeffs.ref, callback), (c, p, p1) { + final rval = p.cast().value; + calloc.free(p); + c.complete((rval, Mat.fromPointer(p1.cast()))); + }); + +/// SolvePoly finds the real or complex roots of a polynomial equation. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#gac2f5e953016fabcdf793d762f4ec5dce +Future<(double rval, Mat roots)> solvePolyAsync( + InputArray coeffs, { + int maxIters = 300, +}) async => + cvRunAsync2((callback) => CFFI.core_SolvePoly_Async(coeffs.ref, maxIters, callback), (c, p, p1) { + final rval = p.cast().value; + calloc.free(p); + c.complete((rval, Mat.fromPointer(p1.cast()))); + }); + +/// Reduce reduces a matrix to a vector. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga4b78072a303f29d9031d56e5638da78e +Future reduceAsync(InputArray src, int dim, int rtype, {int dtype = -1}) async => + cvRunAsync((callback) => CFFI.core_Reduce_Async(src.ref, dim, rtype, dtype, callback), matCompleter); + +/// Finds indices of max elements along provided axis. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#gaa87ea34d99bcc5bf9695048355163da0 +Future reduceArgMaxAsync(InputArray src, int axis, {bool lastIndex = false}) async => + cvRunAsync((callback) => CFFI.core_ReduceArgMax_Async(src.ref, axis, lastIndex, callback), matCompleter); + +/// Finds indices of min elements along provided axis. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#gaeecd548276bfb91b938989e66b722088 +Future reduceArgMinAsync(InputArray src, int axis, {bool lastIndex = false}) async => + cvRunAsync((callback) => CFFI.core_ReduceArgMin_Async(src.ref, axis, lastIndex, callback), matCompleter); + +/// Repeat fills the output array with repeated copies of the input array. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga496c3860f3ac44c40b48811333cfda2d +Future repeatAsync(InputArray src, int ny, int nx) async => + cvRunAsync((callback) => CFFI.core_Repeat_Async(src.ref, ny, nx, callback), matCompleter); + +/// Calculates the sum of a scaled array and another array. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga9e0845db4135f55dcf20227402f00d98 +Future scaleAddAsync(InputArray src1, double alpha, InputArray src2) async => + cvRunAsync((callback) => CFFI.core_ScaleAdd_Async(src1.ref, alpha, src2.ref, callback), matCompleter); + +/// SetIdentity initializes a scaled identity matrix. +/// For further details, please see: +/// +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga388d7575224a4a277ceb98ccaa327c99 +Future setIdentityAsync(InputOutputArray mtx, {Scalar? s}) async => cvRunAsync0( + (callback) => CFFI.core_SetIdentity_Async(mtx.ref, s?.ref ?? Scalar.all(1).ref, callback), + (c) => c.complete(mtx), + ); + +/// Sort sorts each row or each column of a matrix. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga45dd56da289494ce874be2324856898f +Future sortAsync(InputArray src, int flags) async => + cvRunAsync((callback) => CFFI.core_Sort_Async(src.ref, flags, callback), matCompleter); + +/// SortIdx sorts each row or each column of a matrix. +/// Instead of reordering the elements themselves, it stores the indices of sorted elements in the output array +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#gadf35157cbf97f3cb85a545380e383506 +Future sortIdxAsync(InputArray src, int flags) async => + cvRunAsync((callback) => CFFI.core_SortIdx_Async(src.ref, flags, callback), matCompleter); + +/// Split creates an array of single channel images from a multi-channel image +/// Created images should be closed manualy to avoid memory leaks. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga0547c7fed86152d7e9d0096029c8518a +Future splitAsync(InputArray m) async => cvRunAsync( + (callback) => CFFI.core_Split_Async(m.ref, callback), + (c, p) => VecMat.fromPointer(p.cast()), + ); + +/// Subtract calculates the per-element subtraction of two arrays or an array and a scalar. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#gaa0f00d98b4b5edeaeb7b8333b2de353b +Future subtractAsync( + InputArray src1, + InputArray src2, { + InputArray? mask, + int dtype = -1, +}) async => + cvRunAsync( + (callback) => + CFFI.core_Subtract_Async(src1.ref, src2.ref, mask?.ref ?? Mat.empty().ref, dtype, callback), + matCompleter, + ); + +/// Trace returns the trace of a matrix. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga3419ac19c7dcd2be4bd552a23e147dd8 +Future traceAsync(InputArray mtx) async => + cvRunAsync((callback) => CFFI.core_Trace_Async(mtx.ref, callback), scalarCompleter); + +/// Transform performs the matrix transformation of every array element. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga393164aa54bb9169ce0a8cc44e08ff22 +Future transformAsync(InputArray src, InputArray m) async => + cvRunAsync((callback) => CFFI.core_Transform_Async(src.ref, m.ref, callback), matCompleter); + +/// Transpose transposes a matrix. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga46630ed6c0ea6254a35f447289bd7404 +Future transposeAsync(InputArray src) async => + cvRunAsync((callback) => CFFI.core_Transpose_Async(src.ref, callback), matCompleter); + +/// Pow raises every array element to a power. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#gaf0d056b5bd1dc92500d6f6cf6bac41ef +Future powAsync(InputArray src, double power) async => + cvRunAsync((callback) => CFFI.core_Pow_Async(src.ref, power, callback), matCompleter); + +/// PolatToCart calculates x and y coordinates of 2D vectors from their magnitude and angle. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga581ff9d44201de2dd1b40a50db93d665 +Future<(Mat x, Mat y)> polarToCartAsync( + InputArray magnitude, + InputArray angle, { + bool angleInDegrees = false, +}) async => + cvRunAsync2( + (callback) => CFFI.core_PolarToCart_Async(magnitude.ref, angle.ref, angleInDegrees, callback), + matCompleter2, + ); + +/// Phase calculates the rotation angle of 2D vectors. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga9db9ca9b4d81c3bde5677b8f64dc0137 +Future phaseAsync(InputArray x, InputArray y, {bool angleInDegrees = false}) async => + cvRunAsync((callback) => CFFI.core_Phase_Async(x.ref, y.ref, angleInDegrees, callback), matCompleter); + +/// RandN Fills the array with normally distributed random numbers. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#gaeff1f61e972d133a04ce3a5f81cf6808 +Future randnAsync(InputOutputArray dst, Scalar mean, Scalar stddev) async => cvRunAsync0( + (callback) => CFFI.RandN_Async(dst.ref, mean.ref, stddev.ref, callback), + (c) => c.complete(dst), + ); + +/// RandShuffle Shuffles the array elements randomly. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga6a789c8a5cb56c6dd62506179808f763 +Future randShuffleAsync( + InputOutputArray dst, { + double iterFactor = 1, + Rng? rng, +}) async => + cvRunAsync0( + (callback) => rng == null + ? CFFI.RandShuffle_Async(dst.ref, callback) + : CFFI.RandShuffleWithParams_Async(dst.ref, iterFactor, rng.ref, callback), + (c) => c.complete(dst), + ); + +/// RandU Generates a single uniformly-distributed random +/// number or an array of random numbers. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d2/de8/group__core__array.html#ga1ba1026dca0807b27057ba6a49d258c0 +Future randuAsync(InputOutputArray dst, Scalar low, Scalar high) async => cvRunAsync0( + (callback) => CFFI.RandU_Async(dst.ref, low.ref, high.ref, callback), + (c) => c.complete(dst), + ); diff --git a/lib/src/core/cv_vec.dart b/lib/src/core/cv_vec.dart index 0da3317f..6db7f0a5 100644 --- a/lib/src/core/cv_vec.dart +++ b/lib/src/core/cv_vec.dart @@ -4,6 +4,7 @@ import 'package:ffi/ffi.dart'; import '../opencv.g.dart' as cvg; import 'base.dart'; +import 'vec.dart'; abstract class CvVec extends CvStruct { CvVec.fromPointer(super.ptr) : super.fromPointer(); @@ -1069,3 +1070,177 @@ class Vec6d extends CvVec { String toString() => "Vec6d(${val1.toStringAsFixed(3)}, ${val2.toStringAsFixed(3)}, ${val3.toStringAsFixed(3)}, ${val4.toStringAsFixed(3)}, ${val5.toStringAsFixed(3)}, ${val6.toStringAsFixed(3)})"; } + +class VecVec4i extends Vec implements CvStruct { + VecVec4i._(this.ptr, [bool attach = true]) { + if (attach) { + finalizer.attach(this, ptr.cast(), detach: this); + } + } + + factory VecVec4i.fromPointer(cvg.VecVec4iPtr ptr, [bool attach = true]) => VecVec4i._(ptr, attach); + + factory VecVec4i.fromList(List pts) { + final ptr = calloc(); + cvRun(() => CFFI.VecVec4i_New(ptr)); + for (var i = 0; i < pts.length; i++) { + final p = pts[i]; + cvRun(() => CFFI.VecVec4i_Append(ptr.ref, p.ref)); + } + final vec = VecVec4i._(ptr); + return vec; + } + + @override + cvg.VecVec4iPtr ptr; + static final finalizer = OcvFinalizer(CFFI.addresses.VecVec4i_Close); + + void dispose() { + finalizer.detach(this); + CFFI.VecVec4i_Close(ptr); + } + + @override + Iterator get iterator => VecVec4iIterator(ref); + + @override + cvg.VecVec4i get ref => ptr.ref; +} + +class VecVec4iIterator extends VecIterator { + VecVec4iIterator(this.ptr); + cvg.VecVec4i ptr; + + @override + int get length { + return using((arena) { + final p = arena(); + cvRun(() => CFFI.VecVec4i_Size(ptr, p)); + final len = p.value; + return len; + }); + } + + @override + Vec4i operator [](int idx) { + final p = calloc(); + cvRun(() => CFFI.VecVec4i_At(ptr, idx, p)); + return Vec4i.fromPointer(p); + } +} + +class VecVec4f extends Vec implements CvStruct { + VecVec4f._(this.ptr, [bool attach = true]) { + if (attach) { + finalizer.attach(this, ptr.cast(), detach: this); + } + } + + factory VecVec4f.fromPointer(cvg.VecVec4fPtr ptr, [bool attach = true]) => VecVec4f._(ptr, attach); + + factory VecVec4f.fromList(List pts) { + final ptr = calloc(); + cvRun(() => CFFI.VecVec4f_New(ptr)); + for (var i = 0; i < pts.length; i++) { + final p = pts[i]; + cvRun(() => CFFI.VecVec4f_Append(ptr.ref, p.ref)); + } + final vec = VecVec4f._(ptr); + return vec; + } + + @override + cvg.VecVec4fPtr ptr; + static final finalizer = OcvFinalizer(CFFI.addresses.VecVec4f_Close); + + void dispose() { + finalizer.detach(this); + CFFI.VecVec4f_Close(ptr); + } + + @override + Iterator get iterator => VecVec4fIterator(ref); + + @override + cvg.VecVec4f get ref => ptr.ref; +} + +class VecVec4fIterator extends VecIterator { + VecVec4fIterator(this.ptr); + cvg.VecVec4f ptr; + + @override + int get length { + return using((arena) { + final p = arena(); + cvRun(() => CFFI.VecVec4f_Size(ptr, p)); + final len = p.value; + return len; + }); + } + + @override + Vec4f operator [](int idx) { + final p = calloc(); + cvRun(() => CFFI.VecVec4f_At(ptr, idx, p)); + return Vec4f.fromPointer(p); + } +} + +class VecVec6f extends Vec implements CvStruct { + VecVec6f._(this.ptr, [bool attach = true]) { + if (attach) { + finalizer.attach(this, ptr.cast(), detach: this); + } + } + + factory VecVec6f.fromPointer(cvg.VecVec6fPtr ptr, [bool attach = true]) => VecVec6f._(ptr, attach); + + factory VecVec6f.fromList(List pts) { + final ptr = calloc(); + cvRun(() => CFFI.VecVec6f_New(ptr)); + for (var i = 0; i < pts.length; i++) { + final p = pts[i]; + cvRun(() => CFFI.VecVec6f_Append(ptr.ref, p.ref)); + } + final vec = VecVec6f._(ptr); + return vec; + } + + @override + cvg.VecVec6fPtr ptr; + static final finalizer = OcvFinalizer(CFFI.addresses.VecVec6f_Close); + + void dispose() { + finalizer.detach(this); + CFFI.VecVec6f_Close(ptr); + } + + @override + Iterator get iterator => VecVec6fIterator(ref); + + @override + cvg.VecVec6f get ref => ptr.ref; +} + +class VecVec6fIterator extends VecIterator { + VecVec6fIterator(this.ptr); + cvg.VecVec6f ptr; + + @override + int get length { + return using((arena) { + final p = arena(); + cvRun(() => CFFI.VecVec6f_Size(ptr, p)); + final len = p.value; + return len; + }); + } + + @override + Vec6f operator [](int idx) { + final p = calloc(); + cvRun(() => CFFI.VecVec6f_At(ptr, idx, p)); + return Vec6f.fromPointer(p); + } +} diff --git a/lib/src/core/mat.dart b/lib/src/core/mat.dart index 60d50766..fa5a61e3 100644 --- a/lib/src/core/mat.dart +++ b/lib/src/core/mat.dart @@ -1,3 +1,4 @@ +import 'dart:async'; import 'dart:ffi' as ffi; import 'dart:typed_data'; @@ -14,7 +15,7 @@ import 'scalar.dart'; import 'vec.dart'; class Mat extends CvStruct { - Mat._(cvg.MatPtr ptr, [this.xdata, bool attach = true]) : super.fromPointer(ptr) { + Mat._(cvg.MatPtr ptr, [bool attach = true]) : super.fromPointer(ptr) { if (attach) { finalizer.attach(this, ptr.cast(), detach: this); } @@ -28,40 +29,34 @@ class Mat extends CvStruct { return vec; } + /// Create a Mat from a list of data + /// + /// [data] should be raw pixels values with exactly same length of channels * [rows] * [cols] + /// /// Mat (Size size, int type, void *data, size_t step=AUTO_STEP) /// /// https://docs.opencv.org/4.x/d3/d63/classcv_1_1Mat.html#a9fa74fb14362d87cb183453d2441948f - factory Mat.fromList(int rows, int cols, MatType type, List data, [int step = 0]) { - assert(data is List || data is List, "Only support List or List"); + factory Mat.fromList(int rows, int cols, MatType type, List data) { final p = calloc(); - // 1 copy - final NativeArray xdata; - switch (type.depth) { - case MatType.CV_8U: - xdata = U8Array.fromList(data.cast()); - case MatType.CV_8S: - xdata = I8Array.fromList(data.cast()); - case MatType.CV_16U: - xdata = U16Array.fromList(data.cast()); - case MatType.CV_16S: - xdata = I16Array.fromList(data.cast()); - case MatType.CV_32S: - xdata = I32Array.fromList(data.cast()); - case MatType.CV_32F: - xdata = F32Array.fromList(data.cast()); - case MatType.CV_64F: - xdata = F64Array.fromList(data.cast()); - default: - throw UnsupportedError("Mat.fromBytes for MatType $type unsupported"); - } - // no copy, data is owned by [xdata] - cvRun(() => CFFI.Mat_NewFromBytes(rows, cols, type.toInt32(), xdata.asVoid(), step, p)); - final mat = Mat._(p, xdata); - return mat; + // copy + final xdata = switch (type.depth) { + MatType.CV_8U => U8Array.fromList(data.cast()) as NativeArray, + MatType.CV_8S => I8Array.fromList(data.cast()) as NativeArray, + MatType.CV_16U => U16Array.fromList(data.cast()) as NativeArray, + MatType.CV_16S => I16Array.fromList(data.cast()) as NativeArray, + MatType.CV_32S => I32Array.fromList(data.cast()) as NativeArray, + MatType.CV_32F => F32Array.fromList(data.cast()) as NativeArray, + MatType.CV_64F => F64Array.fromList(data.cast()) as NativeArray, + _ => throw UnsupportedError("Mat.fromBytes for MatType $type unsupported"), + }; + // copy + cvRun(() => CFFI.Mat_NewFromBytes(rows, cols, type.toInt32(), xdata.asVoid(), p)); + xdata.dispose(); + return Mat._(p); } /// This method is different from [Mat.fromPtr], will construct from pointer directly - factory Mat.fromPointer(cvg.MatPtr mat, [bool attach = true]) => Mat._(mat, null, attach); + factory Mat.fromPointer(cvg.MatPtr mat, [bool attach = true]) => Mat._(mat, attach); factory Mat.empty() { final p = calloc(); @@ -155,15 +150,14 @@ class Mat extends CvStruct { static final finalizer = OcvFinalizer(CFFI.addresses.Mat_Close); + @Deprecated("NOT recommended, call [dispose] instead") void release() => cvRun(() => CFFI.Mat_Release(ptr)); + void dispose() { finalizer.detach(this); CFFI.Mat_Close(ptr); } - /// external native data array of [Mat], used for [Mat.fromList] - NativeArray? xdata; - /// cached mat type MatType? _type; @@ -1410,3 +1404,17 @@ class VecMatIterator extends VecIterator { extension ListMatExtension on List { VecMat get cvd => VecMat.fromList(this); } + +// Completers for async +void matCompleter(Completer completer, VoidPtr p) => + completer.complete(Mat.fromPointer(p.cast())); +void matCompleter2(Completer<(Mat, Mat)> completer, VoidPtr p, VoidPtr p1) => + completer.complete((Mat.fromPointer(p.cast()), Mat.fromPointer(p1.cast()))); +void matCompleter3(Completer<(Mat, Mat, Mat)> completer, VoidPtr p, VoidPtr p1, VoidPtr p2) => + completer.complete( + ( + Mat.fromPointer(p.cast()), + Mat.fromPointer(p1.cast()), + Mat.fromPointer(p2.cast()) + ), + ); diff --git a/lib/src/core/mat_async.dart b/lib/src/core/mat_async.dart new file mode 100644 index 00000000..fa4b6031 --- /dev/null +++ b/lib/src/core/mat_async.dart @@ -0,0 +1,107 @@ +import 'dart:async'; + +import 'package:opencv_dart/opencv_dart.dart'; + +extension MatAsync on Mat { + static Future emptyAsync() async => cvRunAsync(CFFI.Mat_New_Async, matCompleter); + + static Future fromScalarAsync(int rows, int cols, MatType type, Scalar s) async => cvRunAsync( + (callback) => CFFI.Mat_NewFromScalar_Async(s.ref, rows, cols, type.toInt32(), callback), + matCompleter, + ); + + static Future fromVecAsync(Vec vec) async { + if (vec is VecPoint) { + return cvRunAsync((callback) => CFFI.Mat_NewFromVecPoint_Async(vec.ref, callback), matCompleter); + } else if (vec is VecPoint2f) { + return cvRunAsync((callback) => CFFI.Mat_NewFromVecPoint2f_Async(vec.ref, callback), matCompleter); + } else if (vec is VecPoint3f) { + return cvRunAsync((callback) => CFFI.Mat_NewFromVecPoint3f_Async(vec.ref, callback), matCompleter); + } else { + throw UnsupportedError("Unsupported Vec type ${vec.runtimeType}"); + } + } + + static Future createAsync({ + int rows = 0, + int cols = 0, + int r = 0, + int g = 0, + int b = 0, + MatType? type, + }) async => + Mat.fromScalar( + rows, + cols, + type ?? MatType.CV_8UC3, + Scalar(b.toDouble(), g.toDouble(), r.toDouble(), 0), + ); + + static Future eyeAsync(int rows, int cols, MatType type) async => + cvRunAsync((callback) => CFFI.Mat_Eye_Async(rows, cols, type.toInt32(), callback), matCompleter); + + static Future zerosAsync(int rows, int cols, MatType type) async => + cvRunAsync((callback) => CFFI.Mat_Zeros_Async(rows, cols, type.toInt32(), callback), matCompleter); + + static Future onesAsync(int rows, int cols, MatType type) async => + cvRunAsync((callback) => CFFI.Mat_Ones_Async(rows, cols, type.toInt32(), callback), matCompleter); + + Future cloneAsync() async => + cvRunAsync((callback) => CFFI.Mat_Clone_Async(ref, callback), matCompleter); + + Future copyToAsync(Mat dst, {Mat? mask}) async => cvRunAsync0( + (callback) => mask == null + ? CFFI.Mat_CopyTo_Async(ref, dst.ref, callback) + : CFFI.Mat_CopyToWithMask_Async(ref, dst.ref, mask.ref, callback), + voidCompleter, + ); + + Future convertToAsync(MatType type, {double alpha = 1, double beta = 0}) async => cvRunAsync( + (callback) => CFFI.Mat_ConvertToWithParams_Async(ref, type.toInt32(), alpha, beta, callback), + matCompleter, + ); + + Future regionAsync(Rect rect) async => cvRunAsync( + (callback) => CFFI.Mat_Region_Async(ref, rect.ref, callback), + matCompleter, + ); + + Future reshapeAsync(int cn, int rows) async => cvRunAsync( + (callback) => CFFI.Mat_Reshape_Async(ref, cn, rows, callback), + matCompleter, + ); + + Future rotateAsync(int rotationCode) async => cvRunAsync( + (callback) => CFFI.core_Rotate_Async(ref, rotationCode, callback), + matCompleter, + ); + + Future rowRangeAsync(int start, int end) async => cvRunAsync( + (callback) => CFFI.core_rowRange_Async(ref, start, end, callback), + matCompleter, + ); + + Future colRangeAsync(int start, int end) async => cvRunAsync( + (callback) => CFFI.core_colRange_Async(ref, start, end, callback), + matCompleter, + ); + + Future meanAsync({Mat? mask}) async => cvRunAsync( + (callback) => mask == null + ? CFFI.core_Mean_Async(ref, callback) + : CFFI.core_MeanWithMask_Async(ref, mask.ref, callback), + scalarCompleter, + ); + + /// Calculates a square root of array elements. + Future sqrtAsync() async => + cvRunAsync((callback) => CFFI.core_Sqrt_Async(ref, callback), matCompleter); + + /// Sum calculates the per-channel pixel sum of an image. + Future sumAsync() async => + cvRunAsync((callback) => CFFI.core_Sum_Async(ref, callback), scalarCompleter); + + /// PatchNaNs converts NaN's to zeros. + Future patchNaNsAsync({double val = 0.0}) async => + cvRunAsync0((callback) => CFFI.core_PatchNaNs_Async(ref, val, callback), voidCompleter); +} diff --git a/lib/src/core/moments.dart b/lib/src/core/moments.dart index 27eb9d72..9206e51a 100644 --- a/lib/src/core/moments.dart +++ b/lib/src/core/moments.dart @@ -1,3 +1,4 @@ +import 'dart:async'; import 'dart:ffi' as ffi; import 'package:ffi/ffi.dart'; @@ -85,3 +86,8 @@ class Moments extends CvStruct { nu03, ]; } + +// async completer +void momentsCompleter(Completer completer, VoidPtr p) { + completer.complete(Moments.fromPointer(p.cast())); +} diff --git a/lib/src/core/point.dart b/lib/src/core/point.dart index c075ac9f..b28d02af 100644 --- a/lib/src/core/point.dart +++ b/lib/src/core/point.dart @@ -1,3 +1,4 @@ +import 'dart:async'; import 'dart:ffi' as ffi; import 'package:ffi/ffi.dart'; @@ -615,3 +616,10 @@ extension Point3fRecordExtension on (double x, double y, double z) { return point; } } + +// completers +void vecPointCompleter(Completer completer, VoidPtr p) => + completer.complete(VecPoint.fromPointer(p.cast())); + +void vecPoint2fCompleter(Completer completer, VoidPtr p) => + completer.complete(VecPoint2f.fromPointer(p.cast())); diff --git a/lib/src/core/rect.dart b/lib/src/core/rect.dart index ce090374..c6d5b9b7 100644 --- a/lib/src/core/rect.dart +++ b/lib/src/core/rect.dart @@ -1,3 +1,4 @@ +import 'dart:async'; import 'dart:ffi' as ffi; import 'package:ffi/ffi.dart'; @@ -93,7 +94,7 @@ class RotatedRect extends CvStruct { finalizer.attach(this, ptr.cast(), detach: this); } } - factory RotatedRect(Point2f center, Size2f size, double angle) { + factory RotatedRect(Point2f center, (double, double) size, double angle) { final sz = calloc() ..ref.width = size.$1 ..ref.height = size.$2; @@ -118,31 +119,25 @@ class RotatedRect extends CvStruct { } List get points { - return using>((arena) { - final pts = calloc(); - cvRun(() => CFFI.RotatedRect_Points(ptr.ref, pts)); - return VecPoint2f.fromPointer(pts).toList(); - }); + final pts = calloc(); + cvRun(() => CFFI.RotatedRect_Points(ptr.ref, pts)); + return VecPoint2f.fromPointer(pts).toList(); } Rect get boundingRect { - return using((arena) { - final rect = calloc(); - cvRun(() => CFFI.RotatedRect_BoundingRect(ptr.ref, rect)); - return Rect.fromPointer(rect); - }); + final rect = calloc(); + cvRun(() => CFFI.RotatedRect_BoundingRect(ptr.ref, rect)); + return Rect.fromPointer(rect); } Rect2f get boundingRect2f { - return using((arena) { - final rect = calloc(); - cvRun(() => CFFI.RotatedRect_BoundingRect2f(ptr.ref, rect)); - return Rect2f.fromPointer(rect); - }); + final rect = calloc(); + cvRun(() => CFFI.RotatedRect_BoundingRect2f(ptr.ref, rect)); + return Rect2f.fromPointer(rect); } Point2f get center => Point2f.fromNative(ref.center); - Size2f get size => (ref.size.width, ref.size.height); + Size2f get size => Size2f(ref.size.width, ref.size.height); double get angle => ref.angle; @override @@ -217,14 +212,19 @@ class VecRectIterator extends VecIterator { @override Rect operator [](int idx) { - return cvRunArena((arena) { - final p = calloc(); - cvRun(() => CFFI.VecRect_At(ptr, idx, p)); - return Rect.fromPointer(p); - }); + final p = calloc(); + cvRun(() => CFFI.VecRect_At(ptr, idx, p)); + return Rect.fromPointer(p); } } extension ListRectExtension on List { VecRect get cvd => VecRect.fromList(this); } + +// Completers for async +void rectCompleter(Completer completer, VoidPtr p) => + completer.complete(Rect.fromPointer(p.cast())); + +void rotatedRectCompleter(Completer completer, VoidPtr p) => + completer.complete(RotatedRect.fromPointer(p.cast())); diff --git a/lib/src/core/rng.dart b/lib/src/core/rng.dart index 2bcf0cc3..9b46e397 100644 --- a/lib/src/core/rng.dart +++ b/lib/src/core/rng.dart @@ -59,22 +59,34 @@ class Rng extends CvStruct { /// That is, the mean value of the returned random numbers is zero and /// the standard deviation is the specified sigma . /// https://docs.opencv.org/4.x/d1/dd6/classcv_1_1RNG.html#a8df8ce4dc7d15916cee743e5a884639d - double gaussian(double sigma) { - return cvRunArena((arena) { - final p = arena(); + Stream gaussian(double sigma, {int? maxCount}) async* { + int count = 0; + while (true) { + final p = calloc(); cvRun(() => CFFI.RNG_Gaussian(ref, sigma, p)); - return p.value; - }); + final v = p.value; + calloc.free(p); + yield v; + + count++; + if (count == maxCount) break; + } } /// The method updates the state using the MWC algorithm and returns the next 32-bit random number. /// https://docs.opencv.org/4.x/d1/dd6/classcv_1_1RNG.html#ad8d035897a5e31e7fc3e1e6c378c32f5 - int next() { - return cvRunArena((arena) { - final p = arena(); + Stream next({int? maxCount}) async* { + int count = 0; + while (true) { + final p = calloc(); cvRun(() => CFFI.RNG_Next(ref, p)); - return p.value; - }); + final v = p.value; + calloc.free(p); + yield v; + + count++; + if (count == maxCount) break; + } } /// returns uniformly distributed integer random number from [a,b) range @@ -82,20 +94,26 @@ class Rng extends CvStruct { /// uniformly-distributed random number of the specified type, deduced from /// the input parameter type, from the range [a, b) . /// https://docs.opencv.org/4.x/d1/dd6/classcv_1_1RNG.html#a8325cc562269b47bcac2343639b6fafc - T uniform(T a, T b) { - return cvRunArena((arena) { - if (T == int) { - final p = arena(); - cvRun(() => CFFI.RNG_Uniform(ref, a as int, b as int, p)); - return p.value as T; - } else if (T == double) { - final p = arena(); - cvRun(() => CFFI.RNG_UniformDouble(ref, a as double, b as double, p)); - return p.value as T; + Stream uniform(num a, num b, {int? maxCount}) async* { + int count = 0; + while (true) { + if (a is int && b is int) { + final p = calloc(); + cvRun(() => CFFI.RNG_Uniform(ref, a, b, p)); + final v = p.value; + calloc.free(p); + yield v; } else { - throw UnsupportedError("Unsupported type $T"); + final p = calloc(); + cvRun(() => CFFI.RNG_UniformDouble(ref, a.toDouble(), b.toDouble(), p)); + final v = p.value; + calloc.free(p); + yield v; } - }); + + count++; + if (count == maxCount) break; + } } @override diff --git a/lib/src/core/rng_async.dart b/lib/src/core/rng_async.dart new file mode 100644 index 00000000..eabafb3b --- /dev/null +++ b/lib/src/core/rng_async.dart @@ -0,0 +1,109 @@ +import 'dart:ffi' as ffi; + +import 'package:ffi/ffi.dart'; + +import '../opencv.g.dart' as cvg; +import 'base.dart'; +import 'mat.dart'; +import 'mat_async.dart'; +import 'rng.dart'; + +extension RngAsync on Rng { + static Future createAsync() async => cvRunAsync( + CFFI.Rng_New_Async, + (completer, p) => completer.complete(Rng.fromTheRng(p.cast())), + ); + + static Future fromSeedAsync(int seed) async => cvRunAsync( + (callback) => CFFI.Rng_NewWithState_Async(seed, callback), + (completer, p) => completer.complete(Rng.fromTheRng(p.cast())), + ); + + /// Fills arrays with random numbers. + /// https://docs.opencv.org/4.x/d1/dd6/classcv_1_1RNG.html#ad26f2b09d9868cf108e84c9814aa682d + Future fillAsync( + Mat mat, + int distType, + double a, + double b, { + bool saturateRange = false, + bool inplace = false, + }) async { + if (inplace) { + return cvRunAsync0( + (callback) => CFFI.RNG_Fill_Async(ref, mat.ref, distType, a, b, saturateRange, callback), + (c) => c.complete(mat), + ); + } else { + final m = await mat.cloneAsync(); + return cvRunAsync0( + (callback) => CFFI.RNG_Fill_Async(ref, m.ref, distType, a, b, saturateRange, callback), + (c) => c.complete(m), + ); + } + } + + /// The method transforms the state using the MWC algorithm and returns + /// the next random number from the Gaussian distribution N(0,sigma) . + /// That is, the mean value of the returned random numbers is zero and + /// the standard deviation is the specified sigma . + /// https://docs.opencv.org/4.x/d1/dd6/classcv_1_1RNG.html#a8df8ce4dc7d15916cee743e5a884639d + Stream gaussianAsync(double sigma, {int? maxCount}) async* { + int count = 0; + while (true) { + final v = await cvRunAsync( + (callback) => CFFI.RNG_Gaussian_Async(ref, sigma, callback), + doubleCompleter, + ); + yield v; + + count++; + if (count == maxCount) break; + } + } + + /// The method updates the state using the MWC algorithm and returns the next 32-bit random number. + /// https://docs.opencv.org/4.x/d1/dd6/classcv_1_1RNG.html#ad8d035897a5e31e7fc3e1e6c378c32f5 + Stream nextAsync({int? maxCount}) async* { + int count = 0; + while (true) { + final v = await cvRunAsync( + (callback) => CFFI.RNG_Next_Async(ref, callback), + (c, p) { + final rval = p.cast().value; + calloc.free(p); + c.complete(rval); + }, + ); + yield v; + + count++; + if (count == maxCount) break; + } + } + + /// returns uniformly distributed integer random number from [a,b) range + /// The methods transform the state using the MWC algorithm and return the next + /// uniformly-distributed random number of the specified type, deduced from + /// the input parameter type, from the range [a, b) . + /// https://docs.opencv.org/4.x/d1/dd6/classcv_1_1RNG.html#a8325cc562269b47bcac2343639b6fafc + Stream uniformAsync(num a, num b, {int? maxCount}) async* { + int count = 0; + while (true) { + if (a is int && b is int) { + final rval = + await cvRunAsync((callback) => CFFI.RNG_Uniform_Async(ref, a, b, callback), intCompleter); + yield rval; + } else { + final rval = await cvRunAsync( + (callback) => CFFI.RNG_UniformDouble_Async(ref, a.toDouble(), b.toDouble(), callback), + doubleCompleter, + ); + yield rval; + } + + count++; + if (count == maxCount) break; + } + } +} diff --git a/lib/src/core/scalar.dart b/lib/src/core/scalar.dart index 09945d9b..6b485970 100644 --- a/lib/src/core/scalar.dart +++ b/lib/src/core/scalar.dart @@ -1,3 +1,4 @@ +import 'dart:async'; import 'dart:ffi' as ffi; import 'dart:math' as math; @@ -100,3 +101,8 @@ extension RecordScalarExtension on (double val1, double val2, double val3, doubl return scalar; } } + +// async completer +void scalarCompleter(Completer completer, VoidPtr p) { + completer.complete(Scalar.fromPointer(p.cast())); +} diff --git a/lib/src/core/size.dart b/lib/src/core/size.dart index 20239249..cdec51af 100644 --- a/lib/src/core/size.dart +++ b/lib/src/core/size.dart @@ -1,17 +1,105 @@ import 'dart:ffi' as ffi; + import 'package:ffi/ffi.dart'; +import 'package:opencv_dart/opencv_dart.dart'; import '../opencv.g.dart' as cvg; +import 'base.dart'; + +class Size extends CvStruct { + Size.fromPointer(super.ptr, [bool attach = true]) : super.fromPointer() { + if (attach) { + finalizer.attach(this, ptr.cast(), detach: this); + } + } + + factory Size(int width, int height) { + final p = calloc() + ..ref.height = height + ..ref.width = width; + return Size.fromPointer(p); + } + + factory Size.fromRecord((int, int) record) { + final p = calloc() + ..ref.height = record.$2 + ..ref.width = record.$1; + return Size.fromPointer(p); + } + + int get width => ref.width; + int get height => ref.height; -/// (width, height) -typedef Size = (int, int); -typedef Size2f = (double, double); + static final finalizer = ffi.NativeFinalizer(calloc.nativeFree); -extension RecordSizeExtension1 on Size { - ffi.Pointer toSize(Arena arena) { - final size = arena() - ..ref.width = this.$1 - ..ref.height = this.$2; - return size; + void dispose() { + finalizer.detach(this); + calloc.free(ptr); } + + @override + List get props => [width, height]; + + @override + cvg.Size get ref => ptr.ref; +} + +class Size2f extends CvStruct { + Size2f.fromPointer(super.ptr, [bool attach = true]) : super.fromPointer() { + if (attach) { + finalizer.attach(this, ptr.cast(), detach: this); + } + } + + factory Size2f(double width, double height) { + final p = calloc() + ..ref.height = height + ..ref.width = width; + return Size2f.fromPointer(p); + } + + factory Size2f.fromRecord((double, double) record) { + final p = calloc() + ..ref.height = record.$2 + ..ref.width = record.$1; + return Size2f.fromPointer(p); + } + + factory Size2f.fromSize(Size size) { + final p = calloc() + ..ref.height = size.height.toDouble() + ..ref.width = size.width.toDouble(); + return Size2f.fromPointer(p); + } + + double get width => ref.width; + double get height => ref.height; + + static final finalizer = ffi.NativeFinalizer(calloc.nativeFree); + + void dispose() { + finalizer.detach(this); + calloc.free(ptr); + } + + @override + List get props => [width, height]; + + @override + cvg.Size2f get ref => ptr.ref; + + @override + String toString() { + return "Size2f(${width.toStringAsFixed(3)}, ${height.toStringAsFixed(3)})"; + } +} + +extension RecordSizeExtension1 on (int, int) { + Size toSize() => Size(this.$1, this.$2); + Size get cvd => Size(this.$1, this.$2); +} + +extension RecordSize2fExtension1 on (double, double) { + Size2f toSize2f() => Size2f(this.$1, this.$2); + Size2f get cvd => Size2f(this.$1, this.$2); } diff --git a/lib/src/core/termcriteria.dart b/lib/src/core/termcriteria.dart index d4b58207..eebf0178 100644 --- a/lib/src/core/termcriteria.dart +++ b/lib/src/core/termcriteria.dart @@ -1,29 +1,53 @@ import 'dart:ffi' as ffi; import 'package:ffi/ffi.dart'; + import '../opencv.g.dart' as cvg; +import 'base.dart'; /// TermCriteria is the criteria for iterative algorithms. /// /// For further details, please see: /// https://docs.opencv.org/master/d9/d5d/classcv_1_1TermCriteria.html -typedef TermCriteria = (int type, int count, double eps); - -extension TermCriteriaX on TermCriteria { - ffi.Pointer toNativePtr(Arena arena) { - return arena() - ..ref.type = this.$1 - ..ref.maxCount = this.$2 - ..ref.epsilon = this.$3; +// typedef TermCriteria = (int type, int count, double eps); + +class TermCriteria extends CvStruct { + TermCriteria.fromPointer(super.ptr, [bool attach = true]) : super.fromPointer() { + if (attach) { + finalizer.attach(this, ptr.cast(), detach: this); + } } - int get type => this.$1; - int get count => this.$2; - double get eps => this.$3; -} + factory TermCriteria(int type, int cound, double eps) { + final p = calloc() + ..ref.type = type + ..ref.maxCount = cound + ..ref.epsilon = eps; + return TermCriteria.fromPointer(p); + } + + factory TermCriteria.fromRecord((int type, int count, double eps) record) => + TermCriteria(record.$1, record.$2, record.$3); + + static final finalizer = ffi.NativeFinalizer(calloc.nativeFree); -extension TermCriteriaX1 on cvg.TermCriteria { - TermCriteria toDart() { - return (type, maxCount, epsilon); + void dispose() { + finalizer.detach(this); + calloc.free(ptr); } + + int get type => ref.type; + int get maxCount => ref.maxCount; + double get eps => ref.epsilon; + + @override + List get props => [type, maxCount, eps]; + + @override + cvg.TermCriteria get ref => ptr.ref; +} + +extension TermCriteriaExtension on (int, int, double) { + TermCriteria toTermCriteria() => TermCriteria(this.$1, this.$2, this.$3); + TermCriteria get cvd => TermCriteria(this.$1, this.$2, this.$3); } diff --git a/lib/src/core/vec.dart b/lib/src/core/vec.dart index d011be5d..d31f0394 100644 --- a/lib/src/core/vec.dart +++ b/lib/src/core/vec.dart @@ -1,3 +1,4 @@ +import 'dart:async'; import 'dart:collection'; import 'dart:convert'; import 'dart:ffi' as ffi; @@ -515,3 +516,13 @@ extension ListDoubleExtension on List { extension ListStringExtension on List { VecVecChar get i8 => VecVecChar.fromList(map((e) => e.i8.toList()).toList()); } + +// async completers +void vecIntCompleter(Completer completer, VoidPtr p) => + completer.complete(VecInt.fromPointer(p.cast())); + +void vecFloatCompleter(Completer completer, VoidPtr p) => + completer.complete(VecFloat.fromPointer(p.cast())); + +void vecDoubleCompleter(Completer completer, VoidPtr p) => + completer.complete(VecDouble.fromPointer(p.cast())); diff --git a/lib/src/dnn/dnn.dart b/lib/src/dnn/dnn.dart index 26528cfe..110abc27 100644 --- a/lib/src/dnn/dnn.dart +++ b/lib/src/dnn/dnn.dart @@ -37,20 +37,20 @@ class Layer extends CvStruct { /// GetName returns name for this layer. String get name { - return cvRunArena((arena) { - final p = calloc>(); - cvRun(() => CFFI.Layer_GetName(ref, p)); - return p.value.toDartString(); - }); + final p = calloc>(); + cvRun(() => CFFI.Layer_GetName(ref, p)); + final r = p.value.toDartString(); + calloc.free(p); + return r; } /// GetType returns type for this layer. String get type { - return cvRunArena((arena) { - final p = calloc>(); - cvRun(() => CFFI.Layer_GetType(ref, p)); - return p.value.toDartString(); - }); + final p = calloc>(); + cvRun(() => CFFI.Layer_GetType(ref, p)); + final r = p.value.toDartString(); + calloc.free(p); + return r; } /// InputNameToIndex returns index of input blob in input array. @@ -95,14 +95,17 @@ class Net extends CvStruct { finalizer.attach(this, ptr.cast(), detach: this); } } + factory Net.fromPointer( + cvg.NetPtr ptr, [ + bool attach = true, + ]) => + Net._(ptr, attach); factory Net.empty() { - return cvRunArena((arena) { - final p = calloc(); - cvRun(() => CFFI.Net_Create(p)); - final net = Net._(p); - return net; - }); + final p = calloc(); + cvRun(() => CFFI.Net_Create(p)); + final net = Net._(p); + return net; } /// Read deep learning network represented in one of the supported formats. @@ -310,12 +313,10 @@ class Net extends CvStruct { /// For further details, please see: /// https://docs.opencv.org/3.4.1/db/d30/classcv_1_1dnn_1_1Net.html#adb34d7650e555264c7da3b47d967311b VecMat forwardLayers(List names) { - return cvRunArena((arena) { - final vecName = names.i8; - final vecMat = calloc(); - cvRun(() => CFFI.Net_ForwardLayers(ref, vecMat, vecName.ref)); - return VecMat.fromPointer(vecMat); - }); + final vecName = names.i8; + final vecMat = calloc(); + cvRun(() => CFFI.Net_ForwardLayers(ref, vecMat, vecName.ref)); + return VecMat.fromPointer(vecMat); } /// SetPreferableBackend ask network to use specific computation backend. @@ -369,22 +370,18 @@ class Net extends CvStruct { /// For further details, please see: /// https://docs.opencv.org/master/db/d30/classcv_1_1dnn_1_1Net.html#ae62a73984f62c49fd3e8e689405b056a List getUnconnectedOutLayers() { - return using>((arena) { - final ids = calloc(); - cvRun(() => CFFI.Net_GetUnconnectedOutLayers(ref, ids)); - return VecInt.fromPointer(ids).toList(); - }); + final ids = calloc(); + cvRun(() => CFFI.Net_GetUnconnectedOutLayers(ref, ids)); + return VecInt.fromPointer(ids).toList(); } /// Returns input scale and zeropoint for a quantized Net. /// https://docs.opencv.org/4.x/db/d30/classcv_1_1dnn_1_1Net.html#af82a1c7e7de19712370a34667056102d (VecFloat, VecInt) getInputDetails() { - return using<(VecFloat, VecInt)>((arena) { - final sc = calloc(); - final zp = calloc(); - cvRun(() => CFFI.Net_GetInputDetails(ref, sc, zp)); - return (VecFloat.fromPointer(sc), VecInt.fromPointer(zp)); - }); + final sc = calloc(); + final zp = calloc(); + cvRun(() => CFFI.Net_GetInputDetails(ref, sc, zp)); + return (VecFloat.fromPointer(sc), VecInt.fromPointer(zp)); } static final finalizer = OcvFinalizer(CFFI.addresses.Net_Close); @@ -409,30 +406,27 @@ class Net extends CvStruct { Mat blobFromImage( InputArray image, { double scalefactor = 1.0, - Size? size, + (int, int) size = (0, 0), Scalar? mean, bool swapRB = false, bool crop = false, int ddepth = MatType.CV_32F, }) { - return using((arena) { - size ??= (0, 0); - mean ??= Scalar.zeros; - final blob = Mat.empty(); - cvRun( - () => CFFI.Net_BlobFromImage( - image.ref, - blob.ref, - scalefactor, - size!.toSize(arena).ref, - mean!.ref, - swapRB, - crop, - ddepth, - ), - ); - return blob; - }); + mean ??= Scalar.zeros; + final blob = Mat.empty(); + cvRun( + () => CFFI.Net_BlobFromImage( + image.ref, + blob.ref, + scalefactor, + size.cvd.ref, + mean!.ref, + swapRB, + crop, + ddepth, + ), + ); + return blob; } /// Creates 4-dimensional blob from series of images. @@ -444,28 +438,27 @@ Mat blobFromImages( VecMat images, { Mat? blob, double scalefactor = 1.0, - Size? size, + (int, int) size = (0, 0), Scalar? mean, bool swapRB = false, bool crop = false, int ddepth = MatType.CV_32F, }) { - return using((arena) { - blob ??= Mat.empty(); - size ??= (0, 0); - mean ??= Scalar.zeros; - CFFI.Net_BlobFromImages( + blob ??= Mat.empty(); + mean ??= Scalar.zeros; + cvRun( + () => CFFI.Net_BlobFromImages( images.ref, blob!.ref, scalefactor, - size!.toSize(arena).ref, + size.cvd.ref, mean!.ref, swapRB, crop, ddepth, - ); - return blob!; - }); + ), + ); + return blob; } /// ImagesFromBlob Parse a 4D blob and output the images it contains as diff --git a/lib/src/dnn/dnn_async.dart b/lib/src/dnn/dnn_async.dart new file mode 100644 index 00000000..46c5014a --- /dev/null +++ b/lib/src/dnn/dnn_async.dart @@ -0,0 +1,421 @@ +library cv; + +import 'dart:ffi' as ffi; +import 'dart:typed_data'; + +import 'package:ffi/ffi.dart'; + +import '../core/base.dart'; +import '../core/mat.dart'; +import '../core/mat_type.dart'; +import '../core/rect.dart'; +import '../core/scalar.dart'; +import '../core/size.dart'; +import '../core/vec.dart'; +import '../opencv.g.dart' as cvg; +import './dnn.dart'; + +extension LayerAsync on Layer { + Future get nameAsync async { + final rval = cvRunAsync( + (callback) => CFFI.Layer_GetName_Async(ref, callback), + (c, p) { + final rval = p.cast>().value.toDartString(); + calloc.free(p); + return c.complete(rval); + }, + ); + return rval; + } + + Future get typeAsync async { + final rval = cvRunAsync( + (callback) => CFFI.Layer_GetType_Async(ref, callback), + (c, p) { + final rval = p.cast>().value.toDartString(); + calloc.free(p); + return c.complete(rval); + }, + ); + return rval; + } + + Future inputNameToIndexAsync(String name) async { + final cName = name.toNativeUtf8().cast(); + final rval = await cvRunAsync( + (callback) => CFFI.Layer_InputNameToIndex_Async(ref, cName, callback), + (c, p) { + final rval = p.cast().value; + calloc.free(p); + return c.complete(rval); + }, + ); + calloc.free(cName); + + return rval; + } + + Future outputNameToIndexAsync(String name) async { + final cName = name.toNativeUtf8().cast(); + final rval = cvRunAsync( + (callback) => CFFI.Layer_OutputNameToIndex_Async(ref, cName, callback), + (c, p) { + final rval = p.cast().value; + calloc.free(p); + return c.complete(rval); + }, + ); + calloc.free(cName); + return rval; + } +} + +extension NetAsync on Net { + static Future emptyAsync() async { + final rval = await cvRunAsync(CFFI.Net_Create_Async, (c, p) { + return c.complete(Net.fromPointer(p.cast())); + }); + + return rval; + } + + static Future fromFileAsync(String path, {String config = "", String framework = ""}) async { + final cPath = path.toNativeUtf8().cast(); + final cConfig = config.toNativeUtf8().cast(); + final cFramework = framework.toNativeUtf8().cast(); + final rval = await cvRunAsync( + (callback) => CFFI.Net_ReadNet_Async(cPath, cConfig, cFramework, callback), (c, p) { + return c.complete(Net.fromPointer(p.cast())); + }); + calloc.free(cPath); + calloc.free(cConfig); + calloc.free(cFramework); + + return rval; + } + + static Future fromBytesAsync( + String framework, + Uint8List bufferModel, { + Uint8List? bufferConfig, + }) async { + bufferConfig ??= Uint8List(0); + final cFramework = framework.toNativeUtf8().cast(); + final bufM = VecUChar.fromList(bufferModel); + final bufC = VecUChar.fromList(bufferConfig); + final rval = await cvRunAsync( + (callback) => CFFI.Net_ReadNetBytes_Async(cFramework, bufM.ref, bufC.ref, callback), (c, p) { + return c.complete(Net.fromPointer(p.cast())); + }); + + calloc.free(cFramework); + + return rval; + } + + static Future fromCaffeAsync(String prototxt, String caffeModel) async { + final cProto = prototxt.toNativeUtf8().cast(); + final cCaffe = caffeModel.toNativeUtf8().cast(); + final rval = await cvRunAsync( + (callback) => CFFI.Net_ReadNetFromCaffe_Async(cProto, cCaffe, callback), (c, p) { + return c.complete(Net.fromPointer(p.cast())); + }); + calloc.free(cProto); + calloc.free(cCaffe); + + return rval; + } + + static Future fromCaffeBytesAsync(Uint8List bufferProto, Uint8List bufferModel) async { + final bufP = VecUChar.fromList(bufferProto); + final bufM = VecUChar.fromList(bufferModel); + final rval = await cvRunAsync( + (callback) => CFFI.Net_ReadNetFromCaffeBytes_Async(bufP.ref, bufM.ref, callback), (c, p) { + return c.complete(Net.fromPointer(p.cast())); + }); + return rval; + } + + static Future fromOnnxAsync(String path) async { + final cpath = path.toNativeUtf8().cast(); + final rval = await cvRunAsync((callback) => CFFI.Net_ReadNetFromONNX_Async(cpath, callback), (c, p) { + return c.complete(Net.fromPointer(p.cast())); + }); + calloc.free(cpath); + + return rval; + } + + static Future fromOnnxBytesAsync(Uint8List bufferModel) async { + final bufM = VecUChar.fromList(bufferModel); + final rval = + await cvRunAsync((callback) => CFFI.Net_ReadNetFromONNXBytes_Async(bufM.ref, callback), (c, p) { + return c.complete(Net.fromPointer(p.cast())); + }); + return rval; + } + + static Future fromTensorflowAsync(String path, {String config = ""}) async { + final cpath = path.toNativeUtf8().cast(); + final cconf = config.toNativeUtf8().cast(); + final rval = await cvRunAsync( + (callback) => CFFI.Net_ReadNetFromTensorflow_Async(cpath, cconf, callback), (c, p) { + return c.complete(Net.fromPointer(p.cast())); + }); + calloc.free(cpath); + calloc.free(cconf); + + return rval; + } + + static Future fromTensorflowBytesAsync(Uint8List bufferModel, {Uint8List? bufferConfig}) async { + bufferConfig ??= Uint8List(0); + final bufM = VecUChar.fromList(bufferModel); + final bufC = VecUChar.fromList(bufferConfig); + final rval = await cvRunAsync( + (callback) => CFFI.Net_ReadNetFromTensorflowBytes_Async(bufM.ref, bufC.ref, callback), (c, p) { + return c.complete(Net.fromPointer(p.cast())); + }); + return rval; + } + + static Future fromTFLiteAsync(String path) async { + final cpath = path.toNativeUtf8().cast(); + final rval = + await cvRunAsync((callback) => CFFI.Net_ReadNetFromTFLite_Async(cpath, callback), (c, p) { + return c.complete(Net.fromPointer(p.cast())); + }); + calloc.free(cpath); + return rval; + } + + static Future fromTFLiteBytesAsync(Uint8List bufferModel) async { + final bufM = VecUChar.fromList(bufferModel); + final rval = await cvRunAsync( + (callback) => CFFI.Net_ReadNetFromTFLiteBytes_Async(bufM.ref, callback), (c, p) { + return c.complete(Net.fromPointer(p.cast())); + }); + return rval; + } + + static Future fromTorchAsync(String path, {bool isBinary = true, bool evaluate = true}) async { + final cpath = path.toNativeUtf8().cast(); + final rval = await cvRunAsync( + (callback) => CFFI.Net_ReadNetFromTorch_Async(cpath, isBinary, evaluate, callback), (c, p) { + return c.complete(Net.fromPointer(p.cast())); + }); + calloc.free(cpath); + return rval; + } + + Future isEmptyAsync() async { + final rval = cvRunAsync( + (callback) => CFFI.Net_Empty_Async(ref, callback), + (c, p) { + final rval = p.cast().value; + calloc.free(p); + return c.complete(rval); + }, + ); + return rval; + } + + Future dumpAsync() async { + final rval = cvRunAsync( + (callback) => CFFI.Net_Dump_Async(ref, callback), + (c, p) { + final rval = p.cast>().value.toDartString(); + calloc.free(p); + return c.complete(rval); + }, + ); + return rval; + } + + Future setInputAsync(InputArray blob, {String name = ""}) async { + final cname = name.toNativeUtf8().cast(); + await cvRunAsync0( + (callback) => CFFI.Net_SetInput_Async(ref, blob.ref, cname, callback), + (c) { + return c.complete(); + }, + ); + calloc.free(cname); + } + + Future forwardAsync({String outputName = ""}) async { + final rval = cvRunAsync( + (callback) => CFFI.Net_Forward_Async(ref, outputName.toNativeUtf8().cast(), callback), + (c, result) => c.complete(Mat.fromPointer(result.cast())), + ); + return rval; + } + + Future forwardLayersAsync(List names) async { + final vecName = names.i8; + final rval = cvRunAsync( + (callback) => CFFI.Net_ForwardLayers_Async(ref, vecName.ref, callback), + (c, result) => c.complete(VecMat.fromPointer(result.cast())), + ); + return rval; + } + + Future setPreferableBackendAsync(int backendId) async { + await cvRunAsync0( + (callback) => CFFI.Net_SetPreferableBackend_Async(ref, backendId, callback), + (c) => c.complete(), + ); + } + + Future setPreferableTargetAsync(int targetId) async { + await cvRunAsync0( + (callback) => CFFI.Net_SetPreferableTarget_Async(ref, targetId, callback), + (c) => c.complete(), + ); + } + + Future getPerfProfileAsync() async { + final rval = cvRunAsync( + (callback) => CFFI.Net_GetPerfProfile_Async(ref, callback), + (c, p) { + final rval = p.cast().value; + calloc.free(p); + return c.complete(rval); + }, + ); + return rval; + } + + Future getUnconnectedOutLayersAsync() async { + final rval = cvRunAsync( + (callback) => CFFI.Net_GetUnconnectedOutLayers_Async(ref, callback), + (c, result) => c.complete(VecInt.fromPointer(result.cast())), + ); + return rval; + } + + Future> getLayerNamesAsync() async { + final rval = cvRunAsync>( + (callback) => CFFI.Net_GetLayerNames_Async(ref, callback), + (c, result) => c.complete(VecVecChar.fromPointer(result.cast()).asStringList()), + ); + return rval; + } + + Future<(VecFloat, VecInt)> getInputDetailsAsync() async { + final rval = cvRunAsync2<(VecFloat, VecInt)>( + (callback) => CFFI.Net_GetInputDetails_Async(ref, callback), + (c, sc, zp) => c.complete( + (VecFloat.fromPointer(sc.cast()), VecInt.fromPointer(zp.cast())), + ), + ); + return rval; + } + + Future getLayerAsync(int index) async { + final rval = cvRunAsync( + (callback) => CFFI.Net_GetLayer_Async(ref, index, callback), + (c, result) => c.complete(Layer.fromPointer(result.cast())), + ); + return rval; + } +} + +Future getBlobChannelAsync(Mat blob, int imgidx, int chnidx) async { + final rval = cvRunAsync( + (callback) => CFFI.Net_GetBlobChannel_Async(blob.ref, imgidx, chnidx, callback), + (c, result) => c.complete(Mat.fromPointer(result.cast())), + ); + return rval; +} + +Future getBlobSizeAsync(Mat blob) async { + final rval = cvRunAsync( + (callback) => CFFI.Net_GetBlobSize_Async(blob.ref, callback), + (c, result) => c.complete(Scalar.fromPointer(result.cast())), + ); + return rval; +} + +Future> NMSBoxesAsync( + VecRect bboxes, + VecFloat scores, + double scoreThreshold, + double nmsThreshold, { + double eta = 1.0, + int topK = 0, +}) async { + final rval = cvRunAsync>( + (callback) => CFFI.NMSBoxesWithParams_Async( + bboxes.ref, + scores.ref, + scoreThreshold, + nmsThreshold, + eta, + topK, + callback, + ), + (c, result) => c.complete(VecInt.fromPointer(result.cast()).toList()), + ); + return rval; +} + +Future blobFromImageAsync( + InputArray image, { + double scalefactor = 1.0, + (int, int) size = (0, 0), + Scalar? mean, + bool swapRB = false, + bool crop = false, + int ddepth = MatType.CV_32F, +}) async { + mean ??= Scalar.zeros; + final rval = await cvRunAsync( + (callback) => CFFI.Net_BlobFromImage_Async( + image.ref, + scalefactor, + size.cvd.ref, + mean!.ref, + swapRB, + crop, + ddepth, + callback, + ), + (c, mat) => c.complete(Mat.fromPointer(mat.cast())), + ); + return rval; +} + +Future blobFromImagesAsync( + VecMat images, { + double scalefactor = 1.0, + (int, int) size = (0, 0), + Scalar? mean, + bool swapRB = false, + bool crop = false, + int ddepth = MatType.CV_32F, +}) async { + mean ??= Scalar.zeros; + final rval = await cvRunAsync( + (callback) => CFFI.Net_BlobFromImages_Async( + images.ref, + scalefactor, + size.cvd.ref, + mean!.ref, + swapRB, + crop, + ddepth, + callback, + ), + (c, blob) => c.complete(Mat.fromPointer(blob.cast())), + ); + return rval; +} + +Future> imagesFromBlobAsync(Mat blob) async { + final rval = cvRunAsync>( + (callback) => CFFI.Net_ImagesFromBlob_Async(blob.ref, callback), + (c, result) => c.complete(VecMat.fromPointer(result.cast()).toList()), + ); + return rval; +} diff --git a/lib/src/features2d/features2d.dart b/lib/src/features2d/features2d.dart index e0262c16..bb16c71e 100644 --- a/lib/src/features2d/features2d.dart +++ b/lib/src/features2d/features2d.dart @@ -22,6 +22,7 @@ class AKAZE extends CvStruct { finalizer.attach(this, ptr.cast(), detach: this); } } + factory AKAZE.fromPointer(cvg.AKAZEPtr ptr, [bool attach = true]) => AKAZE._(ptr, attach); /// returns a new AKAZE algorithm /// @@ -50,7 +51,9 @@ class AKAZE extends CvStruct { (VecKeyPoint ret, Mat desc) detectAndCompute(Mat src, Mat mask) { final desc = Mat.empty(); final ret = calloc(); - cvRun(() => CFFI.AKAZE_DetectAndCompute(ptr.ref, src.ref, mask.ref, desc.ref, ret)); + cvRun( + () => CFFI.AKAZE_DetectAndCompute(ptr.ref, src.ref, mask.ref, desc.ref, ret), + ); return (VecKeyPoint.fromPointer(ret), desc); } @@ -75,6 +78,8 @@ class AgastFeatureDetector extends CvStruct { finalizer.attach(this, ptr.cast(), detach: this); } } + factory AgastFeatureDetector.fromPointer(cvg.AgastFeatureDetectorPtr ptr, [bool attach = true]) => + AgastFeatureDetector._(ptr, attach); /// returns a new AgastFeatureDetector algorithm /// @@ -96,8 +101,9 @@ class AgastFeatureDetector extends CvStruct { return VecKeyPoint.fromPointer(ret); } - static final finalizer = - OcvFinalizer(CFFI.addresses.AgastFeatureDetector_Close); + static final finalizer = OcvFinalizer( + CFFI.addresses.AgastFeatureDetector_Close, + ); void dispose() { finalizer.detach(this); @@ -118,6 +124,7 @@ class BRISK extends CvStruct { finalizer.attach(this, ptr.cast(), detach: this); } } + factory BRISK.fromPointer(cvg.BRISKPtr ptr, [bool attach = true]) => BRISK._(ptr, attach); /// returns a new BRISK algorithm /// @@ -146,7 +153,9 @@ class BRISK extends CvStruct { (VecKeyPoint, Mat) detectAndCompute(Mat src, Mat mask) { final desc = Mat.empty(); final ret = calloc(); - cvRun(() => CFFI.BRISK_DetectAndCompute(ptr.ref, src.ref, mask.ref, desc.ref, ret)); + cvRun( + () => CFFI.BRISK_DetectAndCompute(ptr.ref, src.ref, mask.ref, desc.ref, ret), + ); return (VecKeyPoint.fromPointer(ret), desc); } @@ -185,6 +194,8 @@ class FastFeatureDetector extends CvStruct { finalizer.attach(this, ptr.cast(), detach: this); } } + factory FastFeatureDetector.fromPointer(cvg.FastFeatureDetectorPtr ptr, [bool attach = true]) => + FastFeatureDetector._(ptr, attach); /// returns a new FastFeatureDetector algorithm /// @@ -227,7 +238,9 @@ class FastFeatureDetector extends CvStruct { return VecKeyPoint.fromPointer(ret); } - static final finalizer = OcvFinalizer(CFFI.addresses.FastFeatureDetector_Close); + static final finalizer = OcvFinalizer( + CFFI.addresses.FastFeatureDetector_Close, + ); void dispose() { finalizer.detach(this); @@ -248,6 +261,8 @@ class GFTTDetector extends CvStruct { finalizer.attach(this, ptr.cast(), detach: this); } } + factory GFTTDetector.fromPointer(cvg.GFTTDetectorPtr ptr, [bool attach = true]) => + GFTTDetector._(ptr, attach); /// returns a new GFTTDetector algorithm /// @@ -290,6 +305,7 @@ class KAZE extends CvStruct { finalizer.attach(this, ptr.cast(), detach: this); } } + factory KAZE.fromPointer(cvg.KAZEPtr ptr, [bool attach = true]) => KAZE._(ptr, attach); /// returns a new KAZE algorithm /// @@ -318,7 +334,9 @@ class KAZE extends CvStruct { (VecKeyPoint, Mat) detectAndCompute(Mat src, Mat mask) { final desc = Mat.empty(); final ret = calloc(); - cvRun(() => CFFI.KAZE_DetectAndCompute(ptr.ref, src.ref, mask.ref, desc.ref, ret)); + cvRun( + () => CFFI.KAZE_DetectAndCompute(ptr.ref, src.ref, mask.ref, desc.ref, ret), + ); return (VecKeyPoint.fromPointer(ret), desc); } @@ -343,6 +361,7 @@ class MSER extends CvStruct { finalizer.attach(this, ptr.cast(), detach: this); } } + factory MSER.fromPointer(cvg.MSERPtr ptr, [bool attach = true]) => MSER._(ptr, attach); /// returns a new MSER algorithm /// @@ -393,6 +412,7 @@ class ORB extends CvStruct { finalizer.attach(this, ptr.cast(), detach: this); } } + factory ORB.fromPointer(cvg.ORBPtr ptr, [bool attach = true]) => ORB._(ptr, attach); /// returns a new ORB algorithm /// @@ -454,7 +474,9 @@ class ORB extends CvStruct { (VecKeyPoint, Mat) detectAndCompute(Mat src, Mat mask) { final desc = Mat.empty(); final ret = calloc(); - cvRun(() => CFFI.ORB_DetectAndCompute(ptr.ref, src.ref, mask.ref, desc.ref, ret)); + cvRun( + () => CFFI.ORB_DetectAndCompute(ptr.ref, src.ref, mask.ref, desc.ref, ret), + ); return (VecKeyPoint.fromPointer(ret), desc); } @@ -473,8 +495,10 @@ class ORB extends CvStruct { } class SimpleBlobDetectorParams extends CvStruct { - SimpleBlobDetectorParams._(ffi.Pointer ptr, [bool attach = true]) - : super.fromPointer(ptr) { + SimpleBlobDetectorParams._( + ffi.Pointer ptr, [ + bool attach = true, + ]) : super.fromPointer(ptr) { if (attach) { finalizer.attach(this, ptr.cast(), detach: this); } @@ -510,7 +534,9 @@ class SimpleBlobDetectorParams extends CvStruct { final p = calloc(); if (blobColor != null) p.ref.blobColor = blobColor; if (filterByArea != null) p.ref.filterByArea = filterByArea; - if (filterByCircularity != null) p.ref.filterByCircularity = filterByCircularity; + if (filterByCircularity != null) { + p.ref.filterByCircularity = filterByCircularity; + } if (filterByColor != null) p.ref.filterByColor = filterByColor; if (filterByConvexity != null) p.ref.filterByConvexity = filterByConvexity; if (filterByInertia != null) p.ref.filterByInertia = filterByInertia; @@ -522,7 +548,9 @@ class SimpleBlobDetectorParams extends CvStruct { if (minArea != null) p.ref.minArea = minArea; if (minCircularity != null) p.ref.minCircularity = minCircularity; if (minConvexity != null) p.ref.minConvexity = minConvexity; - if (minDistBetweenBlobs != null) p.ref.minDistBetweenBlobs = minDistBetweenBlobs; + if (minDistBetweenBlobs != null) { + p.ref.minDistBetweenBlobs = minDistBetweenBlobs; + } if (minInertiaRatio != null) p.ref.minInertiaRatio = minInertiaRatio; if (minRepeatability != null) p.ref.minRepeatability = minRepeatability; if (minThreshold != null) p.ref.minThreshold = minThreshold; @@ -691,6 +719,9 @@ class SimpleBlobDetector extends CvStruct { } } + factory SimpleBlobDetector.fromPointer(cvg.SimpleBlobDetectorPtr ptr, [bool attach = true]) => + SimpleBlobDetector._(ptr, attach); + /// returns a new SimpleBlobDetector algorithm /// /// For further details, please see: @@ -717,7 +748,9 @@ class SimpleBlobDetector extends CvStruct { return VecKeyPoint.fromPointer(ret); } - static final finalizer = OcvFinalizer(CFFI.addresses.SimpleBlobDetector_Close); + static final finalizer = OcvFinalizer( + CFFI.addresses.SimpleBlobDetector_Close, + ); void dispose() { finalizer.detach(this); @@ -738,6 +771,7 @@ class BFMatcher extends CvStruct { finalizer.attach(this, ptr.cast(), detach: this); } } + factory BFMatcher.fromPointer(cvg.BFMatcherPtr ptr, [bool attach = true]) => BFMatcher._(ptr, attach); /// returns a new BFMatcher algorithm /// @@ -796,6 +830,8 @@ class FlannBasedMatcher extends CvStruct { finalizer.attach(this, ptr.cast(), detach: this); } } + factory FlannBasedMatcher.fromPointer(cvg.FlannBasedMatcherPtr ptr, [bool attach = true]) => + FlannBasedMatcher._(ptr, attach); /// returns a new FlannBasedMatcher algorithm /// @@ -813,11 +849,15 @@ class FlannBasedMatcher extends CvStruct { /// https://docs.opencv.org/master/db/d39/classcv_1_1DescriptorMatcher.html#aa880f9353cdf185ccf3013e08210483a VecVecDMatch knnMatch(Mat query, Mat train, int k) { final ret = calloc(); - cvRun(() => CFFI.FlannBasedMatcher_KnnMatch(ptr.ref, query.ref, train.ref, k, ret)); + cvRun( + () => CFFI.FlannBasedMatcher_KnnMatch(ptr.ref, query.ref, train.ref, k, ret), + ); return VecVecDMatch.fromPointer(ret); } - static final finalizer = OcvFinalizer(CFFI.addresses.FlannBasedMatcher_Close); + static final finalizer = OcvFinalizer( + CFFI.addresses.FlannBasedMatcher_Close, + ); void dispose() { finalizer.detach(this); @@ -848,8 +888,22 @@ enum DrawMatchesFlag { final int value; } -void drawKeyPoints(Mat src, VecKeyPoint keypoints, Mat dst, Scalar color, DrawMatchesFlag flag) { - cvRun(() => CFFI.DrawKeyPoints(src.ref, keypoints.ref, dst.ref, color.ref, flag.value)); +void drawKeyPoints( + Mat src, + VecKeyPoint keypoints, + Mat dst, + Scalar color, + DrawMatchesFlag flag, +) { + cvRun( + () => CFFI.DrawKeyPoints( + src.ref, + keypoints.ref, + dst.ref, + color.ref, + flag.value, + ), + ); } /// SIFT is a wrapper around the cv::SIFT. @@ -859,6 +913,7 @@ class SIFT extends CvStruct { finalizer.attach(this, ptr.cast(), detach: this); } } + factory SIFT.fromPointer(cvg.SIFTPtr ptr, [bool attach = true]) => SIFT._(ptr, attach); /// returns a new SIFT algorithm /// @@ -887,7 +942,9 @@ class SIFT extends CvStruct { (VecKeyPoint, Mat) detectAndCompute(Mat src, Mat mask) { final desc = Mat.empty(); final ret = calloc(); - cvRun(() => CFFI.SIFT_DetectAndCompute(ptr.ref, src.ref, mask.ref, desc.ref, ret)); + cvRun( + () => CFFI.SIFT_DetectAndCompute(ptr.ref, src.ref, mask.ref, desc.ref, ret), + ); return (VecKeyPoint.fromPointer(ret), desc); } @@ -905,10 +962,10 @@ class SIFT extends CvStruct { cvg.SIFT get ref => ptr.ref; } -// DrawMatches draws matches on combined train and querry images. -// -// For further details, please see: -// https://docs.opencv.org/master/d4/d5d/group__features2d__draw.html#gad8f463ccaf0dc6f61083abd8717c261a +/// DrawMatches draws matches on combined train and querry images. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d4/d5d/group__features2d__draw.html#gad8f463ccaf0dc6f61083abd8717c261a void drawMatches( InputArray img1, VecKeyPoint keypoints1, diff --git a/lib/src/features2d/features2d_async.dart b/lib/src/features2d/features2d_async.dart new file mode 100644 index 00000000..11c39690 --- /dev/null +++ b/lib/src/features2d/features2d_async.dart @@ -0,0 +1,538 @@ +// ignore_for_file: non_constant_identifier_names + +library cv; + +import '../constants.g.dart'; +import '../core/base.dart'; +import '../core/dmatch.dart'; +import '../core/keypoint.dart'; +import '../core/mat.dart'; +import '../core/scalar.dart'; +import '../core/vec.dart'; +import '../opencv.g.dart' as cvg; +import './features2d.dart'; + +extension AKAZEAsync on AKAZE { + /// returns a new AKAZE algorithm + /// + /// For further details, please see: + /// https://docs.opencv.org/master/d8/d30/classcv_1_1AKAZE.html + static Future emptyAsync() async => cvRunAsync( + CFFI.AKAZE_Create_Async, + (c, p) => c.complete(AKAZE.fromPointer(p.cast())), + ); + + /// Detect keypoints in an image using AKAZE. + /// + /// For further details, please see: + /// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887 + Future detectAsync(Mat src) async { + final rval = cvRunAsync( + (callback) => CFFI.AKAZE_Detect_Async(ref, src.ref, callback), + (c, ret) => c.complete(VecKeyPoint.fromPointer(ret.cast())), + ); + return rval; + } + + /// DetectAndCompute keypoints and compute in an image using AKAZE. + /// + /// For further details, please see: + /// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#a8be0d1c20b08eb867184b8d74c15a677 + Future<(VecKeyPoint, Mat)> detectAndComputeAsync(Mat src, Mat mask) async => + cvRunAsync2<(VecKeyPoint, Mat)>( + (callback) => CFFI.AKAZE_DetectAndCompute_Async( + ref, + src.ref, + mask.ref, + callback, + ), + (c, keypoints, desc) => c.complete( + ( + VecKeyPoint.fromPointer(keypoints.cast()), + Mat.fromPointer(desc.cast()), + ), + ), + ); +} + +extension AgastFeatureDetectorAsync on AgastFeatureDetector { + /// returns a new AgastFeatureDetector algorithm + /// + /// For further details, please see: + /// https://docs.opencv.org/master/d7/d19/classcv_1_1AgastFeatureDetector.html + static Future emptyAsync() async => cvRunAsync( + CFFI.AgastFeatureDetector_Create_Async, + (c, p) => c.complete(AgastFeatureDetector.fromPointer(p.cast())), + ); + + /// Detect keypoints in an image using AgastFeatureDetector. + /// + /// For further details, please see: + /// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887 + Future detectAsync(Mat src) async { + final rval = cvRunAsync( + (callback) => CFFI.AgastFeatureDetector_Detect_Async(ref, src.ref, callback), + (c, ret) => c.complete(VecKeyPoint.fromPointer(ret.cast())), + ); + return rval; + } +} + +extension BRISKAsync on BRISK { + /// returns a new BRISK algorithm + /// + /// For further details, please see: + /// https://docs.opencv.org/master/d8/d30/classcv_1_1AKAZE.html + static Future emptyAsync() async => cvRunAsync( + CFFI.BRISK_Create_Async, + (c, p) => c.complete(BRISK.fromPointer(p.cast())), + ); + + /// Detect keypoints in an image using BRISK. + /// + /// For further details, please see: + /// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887 + Future detectAsync(Mat src) async { + final rval = cvRunAsync( + (callback) => CFFI.BRISK_Detect_Async(ref, src.ref, callback), + (c, ret) => c.complete(VecKeyPoint.fromPointer(ret.cast())), + ); + return rval; + } + + /// DetectAndCompute keypoints and compute in an image using BRISK. + /// + /// For further details, please see: + /// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#a8be0d1c20b08eb867184b8d74c15a677 + Future<(VecKeyPoint, Mat)> detectAndComputeAsync(Mat src, Mat mask) async => + cvRunAsync2<(VecKeyPoint, Mat)>( + (callback) => CFFI.BRISK_DetectAndCompute_Async( + ref, + src.ref, + mask.ref, + callback, + ), + (c, keypoints, desc) => c.complete( + ( + VecKeyPoint.fromPointer(keypoints.cast()), + Mat.fromPointer(desc.cast()), + ), + ), + ); +} + +extension FastFeatureDetectorAsync on FastFeatureDetector { + /// returns a new FastFeatureDetector algorithm + /// + /// For further details, please see: + /// https://docs.opencv.org/master/df/d74/classcv_1_1FastFeatureDetector.html + static Future emptyAsync() async => cvRunAsync( + CFFI.FastFeatureDetector_Create_Async, + (c, p) => c.complete(FastFeatureDetector.fromPointer(p.cast())), + ); + + /// returns a new FastFeatureDetector algorithm with parameters + /// + /// For further details, please see: + /// https://docs.opencv.org/master/df/d74/classcv_1_1FastFeatureDetector.html#ab986f2ff8f8778aab1707e2642bc7f8e + static Future createAsync({ + int threshold = 10, + bool nonmaxSuppression = true, + FastFeatureDetectorType type = FastFeatureDetectorType.TYPE_9_16, + }) async => + cvRunAsync( + (callback) => CFFI.FastFeatureDetector_CreateWithParams_Async( + threshold, + nonmaxSuppression, + type.value, + callback, + ), + (c, p) => c.complete(FastFeatureDetector.fromPointer(p.cast())), + ); + + /// Detect keypoints in an image using FastFeatureDetector. + /// + /// For further details, please see: + /// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887 + Future detectAsync(Mat src) async { + final rval = cvRunAsync( + (callback) => CFFI.FastFeatureDetector_Detect_Async(ref, src.ref, callback), + (c, ret) => c.complete(VecKeyPoint.fromPointer(ret.cast())), + ); + return rval; + } +} + +extension GFTTDetectorAsync on GFTTDetector { + /// returns a new GFTTDetector algorithm + /// + /// For further details, please see: + /// https://docs.opencv.org/master/df/d21/classcv_1_1GFTTDetector.html + static Future emptyAsync() async => cvRunAsync( + CFFI.GFTTDetector_Create_Async, + (c, p) => c.complete(GFTTDetector.fromPointer(p.cast())), + ); + + /// Detect keypoints in an image using GFTTDetector. + /// + /// For further details, please see: + /// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887 + Future detectAsync(Mat src) async { + final rval = cvRunAsync( + (callback) => CFFI.GFTTDetector_Detect_Async(ref, src.ref, callback), + (c, ret) => c.complete(VecKeyPoint.fromPointer(ret.cast())), + ); + return rval; + } +} + +extension KAZEAsync on KAZE { + /// returns a new KAZE algorithm + /// + /// For further details, please see: + /// https://docs.opencv.org/master/d3/d61/classcv_1_1KAZE.html + static Future emptyAsync() async => cvRunAsync( + CFFI.KAZE_Create_Async, + (c, p) => c.complete(KAZE.fromPointer(p.cast())), + ); + + /// Detect keypoints in an image using KAZE. + /// + /// For further details, please see: + /// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887 + Future detectAsync(Mat src) async { + final rval = cvRunAsync( + (callback) => CFFI.KAZE_Detect_Async(ref, src.ref, callback), + (c, ret) => c.complete(VecKeyPoint.fromPointer(ret.cast())), + ); + return rval; + } + + /// DetectAndCompute keypoints and compute in an image using KAZE. + /// + /// For further details, please see: + /// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#a8be0d1c20b08eb867184b8d74c15a677 + Future<(VecKeyPoint, Mat)> detectAndComputeAsync(Mat src, Mat mask) async => + cvRunAsync2<(VecKeyPoint, Mat)>( + (callback) => CFFI.KAZE_DetectAndCompute_Async( + ref, + src.ref, + mask.ref, + callback, + ), + (c, keypoints, desc) => c.complete( + ( + VecKeyPoint.fromPointer(keypoints.cast()), + Mat.fromPointer(desc.cast()), + ), + ), + ); +} + +extension MSERAsync on MSER { + /// returns a new MSER algorithm + /// + /// For further details, please see: + /// https://docs.opencv.org/master/d3/d61/classcv_1_1KAZE.html + static Future emptyAsync() async => cvRunAsync( + CFFI.MSER_Create_Async, + (c, p) => c.complete(MSER.fromPointer(p.cast())), + ); + + /// Detect keypoints in an image using MSER. + /// + /// For further details, please see: + /// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887 + Future detectAsync(Mat src) async { + final rval = cvRunAsync( + (callback) => CFFI.MSER_Detect_Async(ref, src.ref, callback), + (c, ret) => c.complete(VecKeyPoint.fromPointer(ret.cast())), + ); + return rval; + } +} + +extension ORBAsync on ORB { + /// returns a new ORB algorithm + /// + /// For further details, please see: + /// https://docs.opencv.org/master/d3/d61/classcv_1_1KAZE.html + static Future emptyAsync() async => + cvRunAsync(CFFI.ORB_Create_Async, (c, p) => c.complete(ORB.fromPointer(p.cast()))); + + /// NewORBWithParams returns a new ORB algorithm with parameters + /// + /// For further details, please see: + /// https://docs.opencv.org/master/db/d95/classcv_1_1ORB.html#aeff0cbe668659b7ca14bb85ff1c4073b + static Future createAsync({ + int nFeatures = 500, + double scaleFactor = 1.2, + int nLevels = 8, + int edgeThreshold = 31, + int firstLevel = 0, + int WTA_K = 2, + ORBScoreType scoreType = ORBScoreType.HARRIS_SCORE, + int patchSize = 31, + int fastThreshold = 20, + }) async => + cvRunAsync( + (callback) => CFFI.ORB_CreateWithParams_Async( + nFeatures, + scaleFactor, + nLevels, + edgeThreshold, + firstLevel, + WTA_K, + scoreType.value, + patchSize, + fastThreshold, + callback, + ), + (c, p) => c.complete(ORB.fromPointer(p.cast())), + ); + + /// Detect keypoints in an image using ORB. + /// + /// For further details, please see: + /// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887 + Future detectAsync(Mat src) async { + final rval = cvRunAsync( + (callback) => CFFI.ORB_Detect_Async(ref, src.ref, callback), + (c, ret) => c.complete(VecKeyPoint.fromPointer(ret.cast())), + ); + return rval; + } + + /// DetectAndCompute keypoints and compute in an image using ORB. + /// + /// For further details, please see: + /// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#a8be0d1c20b08eb867184b8d74c15a677 + Future<(VecKeyPoint, Mat)> detectAndComputeAsync(Mat src, Mat mask) async => + cvRunAsync2<(VecKeyPoint, Mat)>( + (callback) => CFFI.ORB_DetectAndCompute_Async( + ref, + src.ref, + mask.ref, + callback, + ), + (c, keypoints, desc) => c.complete( + ( + VecKeyPoint.fromPointer(keypoints.cast()), + Mat.fromPointer(desc.cast()), + ), + ), + ); +} + +extension SimpleBlobDetectorAsync on SimpleBlobDetector { + /// returns a new SimpleBlobDetector algorithm + /// + /// For further details, please see: + /// https://docs.opencv.org/master/d3/d61/classcv_1_1KAZE.html + static Future emptyAsync() async => cvRunAsync( + CFFI.SimpleBlobDetector_Create_Async, + (c, p) => c.complete(SimpleBlobDetector.fromPointer(p.cast())), + ); + + static Future createAsync( + SimpleBlobDetectorParams params, + ) async => + cvRunAsync( + (callback) => CFFI.SimpleBlobDetector_Create_WithParams_Async( + params.ref, + callback, + ), + (c, p) => c.complete( + SimpleBlobDetector.fromPointer(p.cast()), + ), + ); + + /// Detect keypoints in an image using SimpleBlobDetector. + /// + /// For further details, please see: + /// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887 + Future detectAsync(Mat src) async { + final rval = cvRunAsync( + (callback) => CFFI.SimpleBlobDetector_Detect_Async(ref, src.ref, callback), + (c, ret) => c.complete(VecKeyPoint.fromPointer(ret.cast())), + ); + return rval; + } +} + +extension BFMatcherAsync on BFMatcher { + /// returns a new BFMatcher algorithm + /// + /// For further details, please see: + /// https://docs.opencv.org/master/d3/d61/classcv_1_1KAZE.html + static Future emptyAsync() async => cvRunAsync( + CFFI.BFMatcher_Create_Async, + (c, p) => c.complete(BFMatcher.fromPointer(p.cast())), + ); + + static Future createAsync({ + int type = NORM_L2, + bool crossCheck = false, + }) async => + cvRunAsync( + (callback) => CFFI.BFMatcher_CreateWithParams_Async(type, crossCheck, callback), + (c, p) => c.complete(BFMatcher.fromPointer(p.cast())), + ); + + /// Match Finds the best match for each descriptor from a query set. + /// + /// For further details, please see: + /// https://docs.opencv.org/4.x/db/d39/classcv_1_1DescriptorMatcher.html#a0f046f47b68ec7074391e1e85c750cba + Future matchAsync(Mat query, Mat train) async { + final rval = cvRunAsync( + (callback) => CFFI.BFMatcher_Match_Async(ref, query.ref, train.ref, callback), + (c, ret) => c.complete(VecDMatch.fromPointer(ret.cast())), + ); + return rval; + } + + /// KnnMatch Finds the k best matches for each descriptor from a query set. + /// + /// For further details, please see: + /// https://docs.opencv.org/master/db/d39/classcv_1_1DescriptorMatcher.html#aa880f9353cdf185ccf3013e08210483a + Future knnMatchAsync(Mat query, Mat train, int k) async { + final rval = cvRunAsync( + (callback) => CFFI.BFMatcher_KnnMatch_Async( + ref, + query.ref, + train.ref, + k, + callback, + ), + (c, ret) => c.complete(VecVecDMatch.fromPointer(ret.cast())), + ); + return rval; + } +} + +extension FlannBasedMatcherAsync on FlannBasedMatcher { + /// returns a new FlannBasedMatcher algorithm + /// + /// For further details, please see: + /// https://docs.opencv.org/master/d3/d61/classcv_1_1KAZE.html + static Future emptyAsync() async => cvRunAsync( + CFFI.FlannBasedMatcher_Create_Async, + (c, p) => c.complete(FlannBasedMatcher.fromPointer(p.cast())), + ); + + /// KnnMatch Finds the k best matches for each descriptor from a query set. + /// + /// For further details, please see: + /// https://docs.opencv.org/master/db/d39/classcv_1_1DescriptorMatcher.html#aa880f9353cdf185ccf3013e08210483a + Future knnMatchAsync(Mat query, Mat train, int k) async { + final rval = cvRunAsync( + (callback) => CFFI.FlannBasedMatcher_KnnMatch_Async( + ref, + query.ref, + train.ref, + k, + callback, + ), + (c, ret) => c.complete(VecVecDMatch.fromPointer(ret.cast())), + ); + return rval; + } +} + +extension SIFTAsync on SIFT { + /// returns a new SIFT algorithm + /// + /// For further details, please see: + /// https://docs.opencv.org/master/d5/d3c/classcv_1_1xfeatures2d_1_1SIFT.html + static Future emptyAsync() async => + cvRunAsync(CFFI.SIFT_Create_Async, (c, p) => c.complete(SIFT.fromPointer(p.cast()))); + + /// Detect keypoints in an image using SIFT. + /// + /// For further details, please see: + /// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887 + Future detectAsync(Mat src) async { + final rval = cvRunAsync( + (callback) => CFFI.SIFT_Detect_Async(ref, src.ref, callback), + (c, ret) => c.complete(VecKeyPoint.fromPointer(ret.cast())), + ); + return rval; + } + + /// DetectAndCompute keypoints and compute in an image using SIFT. + /// + /// For further details, please see: + /// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#a8be0d1c20b08eb867184b8d74c15a677 + Future<(VecKeyPoint, Mat)> detectAndComputeAsync(Mat src, Mat mask) async => + cvRunAsync2<(VecKeyPoint, Mat)>( + (callback) => CFFI.SIFT_DetectAndCompute_Async( + ref, + src.ref, + mask.ref, + callback, + ), + (c, keypoints, desc) => c.complete( + ( + VecKeyPoint.fromPointer(keypoints.cast()), + Mat.fromPointer(desc.cast()), + ), + ), + ); +} + +Future drawKeyPointsAsync( + Mat src, + VecKeyPoint keypoints, + Mat dst, + Scalar color, + DrawMatchesFlag flag, +) async { + await cvRunAsync0( + (callback) => CFFI.DrawKeyPoints_Async( + src.ref, + keypoints.ref, + dst.ref, + color.ref, + flag.value, + callback, + ), + (c) => c.complete(), + ); +} + +/// DrawMatches draws matches on combined train and querry images. +/// +/// For further details, please see: +/// https://docs.opencv.org/master/d4/d5d/group__features2d__draw.html#gad8f463ccaf0dc6f61083abd8717c261a +Future drawMatchesAsync( + InputArray img1, + VecKeyPoint keypoints1, + InputArray img2, + VecKeyPoint keypoints2, + VecDMatch matches1to2, + InputOutputArray outImg, { + Scalar? matchColor, + Scalar? singlePointColor, + VecChar? matchesMask, + DrawMatchesFlag flags = DrawMatchesFlag.DEFAULT, +}) async { + matchColor ??= Scalar.all(-1); + singlePointColor ??= Scalar.all(-1); + matchesMask ??= VecChar(); + await cvRunAsync0( + (callback) => CFFI.DrawMatches_Async( + img1.ref, + keypoints1.ref, + img2.ref, + keypoints2.ref, + matches1to2.ref, + outImg.ref, + matchColor!.ref, + singlePointColor!.ref, + matchesMask!.ref, + flags.value, + callback, + ), + (c) => c.complete(), + ); +} diff --git a/lib/src/gapi/gapi.dart b/lib/src/gapi/gapi.dart new file mode 100644 index 00000000..e1a801a0 --- /dev/null +++ b/lib/src/gapi/gapi.dart @@ -0,0 +1,28 @@ +library cv; + +import 'dart:ffi' as ffi; + +import 'package:ffi/ffi.dart'; + +// import '../constants.g.dart'; +import '../core/base.dart'; +// import '../core/dmatch.dart'; +// import '../core/keypoint.dart'; +// import '../core/mat.dart'; +// import '../core/scalar.dart'; +// import '../core/vec.dart'; +import '../opencv.g.dart' as cvg; +import 'gmat.dart'; +import 'gscalar.dart'; + +GMat addMat(GMat a, GMat b, {int ddepth = -1}) { + final p = calloc(); + cvRun(() => CFFI.gapi_add(a.ref, b.ref, ddepth, p)); + return GMat.fromPointer(p); +} + +GMat addC(GMat a, GScalar b, {int ddepth = -1}) { + final p = calloc(); + cvRun(() => CFFI.gapi_addC(a.ref, b.ref, ddepth, p)); + return GMat.fromPointer(p); +} diff --git a/lib/src/gapi/gcomputation.dart b/lib/src/gapi/gcomputation.dart new file mode 100644 index 00000000..714e6909 --- /dev/null +++ b/lib/src/gapi/gcomputation.dart @@ -0,0 +1,86 @@ +library cv; + +import 'dart:async'; +import 'dart:ffi' as ffi; +import 'dart:ffi'; + +import 'package:ffi/ffi.dart'; + +import '../core/base.dart'; +import '../core/mat.dart'; +import '../core/scalar.dart'; +import '../opencv.g.dart' as cvg; +import 'gmat.dart'; +import 'gscalar.dart'; + +class GComputation extends CvStruct { + GComputation.fromPointer(super.ptr, [bool attach = true]) : super.fromPointer() { + if (attach) { + finalizer.attach(this, ptr.cast()); + } + } + + factory GComputation.mimo(GMat inMat, GMat outMat) { + final p = calloc(); + cvRun(() => CFFI.gapi_GComputation_New(inMat.ref, outMat.ref, p)); + return GComputation.fromPointer(p); + } + + factory GComputation.miso(GMat inMat, GScalar outScalar) { + final p = calloc(); + cvRun(() => CFFI.gapi_GComputation_New_1(inMat.ref, outScalar.ref, p)); + return GComputation.fromPointer(p); + } + + factory GComputation.mimimo(GMat in1, GMat in2, GMat out) { + final p = calloc(); + cvRun(() => CFFI.gapi_GComputation_New_2(in1.ref, in2.ref, out.ref, p)); + return GComputation.fromPointer(p); + } + + factory GComputation.mimiso(GMat in1, GMat in2, GScalar out) { + final p = calloc(); + cvRun(() => CFFI.gapi_GComputation_New_3(in1.ref, in2.ref, out.ref, p)); + return GComputation.fromPointer(p); + } + + Future apply(Mat inMat) async => + cvRunAsync((callback) => CFFI.gapi_GComputation_apply(ref, inMat.ref, callback), matCompleter); + + // Mat applyMIMO(Mat inMat) => apply(inMat); + + Scalar applyMISO(Mat inMat) { + final p = calloc(); + cvRun(() => CFFI.gapi_GComputation_apply_1(ref, inMat.ref, p)); + return Scalar.fromPointer(p); + } + + Mat applyMIMIMO(Mat in1, Mat in2) { + final p = calloc(); + cvRun(() => CFFI.gapi_GComputation_apply_2(ref, in1.ref, in2.ref, p)); + return Mat.fromPointer(p); + } + + Scalar applyMIMISO(Mat in1, Mat in2) { + final p = calloc(); + cvRun(() => CFFI.gapi_GComputation_apply_3(ref, in1.ref, in2.ref, p)); + return Scalar.fromPointer(p); + } + + static final finalizer = OcvFinalizer(CFFI.addresses.gapi_GComputation_Close); + void dispose() { + finalizer.detach(this); + CFFI.gapi_GComputation_Close(ptr); + } + + @override + List get props => [ptr.address]; + + @override + cvg.GComputation get ref => ptr.ref; + + @override + String toString() { + return "GComputation(address=${ptr.address.toRadixString(16)}))"; + } +} diff --git a/lib/src/gapi/gmat.dart b/lib/src/gapi/gmat.dart new file mode 100644 index 00000000..7d48f54a --- /dev/null +++ b/lib/src/gapi/gmat.dart @@ -0,0 +1,51 @@ +library cv; + +import 'dart:ffi' as ffi; + +import 'package:ffi/ffi.dart'; + +// import '../constants.g.dart'; +import '../core/base.dart'; +// import '../core/dmatch.dart'; +// import '../core/keypoint.dart'; +import '../core/mat.dart'; +// import '../core/scalar.dart'; +// import '../core/vec.dart'; +import '../opencv.g.dart' as cvg; + +class GMat extends CvStruct { + GMat.fromPointer(super.ptr, [bool attach = true]) : super.fromPointer() { + if (attach) { + finalizer.attach(this, ptr.cast()); + } + } + + factory GMat.empty() { + final p = calloc(); + cvRun(() => CFFI.gapi_GMat_New_Empty(p)); + return GMat.fromPointer(p); + } + + factory GMat.fromMat(Mat mat) { + final p = calloc(); + cvRun(() => CFFI.gapi_GMat_New_FromMat(mat.ref, p)); + return GMat.fromPointer(p); + } + + static final finalizer = OcvFinalizer(CFFI.addresses.gapi_GMat_Close); + void dispose() { + finalizer.detach(this); + CFFI.gapi_GMat_Close(ptr); + } + + @override + List get props => [ptr.address]; + + @override + cvg.GMat get ref => ptr.ref; + + @override + String toString() { + return "GMat(address=${ptr.address.toRadixString(16)}))"; + } +} diff --git a/lib/src/gapi/gscalar.dart b/lib/src/gapi/gscalar.dart new file mode 100644 index 00000000..509815f2 --- /dev/null +++ b/lib/src/gapi/gscalar.dart @@ -0,0 +1,57 @@ +library cv; + +import 'dart:ffi' as ffi; + +import 'package:ffi/ffi.dart'; + +// import '../constants.g.dart'; +import '../core/base.dart'; +// import '../core/dmatch.dart'; +// import '../core/keypoint.dart'; +// import '../core/mat.dart'; +import '../core/scalar.dart'; +// import '../core/vec.dart'; +import '../opencv.g.dart' as cvg; + +class GScalar extends CvStruct { + GScalar.fromPointer(super.ptr, [bool attach = true]) : super.fromPointer() { + if (attach) { + finalizer.attach(this, ptr.cast()); + } + } + + factory GScalar.empty() { + final p = calloc(); + cvRun(() => CFFI.gapi_GScalar_New_Empty(p)); + return GScalar.fromPointer(p); + } + + factory GScalar.fromScalar(Scalar s) { + final p = calloc(); + cvRun(() => CFFI.gapi_GScalar_New_FromScalar(s.ref, p)); + return GScalar.fromPointer(p); + } + + factory GScalar(double value) { + final p = calloc(); + cvRun(() => CFFI.gapi_GScalar_New_FromDouble(value, p)); + return GScalar.fromPointer(p); + } + + static final finalizer = OcvFinalizer(CFFI.addresses.gapi_GScalar_Close); + void dispose() { + finalizer.detach(this); + CFFI.gapi_GScalar_Close(ptr); + } + + @override + List get props => [ptr.address]; + + @override + cvg.GScalar get ref => ptr.ref; + + @override + String toString() { + return "GScalar(address=${ptr.address.toRadixString(16)}))"; + } +} diff --git a/lib/src/imgcodecs/imgcodecs_async.dart b/lib/src/imgcodecs/imgcodecs_async.dart new file mode 100644 index 00000000..7c914689 --- /dev/null +++ b/lib/src/imgcodecs/imgcodecs_async.dart @@ -0,0 +1,88 @@ +library cv; + +import 'dart:ffi' as ffi; +import 'dart:typed_data'; + +import 'package:ffi/ffi.dart'; + +import '../constants.g.dart'; +import '../core/base.dart'; +import '../core/mat.dart'; +import '../core/vec.dart'; + +/// IMRead reads an image from a file into a Mat. +/// The flags param is one of the IMReadFlag flags. +/// If the image cannot be read (because of missing file, improper permissions, +/// unsupported or invalid format), the function returns an empty Mat. +/// +/// For further details, please see: +/// http://docs.opencv.org/master/d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56 +Future imreadAsync(String filename, {int flags = IMREAD_COLOR}) async { + final cname = filename.toNativeUtf8().cast(); + final rval = cvRunAsync((callback) => CFFI.Image_IMRead_Async(cname, flags, callback), matCompleter); + calloc.free(cname); + return rval; +} + +/// IMWrite writes a Mat to an image file. +/// +/// For further details, please see: +/// http://docs.opencv.org/master/d4/da8/group__imgcodecs.html#gabbc7ef1aa2edfaa87772f1202d67e0ce +Future imwriteAsync(String filename, InputArray img, {VecInt? params}) async { + final cname = filename.toNativeUtf8().cast(); + final rval = cvRunAsync( + (callback) => params == null + ? CFFI.Image_IMWrite_Async(cname, img.ref, callback) + : CFFI.Image_IMWrite_WithParams_Async(cname, img.ref, params.ref, callback), + (c, p) { + final rval = p.cast().value; + calloc.free(p); + return c.complete(rval); + }, + ); + calloc.free(cname); + return rval; +} + +/// IMEncode encodes an image Mat into a memory buffer. +/// This function compresses the image and stores it in the returned memory buffer, +/// using the image format passed in in the form of a file extension string. +/// +/// For further details, please see: +/// http://docs.opencv.org/master/d4/da8/group__imgcodecs.html#ga461f9ac09887e47797a54567df3b8b63 +Future<(bool, Uint8List)> imencodeAsync( + String ext, + InputArray img, { + VecInt? params, +}) async { + final cExt = ext.toNativeUtf8().cast(); + final rval = cvRunAsync2<(bool, Uint8List)>( + (callback) => params == null + ? CFFI.Image_IMEncode_Async(cExt, img.ref, callback) + : CFFI.Image_IMEncode_WithParams_Async(cExt, img.ref, params.ref, callback), + (c, p, p1) { + final v = p.cast().value; + calloc.free(p); + final vec = VecUChar.fromPointer(p1.cast()); + final data = vec.toU8List(); + vec.dispose(); + return c.complete((v, data)); + }, + ); + return rval; +} + +/// imdecode reads an image from a buffer in memory. +/// The function imdecode reads an image from the specified buffer in memory. +/// If the buffer is too short or contains invalid data, the function +/// returns an empty matrix. +/// @param buf Input array or vector of bytes. +/// @param flags The same flags as in cv::imread, see cv::ImreadModes. +/// For further details, please see: +/// https://docs.opencv.org/master/d4/da8/group__imgcodecs.html#ga26a67788faa58ade337f8d28ba0eb19e +Future imdecodeAsync(Uint8List buf, int flags) async { + final vec = VecUChar.fromList(buf); + final rval = cvRunAsync((callback) => CFFI.Image_IMDecode_Async(vec.ref, flags, callback), matCompleter); + vec.dispose(); + return rval; +} diff --git a/lib/src/imgproc/clahe.dart b/lib/src/imgproc/clahe.dart index 93d773dd..f4f2d853 100644 --- a/lib/src/imgproc/clahe.dart +++ b/lib/src/imgproc/clahe.dart @@ -12,18 +12,21 @@ class CLAHE extends CvStruct { finalizer.attach(this, ptr.cast(), detach: this); } } - factory CLAHE.fromNative(cvg.CLAHEPtr ptr) => CLAHE._(ptr); + factory CLAHE.fromPointer(cvg.CLAHEPtr ptr) => CLAHE._(ptr); factory CLAHE.empty() { final p = calloc(); CFFI.CLAHE_Create(p); return CLAHE._(p); } + factory CLAHE([double clipLimit = 40, (int width, int height) tileGridSize = (8, 8)]) => + CLAHE.create(clipLimit, tileGridSize); + /// NewCLAHE returns a new CLAHE algorithm /// /// For further details, please see: /// https:///docs.opencv.org/master/d6/db6/classcv_1_1CLAHE.html - factory CLAHE([double clipLimit = 40, (int width, int height) tileGridSize = (8, 8)]) { + factory CLAHE.create([double clipLimit = 40, (int width, int height) tileGridSize = (8, 8)]) { final p = calloc(); final size = calloc() ..ref.width = tileGridSize.$1 @@ -56,21 +59,12 @@ class CLAHE extends CvStruct { } Size get tilesGridSize { - return cvRunArena((arena) { - final p = arena(); - cvRun(() => CFFI.CLAHE_GetTilesGridSize(ref, p)); - return (p.ref.width, p.ref.height); - }); + final p = calloc(); + cvRun(() => CFFI.CLAHE_GetTilesGridSize(ref, p)); + return Size.fromPointer(p); } - set tilesGridSize(Size value) { - cvRunArena((arena) { - final p = arena() - ..ref.width = value.$1 - ..ref.height = value.$2; - cvRun(() => CFFI.CLAHE_SetTilesGridSize(ref, p.ref)); - }); - } + set tilesGridSize(Size value) => cvRun(() => CFFI.CLAHE_SetTilesGridSize(ref, value.ref)); static final finalizer = OcvFinalizer(CFFI.addresses.CLAHE_Close); diff --git a/lib/src/imgproc/clahe_async.dart b/lib/src/imgproc/clahe_async.dart new file mode 100644 index 00000000..c026830c --- /dev/null +++ b/lib/src/imgproc/clahe_async.dart @@ -0,0 +1,19 @@ +import '../core/base.dart'; +import '../core/mat.dart'; +import '../core/size.dart'; +import '../opencv.g.dart' as cvg; +import 'clahe.dart'; + +extension CLAHEAsync on CLAHE { + static Future createAsync([ + double clipLimit = 40, + (int width, int height) tileGridSize = (8, 8), + ]) async => + cvRunAsync( + (callback) => CFFI.CLAHE_CreateWithParams_Async(clipLimit, tileGridSize.cvd.ref, callback), + (c, p) => c.complete(CLAHE.fromPointer(p.cast())), + ); + + Future applyAsync(Mat src) async => + cvRunAsync((callback) => CFFI.CLAHE_Apply_Async(ref, src.ref, callback), matCompleter); +} diff --git a/lib/src/imgproc/imgproc.dart b/lib/src/imgproc/imgproc.dart index f8a0d977..c41ab7de 100644 --- a/lib/src/imgproc/imgproc.dart +++ b/lib/src/imgproc/imgproc.dart @@ -3,6 +3,7 @@ library cv; import 'dart:ffi' as ffi; +import 'dart:ffi'; import 'package:ffi/ffi.dart'; @@ -125,7 +126,7 @@ Mat calcBackProject( Mat hist, VecFloat ranges, { Mat? dst, - bool uniform = true, + double scale = 1.0, }) { dst ??= Mat.empty(); cvRun( @@ -135,7 +136,7 @@ Mat calcBackProject( hist.ref, dst!.ref, ranges.ref, - uniform, + scale, ), ); return dst; @@ -185,36 +186,30 @@ Mat bilateralFilter(Mat src, int diameter, double sigmaColor, double sigmaSpace, /// /// For further details, please see: /// https:///docs.opencv.org/master/d4/d86/group__imgproc__filter.html#ga8c45db9afe636703801b0b2e440fce37 -Mat blur(Mat src, Size ksize, {Mat? dst}) { - return using((arena) { - dst ??= Mat.empty(); - cvRun(() => CFFI.Blur(src.ref, dst!.ref, ksize.toSize(arena).ref)); - return dst!; - }); +Mat blur(Mat src, (int, int) ksize, {Mat? dst}) { + dst ??= Mat.empty(); + cvRun(() => CFFI.Blur(src.ref, dst!.ref, ksize.cvd.ref)); + return dst; } /// BoxFilter blurs an image using the box filter. /// /// For further details, please see: /// https:///docs.opencv.org/master/d4/d86/group__imgproc__filter.html#gad533230ebf2d42509547d514f7d3fbc3 -Mat boxFilter(Mat src, int depth, Size ksize, {Mat? dst}) { - return using((arena) { - dst ??= Mat.empty(); - cvRun(() => CFFI.BoxFilter(src.ref, dst!.ref, depth, ksize.toSize(arena).ref)); - return dst!; - }); +Mat boxFilter(Mat src, int depth, (int, int) ksize, {Mat? dst}) { + dst ??= Mat.empty(); + cvRun(() => CFFI.BoxFilter(src.ref, dst!.ref, depth, ksize.cvd.ref)); + return dst; } /// SqBoxFilter calculates the normalized sum of squares of the pixel values overlapping the filter. /// /// For further details, please see: /// https://docs.opencv.org/4.x/d4/d86/group__imgproc__filter.html#ga76e863e7869912edbe88321253b72688 -Mat sqrBoxFilter(Mat src, int depth, Size ksize, {Mat? dst}) { - return using((arena) { - dst ??= Mat.empty(); - cvRun(() => CFFI.SqBoxFilter(src.ref, dst!.ref, depth, ksize.toSize(arena).ref)); - return dst!; - }); +Mat sqrBoxFilter(Mat src, int depth, (int, int) ksize, {Mat? dst}) { + dst ??= Mat.empty(); + cvRun(() => CFFI.SqBoxFilter(src.ref, dst!.ref, depth, ksize.cvd.ref)); + return dst; } /// Dilate dilates an image by using a specific structuring element. @@ -470,9 +465,7 @@ Mat pyrDown( int borderType = BORDER_DEFAULT, }) { dst ??= Mat.empty(); - using((arena) { - cvRun(() => CFFI.PyrDown(src.ref, dst!.ref, dstsize.toSize(arena).ref, borderType)); - }); + cvRun(() => CFFI.PyrDown(src.ref, dst!.ref, dstsize.cvd.ref, borderType)); return dst; } @@ -487,9 +480,7 @@ Mat pyrUp( int borderType = BORDER_DEFAULT, }) { dst ??= Mat.empty(); - using((arena) { - cvRun(() => CFFI.PyrUp(src.ref, dst!.ref, dstsize.toSize(arena).ref, borderType)); - }); + cvRun(() => CFFI.PyrUp(src.ref, dst!.ref, dstsize.cvd.ref, borderType)); return dst; } @@ -541,13 +532,11 @@ Mat morphologyEx( /// /// For further details, please see: /// https:///docs.opencv.org/master/d4/d86/group__imgproc__filter.html#gac342a1bb6eabf6f55c803b09268e36dc -Mat getStructuringElement(int shape, Size ksize, {Point? anchor}) { +Mat getStructuringElement(int shape, (int, int) ksize, {Point? anchor}) { anchor ??= Point(-1, -1); - return cvRunArena((arena) { - final r = calloc(); - cvRun(() => CFFI.GetStructuringElement(shape, ksize.toSize(arena).ref, r)); - return Mat.fromPointer(r); - }); + final r = calloc(); + cvRun(() => CFFI.GetStructuringElement(shape, ksize.cvd.ref, r)); + return Mat.fromPointer(r); } /// GaussianBlur blurs an image Mat using a Gaussian filter. @@ -558,16 +547,14 @@ Mat getStructuringElement(int shape, Size ksize, {Point? anchor}) { /// http:///docs.opencv.org/master/d4/d86/group__imgproc__filter.html#gaabe8c836e97159a9193fb0b11ac52cf1 Mat gaussianBlur( Mat src, - Size ksize, + (int, int) ksize, double sigmaX, { Mat? dst, double sigmaY = 0, int borderType = BORDER_DEFAULT, }) { dst ??= Mat.empty(); - cvRunArena((arena) { - cvRun(() => CFFI.GaussianBlur(src.ref, dst!.ref, ksize.toSize(arena).ref, sigmaX, sigmaY, borderType)); - }); + cvRun(() => CFFI.GaussianBlur(src.ref, dst!.ref, ksize.cvd.ref, sigmaX, sigmaY, borderType)); return dst; } @@ -696,16 +683,14 @@ Mat canny( VecPoint2f cornerSubPix( InputArray image, VecPoint2f corners, - Size winSize, - Size zeroZone, [ - TermCriteria criteria = (TERM_COUNT + TERM_EPS, 30, 1e-4), + (int, int) winSize, + (int, int) zeroZone, [ + (int, int, double) criteria = (TERM_COUNT + TERM_EPS, 30, 1e-4), ]) { - cvRunArena((arena) { - final size = winSize.toSize(arena); - final zone = zeroZone.toSize(arena); - final c = criteria.toNativePtr(arena); - cvRun(() => CFFI.CornerSubPix(image.ref, corners.ref, size.ref, zone.ref, c.ref)); - }); + final size = winSize.cvd; + final zone = zeroZone.cvd; + final c = criteria.toTermCriteria(); + cvRun(() => CFFI.CornerSubPix(image.ref, corners.ref, size.ref, zone.ref, c.ref)); return corners; } @@ -1117,11 +1102,10 @@ Mat polylines( ) { return using<(Size, int)>((arena) { final baseline = arena(); - final size = arena(); + final size = calloc(); final textPtr = text.toNativeUtf8(allocator: arena); cvRun(() => CFFI.GetTextSizeWithBaseline(textPtr.cast(), fontFace, fontScale, thickness, baseline, size)); - final Size sz = (size.ref.width, size.ref.height); - return (sz, baseline.value); + return (Size.fromPointer(size), baseline.value); }); } @@ -1143,22 +1127,21 @@ Mat putText( int lineType = LINE_8, bool bottomLeftOrigin = false, }) { - using((arena) { - final textPtr = text.toNativeUtf8(allocator: arena).cast(); - cvRun( - () => CFFI.PutTextWithParams( - img.ref, - textPtr, - org.ref, - fontFace, - fontScale, - color.ref, - thickness, - lineType, - bottomLeftOrigin, - ), - ); - }); + final textPtr = text.toNativeUtf8().cast(); + cvRun( + () => CFFI.PutTextWithParams( + img.ref, + textPtr, + org.ref, + fontFace, + fontScale, + color.ref, + thickness, + lineType, + bottomLeftOrigin, + ), + ); + calloc.free(textPtr); return img; } @@ -1173,16 +1156,14 @@ Mat putText( /// https:///docs.opencv.org/master/da/d54/group__imgproc__transform.html#ga47a974309e9102f5f08231edc7e7529d Mat resize( InputArray src, - Size dsize, { + (int, int) dsize, { OutputArray? dst, double fx = 0, double fy = 0, int interpolation = INTER_LINEAR, }) { dst ??= Mat.empty(); - using((arena) { - cvRun(() => CFFI.Resize(src.ref, dst!.ref, dsize.toSize(arena).ref, fx, fy, interpolation)); - }); + cvRun(() => CFFI.Resize(src.ref, dst!.ref, dsize.cvd.ref, fx, fy, interpolation)); return dst; } @@ -1192,22 +1173,13 @@ Mat resize( /// https:///docs.opencv.org/master/da/d54/group__imgproc__transform.html#ga77576d06075c1a4b6ba1a608850cd614 Mat getRectSubPix( InputArray image, - Size patchSize, + (int, int) patchSize, Point2f center, { OutputArray? patch, int patchType = -1, }) { patch ??= Mat.empty(); - using((arena) { - cvRun( - () => CFFI.GetRectSubPix( - image.ref, - patchSize.toSize(arena).ref, - center.ref, - patch!.ref, - ), - ); - }); + cvRun(() => CFFI.GetRectSubPix(image.ref, patchSize.cvd.ref, center.ref, patch!.ref)); return patch; } @@ -1228,7 +1200,7 @@ Mat getRotationMatrix2D(Point2f center, double angle, double scale) { Mat warpAffine( InputArray src, InputArray M, - Size dsize, { + (int, int) dsize, { OutputArray? dst, int flags = INTER_LINEAR, int borderMode = BORDER_CONSTANT, @@ -1236,19 +1208,17 @@ Mat warpAffine( }) { dst ??= Mat.empty(); borderValue ??= Scalar.default_(); - using((arena) { - cvRun( - () => CFFI.WarpAffineWithParams( - src.ref, - dst!.ref, - M.ref, - dsize.toSize(arena).ref, - flags, - borderMode, - borderValue!.ref, - ), - ); - }); + cvRun( + () => CFFI.WarpAffineWithParams( + src.ref, + dst!.ref, + M.ref, + dsize.cvd.ref, + flags, + borderMode, + borderValue!.ref, + ), + ); return dst; } @@ -1260,7 +1230,7 @@ Mat warpAffine( Mat warpPerspective( InputArray src, InputArray M, - Size dsize, { + (int, int) dsize, { OutputArray? dst, int flags = INTER_LINEAR, int borderMode = BORDER_CONSTANT, @@ -1268,19 +1238,17 @@ Mat warpPerspective( }) { dst ??= Mat.empty(); borderValue ??= Scalar.default_(); - using((arena) { - cvRun( - () => CFFI.WarpPerspectiveWithParams( - src.ref, - dst!.ref, - M.ref, - dsize.toSize(arena).ref, - flags, - borderMode, - borderValue!.ref, - ), - ); - }); + cvRun( + () => CFFI.WarpPerspectiveWithParams( + src.ref, + dst!.ref, + M.ref, + dsize.cvd.ref, + flags, + borderMode, + borderValue!.ref, + ), + ); return dst; } diff --git a/lib/src/imgproc/imgproc_async.dart b/lib/src/imgproc/imgproc_async.dart new file mode 100644 index 00000000..24e89090 --- /dev/null +++ b/lib/src/imgproc/imgproc_async.dart @@ -0,0 +1,1503 @@ +// ignore_for_file: non_constant_identifier_names + +library cv; + +import 'dart:async'; +import 'dart:ffi' as ffi; +import 'dart:ffi'; + +import 'package:ffi/ffi.dart'; + +import '../constants.g.dart'; +import '../core/base.dart'; +import '../core/contours.dart'; +import '../core/mat.dart'; +import '../core/moments.dart'; +import '../core/point.dart'; +import '../core/rect.dart'; +import '../core/scalar.dart'; +import '../core/size.dart'; +import '../core/termcriteria.dart'; +import '../core/vec.dart'; +import '../opencv.g.dart' as cvg; + +/// ApproxPolyDP approximates a polygonal curve(s) with the specified precision. +/// +/// For further details, please see: +/// +/// https:///docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#ga0012a5fdaea70b8a9970165d98722b4c +Future approxPolyDPAsync(VecPoint curve, double epsilon, bool closed) async => cvRunAsync( + (callback) => CFFI.ApproxPolyDP_Async(curve.ref, epsilon, closed, callback), + vecPointCompleter, + ); + +/// ArcLength calculates a contour perimeter or a curve length. +/// +/// For further details, please see: +/// +/// https:///docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#ga8d26483c636be6b35c3ec6335798a47c +Future arcLengthAsync(VecPoint curve, bool closed) async => + cvRunAsync((callback) => CFFI.ArcLength_Async(curve.ref, closed, callback), doubleCompleter); + +/// ConvexHull finds the convex hull of a point set. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#ga014b28e56cb8854c0de4a211cb2be656 +Future convexHullAsync( + VecPoint points, { + Mat? hull, + bool clockwise = false, + bool returnPoints = true, +}) async => + cvRunAsync( + (callback) => CFFI.ConvexHull_Async(points.ref, clockwise, returnPoints, callback), + matCompleter, + ); + +/// ConvexityDefects finds the convexity defects of a contour. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#gada4437098113fd8683c932e0567f47ba +Future convexityDefectsAsync(VecPoint contour, Mat hull, {Mat? convexityDefects}) async => + cvRunAsync((callback) => CFFI.ConvexityDefects_Async(contour.ref, hull.ref, callback), matCompleter); + +/// CvtColor converts an image from one color space to another. +/// It converts the src Mat image to the dst Mat using the +/// code param containing the desired ColorConversionCode color space. +/// +/// For further details, please see: +/// http:///docs.opencv.org/master/d7/d1b/group__imgproc__misc.html#ga4e0972be5de079fed4e3a10e24ef5ef0 +Future cvtColorAsync(Mat src, int code) async => + cvRunAsync((callback) => CFFI.CvtColor_Async(src.ref, code, callback), matCompleter); + +/// EqualizeHist Equalizes the histogram of a grayscale image. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d6/dc7/group__imgproc__hist.html#ga7e54091f0c937d49bf84152a16f76d6e +Future equalizeHistAsync(Mat src) async { + assert(src.channels == 1, "src must be grayscale"); + return cvRunAsync((callback) => CFFI.EqualizeHist_Async(src.ref, callback), matCompleter); +} + +/// CalcHist Calculates a histogram of a set of images +/// +/// For futher details, please see: +/// https:///docs.opencv.org/master/d6/dc7/group__imgproc__hist.html#ga6ca1876785483836f72a77ced8ea759a +Future calcHistAsync( + VecMat src, + VecInt channels, + Mat mask, + VecInt histSize, + VecFloat ranges, { + bool accumulate = false, +}) async => + cvRunAsync( + (callback) => CFFI.CalcHist_Async( + src.ref, + channels.ref, + mask.ref, + histSize.ref, + ranges.ref, + accumulate, + callback, + ), + matCompleter, + ); + +/// CalcBackProject calculates the back projection of a histogram. +/// +/// For futher details, please see: +/// https://docs.opencv.org/4.10.0/d6/dc7/group__imgproc__hist.html#gab644bc90e7475cc047aa1b25dbcbd8df +Future calcBackProjectAsync( + VecMat src, + VecInt channels, + Mat hist, + VecFloat ranges, { + double scale = 1.0, +}) async => + cvRunAsync( + (callback) => CFFI.CalcBackProject_Async(src.ref, channels.ref, hist.ref, ranges.ref, scale, callback), + matCompleter, + ); + +/// CompareHist Compares two histograms. +/// mode: HistCompMethods +/// For further details, please see: +/// https:///docs.opencv.org/master/d6/dc7/group__imgproc__hist.html#gaf4190090efa5c47cb367cf97a9a519bd +Future compareHistAsync(Mat hist1, Mat hist2, {int method = 0}) async => cvRunAsync( + (callback) => CFFI.CompareHist_Async(hist1.ref, hist2.ref, method, callback), + doubleCompleter, + ); + +/// ClipLine clips the line against the image rectangle. +/// For further details, please see: +/// https:///docs.opencv.org/master/d6/d6e/group__imgproc__draw.html#gaf483cb46ad6b049bc35ec67052ef1c2c +Future<(bool, Point, Point)> clipLineAsync(Rect imgRect, Point pt1, Point pt2) async => + cvRunAsync((callback) => CFFI.ClipLine_Async(imgRect.ref, pt1.ref, pt2.ref, callback), (completer, p) { + final success = p.cast().value; + calloc.free(p); + completer.complete((success, pt1, pt2)); + }); + +/// BilateralFilter applies a bilateral filter to an image. +/// +/// Bilateral filtering is described here: +/// http:///www.dai.ed.ac.uk/CVonline/LOCAL_COPIES/MANDUCHI1/Bilateral_Filtering.html +/// +/// BilateralFilter can reduce unwanted noise very well while keeping edges +/// fairly sharp. However, it is very slow compared to most filters. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d4/d86/group__imgproc__filter.html#ga9d7064d478c95d60003cf839430737ed +Future bilateralFilterAsync(Mat src, int diameter, double sigmaColor, double sigmaSpace) async => + cvRunAsync( + (callback) => CFFI.BilateralFilter_Async(src.ref, diameter, sigmaColor, sigmaSpace, callback), + matCompleter, + ); + +/// Blur blurs an image Mat using a normalized box filter. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d4/d86/group__imgproc__filter.html#ga8c45db9afe636703801b0b2e440fce37 +Future blurAsync(Mat src, (int, int) ksize) async => + cvRunAsync((callback) => CFFI.Blur_Async(src.ref, ksize.cvd.ref, callback), matCompleter); + +/// BoxFilter blurs an image using the box filter. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d4/d86/group__imgproc__filter.html#gad533230ebf2d42509547d514f7d3fbc3 +Future boxFilterAsync(Mat src, int depth, (int, int) ksize) async => + cvRunAsync((callback) => CFFI.BoxFilter_Async(src.ref, depth, ksize.cvd.ref, callback), matCompleter); + +/// SqBoxFilter calculates the normalized sum of squares of the pixel values overlapping the filter. +/// +/// For further details, please see: +/// https://docs.opencv.org/4.x/d4/d86/group__imgproc__filter.html#ga76e863e7869912edbe88321253b72688 +Future sqrBoxFilterAsync(Mat src, int depth, (int, int) ksize) async => + cvRunAsync((callback) => CFFI.SqBoxFilter_Async(src.ref, depth, ksize.cvd.ref, callback), matCompleter); + +/// Dilate dilates an image by using a specific structuring element. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d4/d86/group__imgproc__filter.html#ga4ff0f3318642c4f469d0e11f242f3b6c +Future dilateAsync( + Mat src, + Mat kernel, { + Point? anchor, + int iterations = 1, + int borderType = BORDER_CONSTANT, + Scalar? borderValue, +}) async => + cvRunAsync( + (callback) => CFFI.DilateWithParams_Async( + src.ref, + kernel.ref, + anchor?.ref ?? Point(-1, -1).ref, + iterations, + borderType, + borderValue?.ref ?? Scalar.default_().ref, + callback, + ), + matCompleter, + ); + +/// Erode erodes an image by using a specific structuring element. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d4/d86/group__imgproc__filter.html#gaeb1e0c1033e3f6b891a25d0511362aeb +Future erodeAsync( + Mat src, + Mat kernel, { + Mat? dst, + Point? anchor, + int iterations = 1, + int borderType = BORDER_CONSTANT, + Scalar? borderValue, +}) async => + cvRunAsync( + (callback) => CFFI.ErodeWithParams_Async( + src.ref, + kernel.ref, + anchor?.ref ?? Point(-1, -1).ref, + iterations, + borderType, + borderValue?.ref ?? Scalar.default_().ref, + callback, + ), + matCompleter, + ); + +/// DistanceTransform Calculates the distance to the closest zero pixel for each pixel of the source image. +/// +/// distanceType: DistanceTypes +/// maskSize: DistanceTransformMasks +/// labelType: DistanceTransformLabelTypes +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d7/d1b/group__imgproc__misc.html#ga8a0b7fdfcb7a13dde018988ba3a43042 + +Future<(Mat dst, Mat labels)> distanceTransformAsync( + Mat src, + int distanceType, + int maskSize, + int labelType, +) async => + cvRunAsync2( + (callback) => CFFI.DistanceTransform_Async(src.ref, distanceType, maskSize, labelType, callback), + matCompleter2, + ); + +/// BoundingRect calculates the up-right bounding rectangle of a point set. +/// +/// For further details, please see: +/// https:///docs.opencv.org/3.3.0/d3/dc0/group__imgproc__shape.html#gacb413ddce8e48ff3ca61ed7cf626a366 +Future boundingRectAsync(VecPoint points) async => + cvRunAsync((callback) => CFFI.BoundingRect_Async(points.ref, callback), rectCompleter); + +/// BoxPoints finds the four vertices of a rotated rect. Useful to draw the rotated rectangle. +/// +/// return: [bottom left, top left, top right, bottom right] +/// For further Details, please see: +/// https://docs.opencv.org/4.10.0/d3/dc0/group__imgproc__shape.html#gaf78d467e024b4d7936cf9397185d2f5c +Future boxPointsAsync(RotatedRect rect) async => + cvRunAsync((callback) => CFFI.BoxPoints_Async(rect.ref, callback), vecPoint2fCompleter); + +/// ContourArea calculates a contour area. +/// +/// For further details, please see: +/// https:///docs.opencv.org/3.3.0/d3/dc0/group__imgproc__shape.html#ga2c759ed9f497d4a618048a2f56dc97f1 +Future contourAreaAsync(VecPoint contour) async => + cvRunAsync((callback) => CFFI.ContourArea_Async(contour.ref, callback), doubleCompleter); + +/// MinAreaRect finds a rotated rectangle of the minimum area enclosing the input 2D point set. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#ga3d476a3417130ae5154aea421ca7ead9 +Future minAreaRectAsync(VecPoint points) async => + cvRunAsync((callback) => CFFI.MinAreaRect_Async(points.ref, callback), rotatedRectCompleter); + +/// FitEllipse Fits an ellipse around a set of 2D points. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#gaf259efaad93098103d6c27b9e4900ffa +Future fitEllipseAsync(VecPoint points) async => + cvRunAsync((callback) => CFFI.FitEllipse_Async(points.ref, callback), rotatedRectCompleter); + +/// MinEnclosingCircle finds a circle of the minimum area enclosing the input 2D point set. +/// +/// For further details, please see: +/// https:///docs.opencv.org/3.4/d3/dc0/group__imgproc__shape.html#ga8ce13c24081bbc7151e9326f412190f1 +Future<(Point2f center, double radius)> minEnclosingCircleAsync(VecPoint points) async => + cvRunAsync2((callback) => CFFI.MinEnclosingCircle_Async(points.ref, callback), (completer, p, p1) { + final radius = p1.cast().value; + calloc.free(p1); + completer.complete((Point2f.fromPointer(p.cast()), radius)); + }); + +/// FindContours finds contours in a binary image. +/// +/// For further details, please see: +/// https://docs.opencv.org/4.x/d3/dc0/group__imgproc__shape.html#gadf1ad6a0b82947fa1fe3c3d497f260e0 +Future<(Contours contours, Mat hierarchy)> findContoursAsync(Mat src, int mode, int method) async => + cvRunAsync2( + (callback) => CFFI.FindContours_Async(src.ref, mode, method, callback), + (c, p, p1) => + c.complete((Contours.fromPointer(p.cast()), Mat.fromPointer(p1.cast()))), + ); + +/// PointPolygonTest performs a point-in-contour test. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#ga1a539e8db2135af2566103705d7a5722 +Future pointPolygonTestAsync(VecPoint points, Point2f pt, bool measureDist) async => cvRunAsync( + (callback) => CFFI.PointPolygonTest_Async(points.ref, pt.ref, measureDist, callback), + doubleCompleter, + ); + +/// ConnectedComponents computes the connected components labeled image of boolean image. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#gaedef8c7340499ca391d459122e51bef5 +Future<(int rval, Mat labels)> connectedComponentsAsync( + Mat image, + int connectivity, + int ltype, + int ccltype, +) async => + cvRunAsync2( + (callback) => CFFI.ConnectedComponents_Async(image.ref, connectivity, ltype, ccltype, callback), + (completer, p, p1) { + final rval = p.cast().value; + calloc.free(p); + completer.complete((rval, Mat.fromPointer(p1.cast()))); + }); + +/// ConnectedComponentsWithStats computes the connected components labeled image of boolean +/// image and also produces a statistics output for each label. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#ga107a78bf7cd25dec05fb4dfc5c9e765f +Future<(int rval, Mat labels, Mat stats, Mat centroids)> connectedComponentsWithStatsAsync( + Mat src, + int connectivity, + int ltype, + int ccltype, +) async => + cvRunAsync4( + (callback) => CFFI.ConnectedComponentsWithStats_Async(src.ref, connectivity, ltype, ccltype, callback), + (completer, p, p1, p2, p3) { + final rval = p.cast().value; + calloc.free(p); + final labels = Mat.fromPointer(p1.cast()); + final stats = Mat.fromPointer(p2.cast()); + final centroids = Mat.fromPointer(p3.cast()); + completer.complete((rval, labels, stats, centroids)); + }, + ); + +/// MatchTemplate compares a template against overlapped image regions. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/df/dfb/group__imgproc__object.html#ga586ebfb0a7fb604b35a23d85391329be +Future matchTemplateAsync(Mat image, Mat templ, int method, {Mat? mask}) async => cvRunAsync( + (callback) => + CFFI.MatchTemplate_Async(image.ref, templ.ref, method, mask?.ref ?? Mat.empty().ref, callback), + matCompleter, + ); + +/// Moments calculates all of the moments up to the third order of a polygon +/// or rasterized shape. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#ga556a180f43cab22649c23ada36a8a139 +Future momentsAsync(Mat src, {bool binaryImage = false}) async => + cvRunAsync((callback) => CFFI.Moments_Async(src.ref, binaryImage, callback), momentsCompleter); + +/// PyrDown blurs an image and downsamples it. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d4/d86/group__imgproc__filter.html#gaf9bba239dfca11654cb7f50f889fc2ff +Future pyrDownAsync( + Mat src, { + (int, int) dstsize = (0, 0), + int borderType = BORDER_DEFAULT, +}) async => + cvRunAsync( + (callback) => CFFI.PyrDown_Async(src.ref, dstsize.cvd.ref, borderType, callback), + matCompleter, + ); + +/// PyrUp upsamples an image and then blurs it. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d4/d86/group__imgproc__filter.html#gada75b59bdaaca411ed6fee10085eb784 +Future pyrUpAsync( + Mat src, { + Mat? dst, + (int, int) dstsize = (0, 0), + int borderType = BORDER_DEFAULT, +}) async => + cvRunAsync( + (callback) => CFFI.PyrUp_Async(src.ref, dstsize.cvd.ref, borderType, callback), + matCompleter, + ); + +/// MorphologyDefaultBorder returns "magic" border value for erosion and dilation. +/// It is automatically transformed to Scalar::all(-DBL_MAX) for dilation. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d4/d86/group__imgproc__filter.html#ga94756fad83d9d24d29c9bf478558c40a +Future morphologyDefaultBorderValueAsync() async => + cvRunAsync(CFFI.MorphologyDefaultBorderValue_Async, scalarCompleter); + +/// MorphologyEx performs advanced morphological transformations. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d4/d86/group__imgproc__filter.html#ga67493776e3ad1a3df63883829375201f +Future morphologyExAsync( + Mat src, + int op, + Mat kernel, { + Mat? dst, + Point? anchor, + int iterations = 1, + int borderType = BORDER_CONSTANT, + Scalar? borderValue, +}) async => + cvRunAsync( + (callback) => CFFI.MorphologyExWithParams_Async( + src.ref, + op, + kernel.ref, + anchor?.ref ?? Point(-1, -1).ref, + iterations, + borderType, + borderValue?.ref ?? Scalar.default_().ref, + callback, + ), + matCompleter, + ); + +/// GetStructuringElement returns a structuring element of the specified size +/// and shape for morphological operations. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d4/d86/group__imgproc__filter.html#gac342a1bb6eabf6f55c803b09268e36dc +Future getStructuringElementAsync(int shape, (int, int) ksize, {Point? anchor}) async => cvRunAsync( + (callback) => + CFFI.GetStructuringElement_Async(shape, ksize.cvd.ref, anchor?.ref ?? Point(-1, -1).ref, callback), + matCompleter, + ); + +/// GaussianBlur blurs an image Mat using a Gaussian filter. +/// The function convolves the src Mat image into the dst Mat using +/// the specified Gaussian kernel params. +/// +/// For further details, please see: +/// http:///docs.opencv.org/master/d4/d86/group__imgproc__filter.html#gaabe8c836e97159a9193fb0b11ac52cf1 +Future gaussianBlurAsync( + Mat src, + (int, int) ksize, + double sigmaX, { + Mat? dst, + double sigmaY = 0, + int borderType = BORDER_DEFAULT, +}) async => + cvRunAsync( + (callback) => CFFI.GaussianBlur_Async(src.ref, ksize.cvd.ref, sigmaX, sigmaY, borderType, callback), + matCompleter, + ); + +/// GetGaussianKernel returns Gaussian filter coefficients. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d4/d86/group__imgproc__filter.html#gac05a120c1ae92a6060dd0db190a61afa +Future getGaussianKernelAsync(int ksize, double sigma, {int ktype = 6}) async => + cvRunAsync((callback) => CFFI.GetGaussianKernel_Async(ksize, sigma, ktype, callback), matCompleter); + +/// Sobel calculates the first, second, third, or mixed image derivatives using an extended Sobel operator +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d4/d86/group__imgproc__filter.html#gacea54f142e81b6758cb6f375ce782c8d +Future sobelAsync( + Mat src, + int ddepth, + int dx, + int dy, { + int ksize = 3, + double scale = 1, + double delta = 0, + int borderType = BORDER_DEFAULT, +}) async => + cvRunAsync( + (callback) => CFFI.Sobel_Async(src.ref, ddepth, dx, dy, ksize, scale, delta, borderType, callback), + matCompleter, + ); + +/// SpatialGradient calculates the first order image derivative in both x and y using a Sobel operator. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d4/d86/group__imgproc__filter.html#ga405d03b20c782b65a4daf54d233239a2 +Future<(Mat dx, Mat dy)> spatialGradientAsync( + Mat src, { + int ksize = 3, + int borderType = BORDER_DEFAULT, +}) async => + cvRunAsync2( + (callback) => CFFI.SpatialGradient_Async(src.ref, ksize, borderType, callback), + matCompleter2, + ); + +/// Laplacian calculates the Laplacian of an image. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d4/d86/group__imgproc__filter.html#gad78703e4c8fe703d479c1860d76429e6 +Future laplacianAsync( + Mat src, + int ddepth, { + int ksize = 1, + double scale = 1, + double delta = 0, + int borderType = BORDER_DEFAULT, +}) async => + cvRunAsync( + (callback) => CFFI.Laplacian_Async(src.ref, ddepth, ksize, scale, delta, borderType, callback), + matCompleter, + ); + +/// Scharr calculates the first x- or y- image derivative using Scharr operator. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d4/d86/group__imgproc__filter.html#gaa13106761eedf14798f37aa2d60404c9 +Future scharrAsync( + Mat src, + int ddepth, + int dx, + int dy, { + double scale = 1, + double delta = 0, + int borderType = BORDER_DEFAULT, +}) async => + cvRunAsync( + (callback) => CFFI.Scharr_Async(src.ref, ddepth, dx, dy, scale, delta, borderType, callback), + matCompleter, + ); + +/// MedianBlur blurs an image using the median filter. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d4/d86/group__imgproc__filter.html#ga564869aa33e58769b4469101aac458f9 +Future medianBlurAsync(Mat src, int ksize) async => + cvRunAsync((callback) => CFFI.MedianBlur_Async(src.ref, ksize, callback), matCompleter); + +/// Canny finds edges in an image using the Canny algorithm. +/// The function finds edges in the input image image and marks +/// them in the output map edges using the Canny algorithm. +/// The smallest value between threshold1 and threshold2 is used +/// for edge linking. The largest value is used to +/// find initial segments of strong edges. +/// See http:///en.wikipedia.org/wiki/Canny_edge_detector +/// +/// For further details, please see: +/// http:///docs.opencv.org/master/dd/d1a/group__imgproc__feature.html#ga04723e007ed888ddf11d9ba04e2232de +Future cannyAsync( + Mat image, + double threshold1, + double threshold2, { + int apertureSize = 3, + bool l2gradient = false, +}) async => + cvRunAsync( + (callback) => CFFI.Canny_Async(image.ref, threshold1, threshold2, apertureSize, l2gradient, callback), + matCompleter, + ); + +/// CornerSubPix Refines the corner locations. The function iterates to find +/// the sub-pixel accurate location of corners or radial saddle points. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/dd/d1a/group__imgproc__feature.html#ga354e0d7c86d0d9da75de9b9701a9a87e +Future cornerSubPixAsync( + InputArray image, + VecPoint2f corners, + (int, int) winSize, + (int, int) zeroZone, [ + (int, int, double) criteria = (TERM_COUNT + TERM_EPS, 30, 1e-4), +]) async => + cvRunAsync0( + (callback) => CFFI.CornerSubPix_Async( + image.ref, + corners.ref, + winSize.cvd.ref, + zeroZone.cvd.ref, + criteria.cvd.ref, + callback, + ), + (completer) => completer.complete(corners), + ); + +/// GoodFeaturesToTrack determines strong corners on an image. The function +/// finds the most prominent corners in the image or in the specified image region. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/dd/d1a/group__imgproc__feature.html#ga1d6bb77486c8f92d79c8793ad995d541 +Future goodFeaturesToTrackAsync( + InputArray image, + int maxCorners, + double qualityLevel, + double minDistance, { + InputArray? mask, + int blockSize = 3, + int? gradientSize, + bool useHarrisDetector = false, + double k = 0.04, +}) async => + gradientSize == null + ? cvRunAsync( + (callback) => CFFI.GoodFeaturesToTrack_Async( + image.ref, + maxCorners, + qualityLevel, + minDistance, + mask?.ref ?? Mat.empty().ref, + blockSize, + useHarrisDetector, + k, + callback, + ), + vecPoint2fCompleter, + ) + : cvRunAsync( + (callback) => CFFI.GoodFeaturesToTrackWithGradient_Async( + image.ref, + maxCorners, + qualityLevel, + minDistance, + mask?.ref ?? Mat.empty().ref, + blockSize, + gradientSize, + useHarrisDetector, + k, + callback, + ), + vecPoint2fCompleter, + ); + +/// Grabcut runs the GrabCut algorithm. +/// The function implements the GrabCut image segmentation algorithm. +/// For further details, please see: +/// https:///docs.opencv.org/master/d3/d47/group__imgproc__segmentation.html#ga909c1dda50efcbeaa3ce126be862b37f +Future<(Mat mask, Mat bgdModel, Mat fgdModel)> grabCutAsync( + InputArray img, + InputOutputArray mask, + Rect rect, + InputOutputArray bgdModel, + InputOutputArray fgdModel, + int iterCount, { + int mode = GC_EVAL, +}) async => + cvRunAsync0( + (callback) => CFFI.GrabCut_Async( + img.ref, + mask.ref, + rect.ref, + bgdModel.ref, + fgdModel.ref, + iterCount, + mode, + callback, + ), + (completer) => completer.complete((mask, bgdModel, fgdModel)), + ); + +/// HoughCircles finds circles in a grayscale image using the Hough transform. +/// The only "method" currently supported is HoughGradient. If you want to pass +/// more parameters, please see `HoughCirclesWithParams`. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/dd/d1a/group__imgproc__feature.html#ga47849c3be0d0406ad3ca45db65a25d2d +Future HoughCirclesAsync( + InputArray image, + int method, + double dp, + double minDist, { + double param1 = 100, + double param2 = 100, + int minRadius = 0, + int maxRadius = 0, +}) async => + cvRunAsync( + (callback) => CFFI.HoughCirclesWithParams_Async( + image.ref, + method, + dp, + minDist, + param1, + param2, + minRadius, + maxRadius, + callback, + ), + matCompleter, + ); + +/// HoughLines implements the standard or standard multi-scale Hough transform +/// algorithm for line detection. For a good explanation of Hough transform, see: +/// http:///homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm +/// +/// For further details, please see: +/// http:///docs.opencv.org/master/dd/d1a/group__imgproc__feature.html#ga46b4e588934f6c8dfd509cc6e0e4545a +Future HoughLinesAsync( + InputArray image, + double rho, + double theta, + int threshold, { + double srn = 0, + double stn = 0, + double min_theta = 0, + double max_theta = CV_PI, +}) async => + cvRunAsync( + (callback) => + CFFI.HoughLines_Async(image.ref, rho, theta, threshold, srn, stn, min_theta, max_theta, callback), + matCompleter, + ); + +/// HoughLinesP implements the probabilistic Hough transform +/// algorithm for line detection. For a good explanation of Hough transform, see: +/// http:///homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm +/// +/// For further details, please see: +/// http:///docs.opencv.org/master/dd/d1a/group__imgproc__feature.html#ga8618180a5948286384e3b7ca02f6feeb +Future HoughLinesPAsync( + InputArray image, + double rho, + double theta, + int threshold, { + double minLineLength = 0, + double maxLineGap = 0, +}) async => + cvRunAsync( + (callback) => CFFI.HoughLinesPWithParams_Async( + image.ref, + rho, + theta, + threshold, + minLineLength, + maxLineGap, + callback, + ), + matCompleter, + ); + +/// HoughLinesPointSet implements the Hough transform algorithm for line +/// detection on a set of points. For a good explanation of Hough transform, see: +/// http:///homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/dd/d1a/group__imgproc__feature.html#ga2858ef61b4e47d1919facac2152a160e +Future HoughLinesPointSetAsync( + InputArray point, + int lines_max, + int threshold, + double min_rho, + double max_rho, + double rho_step, + double min_theta, + double max_theta, + double theta_step, +) async => + cvRunAsync( + (callback) => CFFI.HoughLinesPointSet_Async( + point.ref, + lines_max, + threshold, + min_rho, + max_rho, + rho_step, + min_theta, + max_theta, + theta_step, + callback, + ), + matCompleter, + ); + +/// Integral calculates one or more integral images for the source image. +/// For further details, please see: +/// https:///docs.opencv.org/master/d7/d1b/group__imgproc__misc.html#ga97b87bec26908237e8ba0f6e96d23e28 +Future<(Mat sum, Mat sqsum, Mat tilted)> integralAsync( + InputArray src, { + int sdepth = -1, + int sqdepth = -1, +}) async => + cvRunAsync3((callback) => CFFI.Integral_Async(src.ref, sdepth, sqdepth, callback), matCompleter3); + +/// Threshold applies a fixed-level threshold to each array element. +/// +/// For further details, please see: +/// https:///docs.opencv.org/3.3.0/d7/d1b/group__imgproc__misc.html#gae8a4a146d1ca78c626a53577199e9c57 +Future<(double, Mat dst)> thresholdAsync( + InputArray src, + double thresh, + double maxval, + int type, +) async => + cvRunAsync2((callback) => CFFI.Threshold_Async(src.ref, thresh, maxval, type, callback), + (completer, p, p1) { + final rval = p.cast().value; + calloc.free(p); + completer.complete((rval, Mat.fromPointer(p1.cast()))); + }); + +/// AdaptiveThreshold applies a fixed-level threshold to each array element. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d7/d1b/group__imgproc__misc.html#ga72b913f352e4a1b1b397736707afcde3 +Future adaptiveThresholdAsync( + InputArray src, + double maxValue, + int adaptiveMethod, + int thresholdType, + int blockSize, + double C, +) async => + cvRunAsync( + (callback) => CFFI.AdaptiveThreshold_Async( + src.ref, + maxValue, + adaptiveMethod, + thresholdType, + blockSize, + C, + callback, + ), + matCompleter, + ); + +/// ArrowedLine draws a arrow segment pointing from the first point +/// to the second one. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d6/d6e/group__imgproc__draw.html#ga0a165a3ca093fd488ac709fdf10c05b2 +Future arrowedLineAsync( + InputOutputArray img, + Point pt1, + Point pt2, + Scalar color, { + int thickness = 1, + int line_type = 8, + int shift = 0, + double tipLength = 0.1, +}) async => + cvRunAsync0( + (callback) => CFFI.ArrowedLine_Async( + img.ref, + pt1.ref, + pt2.ref, + color.ref, + thickness, + line_type, + shift, + tipLength, + callback, + ), + (completer) => completer.complete(img), + ); + +/// CircleWithParams draws a circle. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d6/d6e/group__imgproc__draw.html#gaf10604b069374903dbd0f0488cb43670 +Future circleAsync( + InputOutputArray img, + Point center, + int radius, + Scalar color, { + int thickness = 1, + int lineType = LINE_8, + int shift = 0, +}) async => + cvRunAsync0( + (callback) => CFFI.CircleWithParams_Async( + img.ref, + center.ref, + radius, + color.ref, + thickness, + lineType, + shift, + callback, + ), + (completer) => completer.complete(img), + ); + +/// Ellipse draws a simple or thick elliptic arc or fills an ellipse sector. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d6/d6e/group__imgproc__draw.html#ga28b2267d35786f5f890ca167236cbc69 +Future ellipseAsync( + InputOutputArray img, + Point center, + Point axes, + double angle, + double startAngle, + double endAngle, + Scalar color, { + int thickness = 1, + int lineType = LINE_8, + int shift = 0, +}) async => + cvRunAsync0( + (callback) => CFFI.EllipseWithParams_Async( + img.ref, + center.ref, + axes.ref, + angle, + startAngle, + endAngle, + color.ref, + thickness, + lineType, + shift, + callback, + ), + (completer) => completer.complete(img), + ); + +/// Line draws a line segment connecting two points. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d6/d6e/group__imgproc__draw.html#ga7078a9fae8c7e7d13d24dac2520ae4a2 +Future lineAsync( + InputOutputArray img, + Point pt1, + Point pt2, + Scalar color, { + int thickness = 1, + int lineType = LINE_8, + int shift = 0, +}) async => + cvRunAsync0( + (callback) => + CFFI.Line_Async(img.ref, pt1.ref, pt2.ref, color.ref, thickness, lineType, shift, callback), + (completer) => completer.complete(img), + ); + +/// Rectangle draws a simple, thick, or filled up-right rectangle. +/// It renders a rectangle with the desired characteristics to the target Mat image. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d6/d6e/group__imgproc__draw.html#ga07d2f74cadcf8e305e810ce8eed13bc9 +Future rectangleAsync( + InputOutputArray img, + Rect rect, + Scalar color, { + int thickness = 1, + int lineType = LINE_8, + int shift = 0, +}) async => + cvRunAsync0( + (callback) => + CFFI.RectangleWithParams_Async(img.ref, rect.ref, color.ref, thickness, lineType, shift, callback), + (completer) => completer.complete(img), + ); + +/// FillPolyWithParams fills the area bounded by one or more polygons. +/// +/// For more information, see: +/// https:///docs.opencv.org/master/d6/d6e/group__imgproc__draw.html#gaf30888828337aa4c6b56782b5dfbd4b7 +Future fillPolyAsync( + InputOutputArray img, + VecVecPoint pts, + Scalar color, { + int lineType = LINE_8, + int shift = 0, + Point? offset, +}) async => + cvRunAsync0( + (callback) => CFFI.FillPolyWithParams_Async( + img.ref, + pts.ref, + color.ref, + lineType, + shift, + offset?.ref ?? Point(-1, -1).ref, + callback, + ), + (completer) => completer.complete(img), + ); + +/// Polylines draws several polygonal curves. +/// +/// For more information, see: +/// https:///docs.opencv.org/master/d6/d6e/group__imgproc__draw.html#ga1ea127ffbbb7e0bfc4fd6fd2eb64263c +Future polylinesAsync( + InputOutputArray img, + VecVecPoint pts, + bool isClosed, + Scalar color, { + int thickness = 1, + int lineType = LINE_8, + int shift = 0, +}) async => + cvRunAsync0( + (callback) => CFFI.Polylines_Async(img.ref, pts.ref, isClosed, color.ref, thickness, callback), + (completer) => completer.complete(img), + ); + +/// GetTextSizeWithBaseline calculates the width and height of a text string including the basline of the text. +/// It returns an image.Point with the size required to draw text using +/// a specific font face, scale, and thickness as well as its baseline. +/// +/// For further details, please see: +/// http:///docs.opencv.org/master/d6/d6e/group__imgproc__draw.html#ga3d2abfcb995fd2db908c8288199dba82 +Future<(Size size, int baseline)> getTextSizeAsync( + String text, + int fontFace, + double fontScale, + int thickness, +) async { + final ctext = text.toNativeUtf8().cast(); + final ret = cvRunAsync2<(Size, int)>( + (callback) => CFFI.GetTextSizeWithBaseline_Async(ctext, fontFace, fontScale, thickness, callback), + (completer, p, p1) { + final size = Size.fromPointer(p.cast()); + final baseline = p1.cast().value; + calloc.free(p1); + completer.complete((size, baseline)); + }); + calloc.free(ctext); + return ret; +} + +/// PutTextWithParams draws a text string. +/// It renders the specified text string into the img Mat at the location +/// passed in the "org" param, using the desired font face, font scale, +/// color, and line thinkness. +/// +/// For further details, please see: +/// http:///docs.opencv.org/master/d6/d6e/group__imgproc__draw.html#ga5126f47f883d730f633d74f07456c576 +Future putTextAsync( + InputOutputArray img, + String text, + Point org, + int fontFace, + double fontScale, + Scalar color, { + int thickness = 1, + int lineType = LINE_8, + bool bottomLeftOrigin = false, +}) async { + final textPtr = text.toNativeUtf8().cast(); + final rval = cvRunAsync0( + (callback) => CFFI.PutTextWithParams_Async( + img.ref, + textPtr, + org.ref, + fontFace, + fontScale, + color.ref, + thickness, + lineType, + bottomLeftOrigin, + callback, + ), + (completer) => completer.complete(img), + ); + calloc.free(textPtr); + return rval; +} + +/// Resize resizes an image. +/// It resizes the image src down to or up to the specified size, storing the +/// result in dst. Note that src and dst may be the same image. If you wish to +/// scale by factor, an empty sz may be passed and non-zero fx and fy. Likewise, +/// if you wish to scale to an explicit size, a non-empty sz may be passed with +/// zero for both fx and fy. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/da/d54/group__imgproc__transform.html#ga47a974309e9102f5f08231edc7e7529d +Future resizeAsync( + InputArray src, + (int, int) dsize, { + double fx = 0, + double fy = 0, + int interpolation = INTER_LINEAR, +}) async => + cvRunAsync( + (callback) => CFFI.Resize_Async(src.ref, dsize.cvd.ref, fx, fy, interpolation, callback), + matCompleter, + ); + +/// GetRectSubPix retrieves a pixel rectangle from an image with sub-pixel accuracy. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/da/d54/group__imgproc__transform.html#ga77576d06075c1a4b6ba1a608850cd614 +Future getRectSubPixAsync( + InputArray image, + (int, int) patchSize, + Point2f center, { + int patchType = -1, +}) async => + cvRunAsync( + (callback) => CFFI.GetRectSubPix_Async(image.ref, patchSize.cvd.ref, center.ref, callback), + matCompleter, + ); + +/// GetRotationMatrix2D calculates an affine matrix of 2D rotation. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/da/d54/group__imgproc__transform.html#gafbbc470ce83812914a70abfb604f4326 +Future getRotationMatrix2DAsync(Point2f center, double angle, double scale) async => cvRunAsync( + (callback) => CFFI.GetRotationMatrix2D_Async(center.ref, angle, scale, callback), + matCompleter, + ); + +/// WarpAffine applies an affine transformation to an image. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/da/d54/group__imgproc__transform.html#ga0203d9ee5fcd28d40dbc4a1ea4451983 +Future warpAffineAsync( + InputArray src, + InputArray M, + (int, int) dsize, { + int flags = INTER_LINEAR, + int borderMode = BORDER_CONSTANT, + Scalar? borderValue, +}) async => + cvRunAsync( + (callback) => CFFI.WarpAffineWithParams_Async( + src.ref, + M.ref, + dsize.cvd.ref, + flags, + borderMode, + borderValue?.ref ?? Scalar.default_().ref, + callback, + ), + matCompleter, + ); + +/// WarpPerspective applies a perspective transformation to an image. +/// For more parameters please check WarpPerspectiveWithParams. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/da/d54/group__imgproc__transform.html#gaf73673a7e8e18ec6963e3774e6a94b87 +Future warpPerspectiveAsync( + InputArray src, + InputArray M, + (int, int) dsize, { + int flags = INTER_LINEAR, + int borderMode = BORDER_CONSTANT, + Scalar? borderValue, +}) async => + cvRunAsync( + (callback) => CFFI.WarpPerspectiveWithParams_Async( + src.ref, + M.ref, + dsize.cvd.ref, + flags, + borderMode, + borderValue?.ref ?? Scalar.default_().ref, + callback, + ), + matCompleter, + ); + +/// Watershed performs a marker-based image segmentation using the watershed algorithm. +/// +/// For further details, please see: +/// https:///docs.opencv.org/4.x/d3/d47/group__imgproc__segmentation.html#ga3267243e4d3f95165d55a618c65ac6e1 +Future watershedAsync(InputArray image, InputOutputArray markers) async => cvRunAsync0( + (callback) => CFFI.Watershed_Async(image.ref, markers.ref, callback), + (c) => c.complete(markers), + ); + +/// ApplyColorMap applies a GNU Octave/MATLAB equivalent colormap on a given image. +/// colormap: ColormapTypes +/// For further details, please see: +/// https:///docs.opencv.org/master/d3/d50/group__imgproc__colormap.html#gadf478a5e5ff49d8aa24e726ea6f65d15 +Future applyColorMapAsync(InputArray src, int colormap) async => cvRunAsync( + (callback) => CFFI.ApplyColorMap_Async(src.ref, colormap, callback), + matCompleter, + ); + +/// ApplyCustomColorMap applies a custom defined colormap on a given image. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d3/d50/group__imgproc__colormap.html#gacb22288ddccc55f9bd9e6d492b409cae +Future applyCustomColorMapAsync(InputArray src, InputArray userColor) async => cvRunAsync( + (callback) => CFFI.ApplyCustomColorMap_Async(src.ref, userColor.ref, callback), + matCompleter, + ); + +/// GetPerspectiveTransform returns 3x3 perspective transformation for the +/// corresponding 4 point pairs as image.Point. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/da/d54/group__imgproc__transform.html#ga8c1ae0e3589a9d77fffc962c49b22043 +Future getPerspectiveTransformAsync(VecPoint src, VecPoint dst, [int solveMethod = DECOMP_LU]) async => + cvRunAsync( + (callback) => CFFI.GetPerspectiveTransform_Async(src.ref, dst.ref, solveMethod, callback), + matCompleter, + ); + +/// GetPerspectiveTransform2f returns 3x3 perspective transformation for the +/// corresponding 4 point pairs as gocv.Point2f. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/da/d54/group__imgproc__transform.html#ga8c1ae0e3589a9d77fffc962c49b22043 +Future getPerspectiveTransform2fAsync( + VecPoint2f src, + VecPoint2f dst, [ + int solveMethod = DECOMP_LU, +]) async => + cvRunAsync( + (callback) => CFFI.GetPerspectiveTransform2f_Async(src.ref, dst.ref, solveMethod, callback), + matCompleter, + ); + +/// GetAffineTransform returns a 2x3 affine transformation matrix for the +/// corresponding 3 point pairs as image.Point. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/da/d54/group__imgproc__transform.html#ga8f6d378f9f8eebb5cb55cd3ae295a999 +Future getAffineTransformAsync(VecPoint src, VecPoint dst) async => cvRunAsync( + (callback) => CFFI.GetAffineTransform_Async(src.ref, dst.ref, callback), + matCompleter, + ); + +Future getAffineTransform2fAsync(VecPoint2f src, VecPoint2f dst) async => cvRunAsync( + (callback) => CFFI.GetAffineTransform2f_Async(src.ref, dst.ref, callback), + matCompleter, + ); + +/// FindHomography finds an optimal homography matrix using 4 or more point pairs (as opposed to GetPerspectiveTransform, which uses exactly 4) +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d9/d0c/group__calib3d.html#ga4abc2ece9fab9398f2e560d53c8c9780 +Future<(Mat, Mat)> findHomographyAsync( + InputArray srcPoints, + InputArray dstPoints, { + int method = 0, + double ransacReprojThreshold = 3, + int maxIters = 2000, + double confidence = 0.995, +}) async => + cvRunAsync2( + (callback) => CFFI.FindHomography_Async( + srcPoints.ref, + dstPoints.ref, + method, + ransacReprojThreshold, + maxIters, + confidence, + callback, + ), + matCompleter2, + ); + +/// DrawContours draws contours outlines or filled contours. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d6/d6e/group__imgproc__draw.html#ga746c0625f1781f1ffc9056259103edbc +Future drawContoursAsync( + InputOutputArray image, + Contours contours, + int contourIdx, + Scalar color, { + int thickness = 1, + int lineType = LINE_8, + InputArray? hierarchy, // TODO: replace with vec + int maxLevel = 0x3f3f3f3f, + Point? offset, +}) async => + cvRunAsync0( + (callback) => CFFI.DrawContoursWithParams_Async( + image.ref, + contours.ref, + contourIdx, + color.ref, + thickness, + lineType, + hierarchy?.ref ?? Mat.empty().ref, + maxLevel, + offset?.ref ?? Point(-1, -1).ref, + callback, + ), + (c) => c.complete(image), + ); + +/// Remap applies a generic geometrical transformation to an image. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/da/d54/group__imgproc__transform.html#gab75ef31ce5cdfb5c44b6da5f3b908ea4 +Future remapAsync( + InputArray src, + InputArray map1, + InputArray map2, + int interpolation, { + int borderMode = BORDER_CONSTANT, + Scalar? borderValue, +}) async => + cvRunAsync( + (callback) => CFFI.Remap_Async( + src.ref, + map1.ref, + map2.ref, + interpolation, + borderMode, + borderValue?.ref ?? Scalar.default_().ref, + callback, + ), + matCompleter, + ); + +/// Filter2D applies an arbitrary linear filter to an image. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d4/d86/group__imgproc__filter.html#ga27c049795ce870216ddfb366086b5a04 +Future filter2DAsync( + InputArray src, + int ddepth, + InputArray kernel, { + Point? anchor, + double delta = 0, + int borderType = BORDER_DEFAULT, +}) async => + cvRunAsync( + (callback) => CFFI.Filter2D_Async( + src.ref, + ddepth, + kernel.ref, + anchor?.ref ?? Point(-1, -1).ref, + delta, + borderType, + callback, + ), + matCompleter, + ); + +/// SepFilter2D applies a separable linear filter to the image. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d4/d86/group__imgproc__filter.html#ga910e29ff7d7b105057d1625a4bf6318d +Future sepFilter2DAsync( + InputArray src, + int ddepth, + InputArray kernelX, + InputArray kernelY, { + Point? anchor, + double delta = 0, + int borderType = BORDER_DEFAULT, +}) async => + cvRunAsync( + (callback) => CFFI.SepFilter2D_Async( + src.ref, + ddepth, + kernelX.ref, + kernelY.ref, + anchor?.ref ?? Point(-1, -1).ref, + delta, + borderType, + callback, + ), + matCompleter, + ); + +/// LogPolar remaps an image to semilog-polar coordinates space. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/da/d54/group__imgproc__transform.html#gaec3a0b126a85b5ca2c667b16e0ae022d +Future logPolarAsync(InputArray src, Point2f center, double M, int flags) async => cvRunAsync( + (callback) => CFFI.LogPolar_Async(src.ref, center.ref, M, flags, callback), + matCompleter, + ); + +/// LinearPolar remaps an image to polar coordinates space. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/da/d54/group__imgproc__transform.html#gaa38a6884ac8b6e0b9bed47939b5362f3 +Future linearPolarAsync(InputArray src, Point2f center, double maxRadius, int flags) async => cvRunAsync( + (callback) => CFFI.LinearPolar_Async(src.ref, center.ref, maxRadius, flags, callback), + matCompleter, + ); + +/// FitLine fits a line to a 2D or 3D point set. +/// distType: DistanceTypes +/// For further details, please see: +/// https:///docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#gaf849da1fdafa67ee84b1e9a23b93f91f +Future fitLineAsync(VecPoint points, int distType, double param, double reps, double aeps) async => + cvRunAsync( + (callback) => CFFI.FitLine_Async(points.ref, distType, param, reps, aeps, callback), + matCompleter, + ); + +/// Compares two shapes. +/// method: ShapeMatchModes +/// For further details, please see: +/// https:///docs.opencv.org/4.x/d3/dc0/group__imgproc__shape.html#gaadc90cb16e2362c9bd6e7363e6e4c317 +Future matchShapesAsync(VecPoint contour1, VecPoint contour2, int method, double parameter) async => + cvRunAsync( + (callback) => CFFI.MatchShapes_Async(contour1.ref, contour2.ref, method, parameter, callback), + doubleCompleter, + ); + +/// Inverts an affine transformation. +/// The function computes an inverse affine transformation represented by 2×3 matrix M: +/// The result is also a 2×3 matrix of the same type as M. +/// +/// For further details, please see: +/// https://docs.opencv.org/4.x/da/d54/group__imgproc__transform.html#ga57d3505a878a7e1a636645727ca08f51 +Future invertAffineTransformAsync(InputArray M) async => cvRunAsync( + (callback) => CFFI.InvertAffineTransform_Async(M.ref, callback), + matCompleter, + ); + +/// Apply phaseCorrelate. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d7/df3/group__imgproc__motion.html#ga552420a2ace9ef3fb053cd630fdb4952 +Future<(Point2f rval, double response)> phaseCorrelateAsync( + InputArray src1, + InputArray src2, { + InputArray? window, +}) async => + cvRunAsync2( + (callback) => CFFI.PhaseCorrelate_Async(src1.ref, src2.ref, window?.ref ?? Mat.empty().ref, callback), + (c, p, p1) { + final response = p1.cast().value; + calloc.free(p1); + c.complete((Point2f.fromPointer(p.cast()), response)); + }, + ); + +/// Adds the square of a source image to the accumulator image. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d7/df3/group__imgproc__motion.html#ga1a567a79901513811ff3b9976923b199 +/// +Future accumulateAsync(InputArray src, InputOutputArray dst, {InputArray? mask}) async => mask == null + ? cvRunAsync0((callback) => CFFI.Mat_Accumulate_Async(src.ref, dst.ref, callback), (c) => c.complete(dst)) + : cvRunAsync0( + (callback) => CFFI.Mat_AccumulateWithMask_Async(src.ref, dst.ref, mask.ref, callback), + (c) => c.complete(dst), + ); + +/// Adds the square of a source image to the accumulator image. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d7/df3/group__imgproc__motion.html#gacb75e7ffb573227088cef9ceaf80be8c +Future accumulateSquareAsync(InputArray src, InputOutputArray dst, {InputArray? mask}) async => + mask == null + ? cvRunAsync0( + (callback) => CFFI.Mat_AccumulateSquare_Async(src.ref, dst.ref, callback), + (c) => c.complete(dst), + ) + : cvRunAsync0( + (callback) => CFFI.Mat_AccumulateSquareWithMask_Async(src.ref, dst.ref, mask.ref, callback), + (c) => c.complete(dst), + ); + +/// Adds the per-element product of two input images to the accumulator image. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d7/df3/group__imgproc__motion.html#ga82518a940ecfda49460f66117ac82520 +Future accumulateProductAsync( + InputArray src1, + InputArray src2, + InputOutputArray dst, { + InputArray? mask, +}) async => + mask == null + ? cvRunAsync0( + (callback) => CFFI.Mat_AccumulateProduct_Async(src1.ref, src2.ref, dst.ref, callback), + (c) => c.complete(dst), + ) + : cvRunAsync0( + (callback) => + CFFI.Mat_AccumulateProductWithMask_Async(src1.ref, src2.ref, dst.ref, mask.ref, callback), + (c) => c.complete(dst), + ); + +/// Updates a running average. +/// +/// For further details, please see: +/// https:///docs.opencv.org/master/d7/df3/group__imgproc__motion.html#ga4f9552b541187f61f6818e8d2d826bc7 +Future accumulateWeightedAsync( + InputArray src, + InputOutputArray dst, + double alpha, { + InputArray? mask, +}) async => + mask == null + ? cvRunAsync0( + (callback) => CFFI.Mat_AccumulatedWeighted_Async(src.ref, dst.ref, alpha, callback), + (c) => c.complete(dst), + ) + : cvRunAsync0( + (callback) => + CFFI.Mat_AccumulatedWeightedWithMask_Async(src.ref, dst.ref, alpha, mask.ref, callback), + (c) => c.complete(dst), + ); diff --git a/lib/src/imgproc/subdiv2d.dart b/lib/src/imgproc/subdiv2d.dart index d93a247b..cc7f4a37 100644 --- a/lib/src/imgproc/subdiv2d.dart +++ b/lib/src/imgproc/subdiv2d.dart @@ -17,6 +17,8 @@ class Subdiv2D extends CvStruct { } } + factory Subdiv2D.fromPointer(cvg.Subdiv2DPtr ptr) => Subdiv2D._(ptr); + factory Subdiv2D.empty() { final p = calloc(); cvRun(() => CFFI.Subdiv2D_NewEmpty(p)); diff --git a/lib/src/imgproc/subdiv2d_async.dart b/lib/src/imgproc/subdiv2d_async.dart new file mode 100644 index 00000000..3116f924 --- /dev/null +++ b/lib/src/imgproc/subdiv2d_async.dart @@ -0,0 +1,193 @@ +// ignore_for_file: constant_identifier_names + +import 'dart:ffi' as ffi; + +import 'package:ffi/ffi.dart'; + +import '../core/base.dart'; +import '../core/cv_vec.dart'; +import '../core/point.dart'; +import '../core/rect.dart'; +import '../core/vec.dart'; +import '../opencv.g.dart' as cvg; +import 'subdiv2d.dart'; + +/// Async version of [Subdiv2D] +extension Subdiv2DAsync on Subdiv2D { + static Future emptyAsync() async => cvRunAsync( + CFFI.Subdiv2D_NewEmpty_Async, + (c, p) => c.complete(Subdiv2D.fromPointer(p.cast())), + ); + + static Future fromRectAsync(Rect rect) async => cvRunAsync( + (callback) => CFFI.Subdiv2D_NewWithRect_Async(rect.ref, callback), + (c, p) => c.complete(Subdiv2D.fromPointer(p.cast())), + ); + + /// Returns the edge destination. + /// + /// https://docs.opencv.org/4.x/df/dbf/classcv_1_1Subdiv2D.html#aee192f95bf19c74619641496c457586d + Future<(int rval, Point2f dstpt)> edgeDstAsync(int edge) async => + cvRunAsync2((callback) => CFFI.Subdiv2D_EdgeDst_Async(ref, edge, callback), (completer, p, p1) { + final rval = p.cast().value; + calloc.free(p); + completer.complete((rval, Point2f.fromPointer(p1.cast()))); + }); + + /// Returns the edge origin. + /// + /// https://docs.opencv.org/4.x/df/dbf/classcv_1_1Subdiv2D.html#a5563e3cae0a9b95df63e72f0c12f9389 + Future<(int rval, Point2f orgpt)> edgeOrgAsync(int edge) async => + cvRunAsync2((callback) => CFFI.Subdiv2D_EdgeOrg_Async(ref, edge, callback), (completer, p, p1) { + final rval = p.cast().value; + calloc.free(p); + completer.complete((rval, Point2f.fromPointer(p1.cast()))); + }); + + /// Finds the subdivision vertex closest to the given point. + /// + /// The function is another function that locates the input point within the subdivision. + /// It finds the subdivision vertex that is the closest to the input point. + /// It is not necessarily one of vertices of the facet containing the input point, + /// though the facet (located using locate() ) is used as a starting point. + /// + /// https://docs.opencv.org/4.x/df/dbf/classcv_1_1Subdiv2D.html#a3ec256af000e129e08eb5f269ccdeb0f + Future<(int rval, Point2f nearestPt)> findNearestAsync(Point2f pt) async => + cvRunAsync2((callback) => CFFI.Subdiv2D_FindNearest_Async(ref, pt.ref, callback), (completer, p, p1) { + final rval = p.cast().value; + calloc.free(p); + completer.complete((rval, Point2f.fromPointer(p1.cast()))); + }); + + /// Returns one of the edges related to the given edge. + /// + /// [nextEdgeType] : Parameter specifying which of the related edges to return. + /// The following values are possible: + /// + /// - [NEXT_AROUND_ORG] next around the edge origin ( eOnext on the picture below if e is the input edge) + /// - [NEXT_AROUND_DST] next around the edge vertex ( eDnext ) + /// - [PREV_AROUND_ORG] previous around the edge origin (reversed eRnext ) + /// - [PREV_AROUND_DST] previous around the edge destination (reversed eLnext ) + /// - [NEXT_AROUND_LEFT] next around the left facet ( eLnext ) + /// - [NEXT_AROUND_RIGHT] next around the right facet ( eRnext ) + /// - [PREV_AROUND_LEFT] previous around the left facet (reversed eOnext ) + /// - [PREV_AROUND_RIGHT] previous around the right facet (reversed eDnext ) + /// + /// https://docs.opencv.org/4.x/df/dbf/classcv_1_1Subdiv2D.html#af73f08576709bad7a36f8f8e5fc43c84 + Future getEdgeAsync(int edge, int nextEdgeType) async => cvRunAsync( + (callback) => CFFI.Subdiv2D_GetEdge_Async(ref, edge, nextEdgeType, callback), + intCompleter, + ); + + /// Returns a list of all edges. + /// + /// https://docs.opencv.org/4.x/df/dbf/classcv_1_1Subdiv2D.html#ab527c11e9938eed53cf9c790afa9416d + Future getEdgeListAsync() async => cvRunAsync1( + (callback) => CFFI.Subdiv2D_GetEdgeList_Async(ref, callback), + (completer, p) => completer.complete(VecVec4f.fromPointer(p.cast())), + ); + + /// Returns a list of the leading edge ID connected to each triangle. + /// + /// https://docs.opencv.org/4.x/df/dbf/classcv_1_1Subdiv2D.html#a2d02a1d66ef7f8f267beb549cb2823f1 + Future getLeadingEdgeListAsync() async => + cvRunAsync((callback) => CFFI.Subdiv2D_GetLeadingEdgeList_Async(ref, callback), vecIntCompleter); + + /// Returns a list of all triangles. + /// + /// The function gives each triangle as a 6 numbers vector, where each two are one of the triangle vertices. + /// i.e. p1_x = v[0], p1_y = v[1], p2_x = v[2], p2_y = v[3], p3_x = v[4], p3_y = v[5]. + /// + /// https://docs.opencv.org/4.x/df/dbf/classcv_1_1Subdiv2D.html#a26bfe32209bc8ae9ecc53e93da01e466 + Future getTriangleListAsync() async => cvRunAsync1( + (callback) => CFFI.Subdiv2D_GetTriangleList_Async(ref, callback), + (completer, p) => completer.complete(VecVec6f.fromPointer(p.cast())), + ); + + /// Returns vertex location from vertex ID. + /// + /// https://docs.opencv.org/4.x/df/dbf/classcv_1_1Subdiv2D.html#a5297daca30f90d1e6d0cc5a75ba76351 + Future<(Point2f rval, int firstEdge)> getVertexAsync(int vertex) async => + cvRunAsync2((callback) => CFFI.Subdiv2D_GetVertex_Async(ref, vertex, callback), (c, p, p1) { + final firstEdge = p1.cast().value; + calloc.free(p1); + c.complete((Point2f.fromPointer(p.cast()), firstEdge)); + }); + + /// Returns a list of all Voronoi facets. + /// + /// https://docs.opencv.org/4.x/df/dbf/classcv_1_1Subdiv2D.html#a3a9e080423475be056a79da4c04741ea + Future<(VecVecPoint2f facetList, VecPoint2f facetCenters)> getVoronoiFacetListAsync(VecInt idx) async => + cvRunAsync2( + (callback) => CFFI.Subdiv2D_GetVoronoiFacetList_Async(ref, idx.ref, callback), + (completer, p, p1) => completer.complete( + ( + VecVecPoint2f.fromPointer(p.cast()), + VecPoint2f.fromPointer(p1.cast()) + ), + ), + ); + + /// Creates a new empty Delaunay subdivision. + /// + /// https://docs.opencv.org/4.x/df/dbf/classcv_1_1Subdiv2D.html#ae4a3d65e798c46fd6ce64370f24b0287 + Future initDelaunayAsync(Rect rect) async => cvRunAsync0( + (callback) => CFFI.Subdiv2D_InitDelaunay_Async(ref, rect.ref, callback), + (c) => c.complete(), + ); + + /// Insert multiple points into a Delaunay triangulation. + /// + /// https://docs.opencv.org/4.x/df/dbf/classcv_1_1Subdiv2D.html#a37223a499032ef57364f1372ad0c9c2e + Future insertAsync(Point2f pt) async => + cvRunAsync((callback) => CFFI.Subdiv2D_Insert_Async(ref, pt.ref, callback), intCompleter); + + /// Insert a single point into a Delaunay triangulation. + /// + /// The function locates the input point within the subdivision and gives one of the triangle edges or vertices. + /// + /// https://docs.opencv.org/4.x/df/dbf/classcv_1_1Subdiv2D.html#a18a6c9999210d769538297d843c613f2 + Future insertVecAsync(VecPoint2f pv) async => cvRunAsync0( + (callback) => CFFI.Subdiv2D_InsertVec_Async(ref, pv.ref, callback), + (c) => c.complete(), + ); + + /// Returns the location of a point within a Delaunay triangulation. + /// + // ignore: comment_references + /// [rval] an integer which specify one of the following five cases for point location: + /// + /// - The point falls into some facet. The function returns [PTLOC_INSIDE] and edge will contain one of edges of the facet. + /// - The point falls onto the edge. The function returns [PTLOC_ON_EDGE] and edge will contain this edge. + /// - The point coincides with one of the subdivision vertices. The function returns [PTLOC_VERTEX] and vertex will contain a pointer to the vertex. + /// - The point is outside the subdivision reference rectangle. The function returns [PTLOC_OUTSIDE_RECT] and no pointers are filled. + /// - One of input arguments is invalid. A runtime error is raised or, if silent or "parent" error processing mode is selected, [PTLOC_ERROR] is returned. + /// + /// https://docs.opencv.org/4.x/df/dbf/classcv_1_1Subdiv2D.html#aec8f1fd5a802f62faa97520b465897d7 + Future<(int rval, int edge, int vertex)> locateAsync(Point2f pt) async => + cvRunAsync3((callback) => CFFI.Subdiv2D_Locate_Async(ref, pt.ref, callback), (completer, p, p1, p2) { + final rval = p.cast().value; + calloc.free(p); + final edge = p1.cast().value; + calloc.free(p1); + final vertex = p2.cast().value; + calloc.free(p2); + completer.complete((rval, edge, vertex)); + }); + + /// Returns next edge around the edge origin. + /// + /// https://docs.opencv.org/4.x/df/dbf/classcv_1_1Subdiv2D.html#a36ebf478e2546615c2db457106393acb + Future nextEdgeAsync(int edge) async => + cvRunAsync((callback) => CFFI.Subdiv2D_NextEdge_Async(ref, edge, callback), intCompleter); + + /// Returns another edge of the same quad-edge. + /// + /// https://docs.opencv.org/4.x/df/dbf/classcv_1_1Subdiv2D.html#aa1179507f651b67c22e06517fbc6a145 + Future rotateEdgeAsync(int edge, int rotate) async => + cvRunAsync((callback) => CFFI.Subdiv2D_RotateEdge_Async(ref, edge, rotate, callback), intCompleter); + + /// https://docs.opencv.org/4.x/df/dbf/classcv_1_1Subdiv2D.html#aabbb10b8d5b0311b7e22040fc0db56b4 + Future symEdgeAsync(int edge) async => + cvRunAsync((callback) => CFFI.Subdiv2D_SymEdge_Async(ref, edge, callback), intCompleter); +} diff --git a/lib/src/objdetect/objdetect.dart b/lib/src/objdetect/objdetect.dart index 71cb5e61..532cd4fb 100644 --- a/lib/src/objdetect/objdetect.dart +++ b/lib/src/objdetect/objdetect.dart @@ -21,6 +21,11 @@ class CascadeClassifier extends CvStruct { finalizer.attach(this, ptr.cast(), detach: this); } } + factory CascadeClassifier.fromPointer( + cvg.CascadeClassifierPtr ptr, [ + bool attach = true, + ]) => + CascadeClassifier._(ptr, attach); factory CascadeClassifier.empty() { final p = calloc(); @@ -58,25 +63,23 @@ class CascadeClassifier extends CvStruct { double scaleFactor = 1.1, int minNeighbors = 3, int flags = 0, - Size minSize = (0, 0), - Size maxSize = (0, 0), + (int, int) minSize = (0, 0), + (int, int) maxSize = (0, 0), }) { - return using((arena) { - final ret = calloc(); - cvRun( - () => CFFI.CascadeClassifier_DetectMultiScaleWithParams( - ref, - image.ref, - ret, - scaleFactor, - minNeighbors, - flags, - minSize.toSize(arena).ref, - maxSize.toSize(arena).ref, - ), - ); - return VecRect.fromPointer(ret); - }); + final ret = calloc(); + cvRun( + () => CFFI.CascadeClassifier_DetectMultiScaleWithParams( + ref, + image.ref, + ret, + scaleFactor, + minNeighbors, + flags, + minSize.cvd.ref, + maxSize.cvd.ref, + ), + ); + return VecRect.fromPointer(ret); } (VecRect objects, VecInt numDetections) detectMultiScale2( @@ -84,27 +87,25 @@ class CascadeClassifier extends CvStruct { double scaleFactor = 1.1, int minNeighbors = 3, int flags = 0, - Size minSize = (0, 0), - Size maxSize = (0, 0), + (int, int) minSize = (0, 0), + (int, int) maxSize = (0, 0), }) { - return using<(VecRect, VecInt)>((arena) { - final ret = calloc(); - final pnums = calloc(); - cvRun( - () => CFFI.CascadeClassifier_DetectMultiScale2( - ref, - image.ref, - ret, - pnums, - scaleFactor, - minNeighbors, - flags, - minSize.toSize(arena).ref, - maxSize.toSize(arena).ref, - ), - ); - return (VecRect.fromPointer(ret), VecInt.fromPointer(pnums)); - }); + final ret = calloc(); + final pnums = calloc(); + cvRun( + () => CFFI.CascadeClassifier_DetectMultiScale2( + ref, + image.ref, + ret, + pnums, + scaleFactor, + minNeighbors, + flags, + minSize.cvd.ref, + maxSize.cvd.ref, + ), + ); + return (VecRect.fromPointer(ret), VecInt.fromPointer(pnums)); } (VecRect objects, VecInt numDetections, VecDouble levelWeights) detectMultiScale3( @@ -112,35 +113,33 @@ class CascadeClassifier extends CvStruct { double scaleFactor = 1.1, int minNeighbors = 3, int flags = 0, - Size minSize = (0, 0), - Size maxSize = (0, 0), + (int, int) minSize = (0, 0), + (int, int) maxSize = (0, 0), bool outputRejectLevels = false, }) { - return using<(VecRect, VecInt, VecDouble)>((arena) { - final objects = calloc(); - final rejectLevels = calloc(); - final levelWeights = calloc(); - cvRun( - () => CFFI.CascadeClassifier_DetectMultiScale3( - ref, - image.ref, - objects, - rejectLevels, - levelWeights, - scaleFactor, - minNeighbors, - flags, - minSize.toSize(arena).ref, - maxSize.toSize(arena).ref, - outputRejectLevels, - ), - ); - return ( - VecRect.fromPointer(objects), - VecInt.fromPointer(rejectLevels), - VecDouble.fromPointer(levelWeights) - ); - }); + final objects = calloc(); + final rejectLevels = calloc(); + final levelWeights = calloc(); + cvRun( + () => CFFI.CascadeClassifier_DetectMultiScale3( + ref, + image.ref, + objects, + rejectLevels, + levelWeights, + scaleFactor, + minNeighbors, + flags, + minSize.cvd.ref, + maxSize.cvd.ref, + outputRejectLevels, + ), + ); + return ( + VecRect.fromPointer(objects), + VecInt.fromPointer(rejectLevels), + VecDouble.fromPointer(levelWeights) + ); } /// Checks whether the classifier has been loaded. @@ -200,6 +199,11 @@ class HOGDescriptor extends CvStruct { finalizer.attach(this, ptr.cast(), detach: this); } } + factory HOGDescriptor.fromPointer( + cvg.HOGDescriptorPtr ptr, [ + bool attach = true, + ]) => + HOGDescriptor._(ptr, attach); factory HOGDescriptor.empty() { final p = calloc(); @@ -234,27 +238,25 @@ class HOGDescriptor extends CvStruct { /// https://docs.opencv.org/4.x/d5/d33/structcv_1_1HOGDescriptor.html#a38cd712cd5a6d9ed0344731fcd121e8b (VecFloat descriptors, VecPoint locations) compute( Mat img, { - Size winStride = (0, 0), - Size padding = (0, 0), + (int, int) winStride = (0, 0), + (int, int) padding = (0, 0), }) { - return using<(VecFloat, VecPoint)>((arena) { - final descriptors = calloc(); - final locations = calloc(); - cvRun( - () => CFFI.HOGDescriptor_Compute( - ref, - img.ref, - descriptors, - winStride.toSize(arena).ref, - padding.toSize(arena).ref, - locations, - ), - ); - return ( - VecFloat.fromPointer(descriptors), - VecPoint.fromPointer(locations), - ); - }); + final descriptors = calloc(); + final locations = calloc(); + cvRun( + () => CFFI.HOGDescriptor_Compute( + ref, + img.ref, + descriptors, + winStride.cvd.ref, + padding.cvd.ref, + locations, + ), + ); + return ( + VecFloat.fromPointer(descriptors), + VecPoint.fromPointer(locations), + ); } /// Computes gradients and quantized gradient orientations. @@ -262,24 +264,22 @@ class HOGDescriptor extends CvStruct { /// https://docs.opencv.org/4.x/d5/d33/structcv_1_1HOGDescriptor.html#a1f76c51c08d69f2b8a0f079efc4bd093 (Mat grad, Mat angleOfs) computeGradient( InputArray img, { - Size paddingTL = (0, 0), - Size paddingBR = (0, 0), + (int, int) paddingTL = (0, 0), + (int, int) paddingBR = (0, 0), }) { - return using<(Mat, Mat)>((arena) { - final grad = Mat.empty(); - final angleOfs = Mat.empty(); - cvRun( - () => CFFI.HOGDescriptor_computeGradient( - ref, - img.ref, - grad.ref, - angleOfs.ref, - paddingTL.toSize(arena).ref, - paddingBR.toSize(arena).ref, - ), - ); - return (grad, angleOfs); - }); + final grad = Mat.empty(); + final angleOfs = Mat.empty(); + cvRun( + () => CFFI.HOGDescriptor_computeGradient( + ref, + img.ref, + grad.ref, + angleOfs.ref, + paddingTL.cvd.ref, + paddingBR.cvd.ref, + ), + ); + return (grad, angleOfs); } /// Performs object detection without a multi-scale window. @@ -288,31 +288,29 @@ class HOGDescriptor extends CvStruct { (VecPoint foundLocations, VecDouble weights, VecPoint searchLocations) detect2( InputArray img, { double hitThreshold = 0, - Size winStride = (0, 0), - Size padding = (0, 0), + (int, int) winStride = (0, 0), + (int, int) padding = (0, 0), }) { - return using<(VecPoint, VecDouble, VecPoint)>((arena) { - final foundLocations = calloc(); - final searchLocations = calloc(); - final weights = calloc(); - cvRun( - () => CFFI.HOGDescriptor_Detect( - ref, - img.ref, - foundLocations, - weights, - hitThreshold, - winStride.toSize(arena).ref, - padding.toSize(arena).ref, - searchLocations, - ), - ); - return ( - VecPoint.fromPointer(foundLocations), - VecDouble.fromPointer(weights), - VecPoint.fromPointer(searchLocations), - ); - }); + final foundLocations = calloc(); + final searchLocations = calloc(); + final weights = calloc(); + cvRun( + () => CFFI.HOGDescriptor_Detect( + ref, + img.ref, + foundLocations, + weights, + hitThreshold, + winStride.cvd.ref, + padding.cvd.ref, + searchLocations, + ), + ); + return ( + VecPoint.fromPointer(foundLocations), + VecDouble.fromPointer(weights), + VecPoint.fromPointer(searchLocations), + ); } /// Performs object detection without a multi-scale window. @@ -321,25 +319,23 @@ class HOGDescriptor extends CvStruct { (VecPoint foundLocations, VecPoint searchLocations) detect( InputArray img, { double hitThreshold = 0, - Size winStride = (0, 0), - Size padding = (0, 0), + (int, int) winStride = (0, 0), + (int, int) padding = (0, 0), }) { - return using<(VecPoint, VecPoint)>((arena) { - final foundLocations = calloc(); - final searchLocations = calloc(); - cvRun( - () => CFFI.HOGDescriptor_Detect2( - ref, - img.ref, - foundLocations, - hitThreshold, - winStride.toSize(arena).ref, - padding.toSize(arena).ref, - searchLocations, - ), - ); - return (VecPoint.fromPointer(foundLocations), VecPoint.fromPointer(searchLocations)); - }); + final foundLocations = calloc(); + final searchLocations = calloc(); + cvRun( + () => CFFI.HOGDescriptor_Detect2( + ref, + img.ref, + foundLocations, + hitThreshold, + winStride.cvd.ref, + padding.cvd.ref, + searchLocations, + ), + ); + return (VecPoint.fromPointer(foundLocations), VecPoint.fromPointer(searchLocations)); } /// DetectMultiScale calls DetectMultiScale but allows setting parameters @@ -351,29 +347,27 @@ class HOGDescriptor extends CvStruct { InputArray image, { double hitThreshold = 0, int minNeighbors = 3, - Size winStride = (0, 0), - Size padding = (0, 0), + (int, int) winStride = (0, 0), + (int, int) padding = (0, 0), double scale = 1.05, double groupThreshold = 2.0, bool useMeanshiftGrouping = false, }) { - return using((arena) { - final rects = calloc(); - cvRun( - () => CFFI.HOGDescriptor_DetectMultiScaleWithParams( - ref, - image.ref, - hitThreshold, - winStride.toSize(arena).ref, - padding.toSize(arena).ref, - scale, - groupThreshold, - useMeanshiftGrouping, - rects, - ), - ); - return VecRect.fromPointer(rects); - }); + final rects = calloc(); + cvRun( + () => CFFI.HOGDescriptor_DetectMultiScaleWithParams( + ref, + image.ref, + hitThreshold, + winStride.cvd.ref, + padding.cvd.ref, + scale, + groupThreshold, + useMeanshiftGrouping, + rects, + ), + ); + return VecRect.fromPointer(rects); } /// HOGDefaultPeopleDetector returns a new Mat with the HOG DefaultPeopleDetector. @@ -394,7 +388,7 @@ class HOGDescriptor extends CvStruct { int getDescriptorSize() { return using((arena) { - final p = arena(); + final p = arena(); // size_t cvRun(() => CFFI.HOGDescriptor_getDescriptorSize(ref, p)); return p.value; }); @@ -470,6 +464,11 @@ class QRCodeDetector extends CvStruct { finalizer.attach(this, ptr.cast(), detach: this); } } + factory QRCodeDetector.fromPointer( + cvg.QRCodeDetectorPtr ptr, [ + bool attach = true, + ]) => + QRCodeDetector._(ptr, attach); factory QRCodeDetector.empty() { final p = calloc(); @@ -635,6 +634,11 @@ class FaceDetectorYN extends CvStruct { finalizer.attach(this, ptr.cast(), detach: this); } } + factory FaceDetectorYN.fromPointer( + cvg.FaceDetectorYNPtr ptr, [ + bool attach = true, + ]) => + FaceDetectorYN._(ptr, attach); /// Creates an instance of face detector class with given parameters. /// @@ -658,7 +662,7 @@ class FaceDetectorYN extends CvStruct { factory FaceDetectorYN.fromFile( String model, String config, - Size inputSize, { + (int, int) inputSize, { double scoreThreshold = 0.9, double nmsThreshold = 0.3, int topK = 5000, @@ -666,26 +670,24 @@ class FaceDetectorYN extends CvStruct { int targetId = 0, }) { final p = calloc(); - return using((arena) { - final cModel = model.toNativeUtf8().cast(); - final cConfig = config.toNativeUtf8().cast(); - cvRun( - () => CFFI.FaceDetectorYN_New( - cModel, - cConfig, - inputSize.toSize(arena).ref, - scoreThreshold, - nmsThreshold, - topK, - backendId, - targetId, - p, - ), - ); - calloc.free(cModel); - calloc.free(cConfig); - return FaceDetectorYN._(p); - }); + final cModel = model.toNativeUtf8().cast(); + final cConfig = config.toNativeUtf8().cast(); + cvRun( + () => CFFI.FaceDetectorYN_New( + cModel, + cConfig, + inputSize.cvd.ref, + scoreThreshold, + nmsThreshold, + topK, + backendId, + targetId, + p, + ), + ); + calloc.free(cModel); + calloc.free(cConfig); + return FaceDetectorYN._(p); } /// Creates an instance of face detector class with given parameters. @@ -713,7 +715,7 @@ class FaceDetectorYN extends CvStruct { String framework, Uint8List bufferModel, Uint8List bufferConfig, - Size inputSize, { + (int, int) inputSize, { double scoreThreshold = 0.9, double nmsThreshold = 0.3, int topK = 5000, @@ -721,25 +723,23 @@ class FaceDetectorYN extends CvStruct { int targetId = 0, }) { final p = calloc(); - return using((arena) { - final cFramework = framework.toNativeUtf8().cast(); - cvRun( - () => CFFI.FaceDetectorYN_NewFromBuffer( - cFramework, - VecUChar.fromList(bufferModel).ref, - VecUChar.fromList(bufferConfig).ref, - inputSize.toSize(arena).ref, - scoreThreshold, - nmsThreshold, - topK, - backendId, - targetId, - p, - ), - ); - calloc.free(cFramework); - return FaceDetectorYN._(p); - }); + final cFramework = framework.toNativeUtf8().cast(); + cvRun( + () => CFFI.FaceDetectorYN_NewFromBuffer( + cFramework, + VecUChar.fromList(bufferModel).ref, + VecUChar.fromList(bufferConfig).ref, + inputSize.cvd.ref, + scoreThreshold, + nmsThreshold, + topK, + backendId, + targetId, + p, + ), + ); + calloc.free(cFramework); + return FaceDetectorYN._(p); } /// https://docs.opencv.org/4.x/df/d20/classcv_1_1FaceDetectorYN.html#a68b6fb9bffbed0f3d5c104996113f247 @@ -807,10 +807,8 @@ class FaceDetectorYN extends CvStruct { /// [inputSize] the size of the input image /// /// https://docs.opencv.org/4.x/df/d20/classcv_1_1FaceDetectorYN.html#a072418e5ce7beeb69c41edda75c41d2e - void setInputSize(Size inputSize) { - using((arena) { - cvRun(() => CFFI.FaceDetectorYN_SetInputSize(ref, inputSize.toSize(arena).ref)); - }); + void setInputSize((int, int) inputSize) { + cvRun(() => CFFI.FaceDetectorYN_SetInputSize(ref, inputSize.cvd.ref)); } /// Set the score threshold to filter out bounding boxes of score less than @@ -865,6 +863,11 @@ class FaceRecognizerSF extends CvStruct { finalizer.attach(this, ptr.cast(), detach: this); } } + factory FaceRecognizerSF.fromPointer( + cvg.FaceRecognizerSFPtr ptr, [ + bool attach = true, + ]) => + FaceRecognizerSF._(ptr, attach); @Deprecated("Use FaceRecognizerSF.fromFile instead, will be removed in 1.1.0") factory FaceRecognizerSF.newRecognizer( diff --git a/lib/src/objdetect/objdetect_async.dart b/lib/src/objdetect/objdetect_async.dart new file mode 100644 index 00000000..86e031d5 --- /dev/null +++ b/lib/src/objdetect/objdetect_async.dart @@ -0,0 +1,785 @@ +library cv; + +import 'dart:ffi' as ffi; +import 'dart:typed_data'; + +import 'package:ffi/ffi.dart'; + +import '../core/base.dart'; +import '../core/mat.dart'; +import '../core/point.dart'; +import '../core/rect.dart'; +import '../core/size.dart'; +import '../core/vec.dart'; +import '../opencv.g.dart' as cvg; +import './objdetect.dart'; + +extension CascadeClassifierAsync on CascadeClassifier { + static Future emptyNewAsync() async => cvRunAsync( + CFFI.CascadeClassifier_New_Async, + (c, p) => c.complete(CascadeClassifier.fromPointer(p.cast())), + ); + + static Future fromFileAsync(String filename) async { + final cp = filename.toNativeUtf8().cast(); + final rval = await cvRunAsync( + (callback) => CFFI.CascadeClassifier_NewFromFile_Async(cp, callback), (c, p) { + return c.complete(CascadeClassifier.fromPointer(p.cast())); + }); + calloc.free(cp); + return rval; + } + + Future loadAsync(String name) async { + final cname = name.toNativeUtf8().cast(); + final rval = + cvRunAsync((callback) => CFFI.CascadeClassifier_Load_Async(ref, cname, callback), (c, p) { + final rval = p.cast().value != 0; + calloc.free(p); + return c.complete(rval); + }); + calloc.free(cname); + + return rval; + } + + Future detectMultiScaleAsync( + InputArray image, { + double scaleFactor = 1.1, + int minNeighbors = 3, + int flags = 0, + (int, int) minSize = (0, 0), + (int, int) maxSize = (0, 0), + }) async { + final rval = cvRunAsync( + (callback) => CFFI.CascadeClassifier_DetectMultiScaleWithParams_Async( + ref, + image.ref, + scaleFactor, + minNeighbors, + flags, + minSize.cvd.ref, + maxSize.cvd.ref, + callback, + ), (c, ret) { + return c.complete(VecRect.fromPointer(ret.cast())); + }); + return rval; + } + + Future<(VecRect objects, VecInt numDetections)> detectMultiScale2Async( + InputArray image, { + double scaleFactor = 1.1, + int minNeighbors = 3, + int flags = 0, + (int, int) minSize = (0, 0), + (int, int) maxSize = (0, 0), + }) async { + final rval = cvRunAsync2<(VecRect, VecInt)>( + (callback) => CFFI.CascadeClassifier_DetectMultiScale2_Async( + ref, + image.ref, + scaleFactor, + minNeighbors, + flags, + minSize.cvd.ref, + maxSize.cvd.ref, + callback, + ), (c, ret, pnums) { + return c.complete( + (VecRect.fromPointer(ret.cast()), VecInt.fromPointer(pnums.cast())), + ); + }); + return rval; + } + + Future<(VecRect objects, VecInt rejectLevels, VecDouble levelWeights)> detectMultiScale3Async( + InputArray image, { + double scaleFactor = 1.1, + int minNeighbors = 3, + int flags = 0, + (int, int) minSize = (0, 0), + (int, int) maxSize = (0, 0), + bool outputRejectLevels = false, + }) async { + final rval = cvRunAsync3<(VecRect, VecInt, VecDouble)>( + (callback) => CFFI.CascadeClassifier_DetectMultiScale3_Async( + ref, + image.ref, + scaleFactor, + minNeighbors, + flags, + minSize.cvd.ref, + maxSize.cvd.ref, + outputRejectLevels, + callback, + ), + (c, p1, p2, p3) => c.complete( + ( + VecRect.fromPointer(p1.cast()), + VecInt.fromPointer(p2.cast()), + VecDouble.fromPointer(p3.cast()) + ), + ), + ); + return rval; + } + + Future emptyAsync() async { + final rval = cvRunAsync((callback) => CFFI.CascadeClassifier_Empty_Async(ref, callback), (c, p) { + final rval = p.cast().value; + calloc.free(p); + return c.complete(rval); + }); + return rval; + } + + Future getFeatureTypeAsync() async { + final rval = + cvRunAsync((callback) => CFFI.CascadeClassifier_getFeatureType_Async(ref, callback), (c, p) { + final rval = p.cast().value; + calloc.free(p); + + return c.complete(rval); + }); + return rval; + } + + Future<(int, int)> getOriginalWindowSizeAsync() async { + final rval = cvRunAsync<(int, int)>( + (callback) => CFFI.CascadeClassifier_getOriginalWindowSize_Async(ref, callback), (c, p) { + final size = p.cast().ref; + final ret = (size.width, size.height); + return c.complete(ret); + }); + return rval; + } + + Future isOldFormatCascadeAsync() async { + final rval = cvRunAsync( + (callback) => CFFI.CascadeClassifier_isOldFormatCascade_Async(ref, callback), (c, p) { + final rval = p.cast().value; + calloc.free(p); + return c.complete(rval); + }); + return rval; + } +} + +extension HOGDescriptorAsync on HOGDescriptor { + static Future emptyNewAsync() async => cvRunAsync( + CFFI.HOGDescriptor_New_Async, + (c, p) => c.complete(HOGDescriptor.fromPointer(p.cast())), + ); + + static Future fromFileAsync(String filename) async { + final cp = filename.toNativeUtf8().cast(); + final rval = await cvRunAsync( + (callback) => CFFI.HOGDescriptor_NewFromFile_Async(cp, callback), (c, p) { + return c.complete(HOGDescriptor.fromPointer(p.cast())); + }); + calloc.free(cp); + return rval; + } + + Future loadAsync(String name) async { + final cname = name.toNativeUtf8().cast(); + final rval = cvRunAsync((callback) => CFFI.HOGDescriptor_Load_Async(ref, cname, callback), (c, p) { + final rval = p.cast().value; + calloc.free(p); + + return c.complete(rval); + }); + calloc.free(cname); + return rval; + } + + Future<(VecFloat descriptors, VecPoint locations)> computeAsync( + Mat img, { + (int, int) winStride = (0, 0), + (int, int) padding = (0, 0), + }) async { + final rval = cvRunAsync2<(VecFloat, VecPoint)>( + (callback) => CFFI.HOGDescriptor_Compute_Async( + ref, + img.ref, + winStride.cvd.ref, + padding.cvd.ref, + callback, + ), (c, descriptors, locations) { + return c.complete( + ( + VecFloat.fromPointer(descriptors.cast()), + VecPoint.fromPointer(locations.cast()) + ), + ); + }); + return rval; + } + + Future<(Mat grad, Mat angleOfs)> computeGradientAsync( + InputArray img, + Mat grad, + Mat angleOfs, { + (int, int) paddingTL = (0, 0), + (int, int) paddingBR = (0, 0), + }) async { + final rval = cvRunAsync0<(Mat, Mat)>( + (callback) => CFFI.HOGDescriptor_computeGradient_Async( + ref, + img.ref, + grad.ref, + angleOfs.ref, + paddingTL.cvd.ref, + paddingBR.cvd.ref, + callback, + ), (c) { + return c.complete((grad, angleOfs)); + }); + return rval; + } + + Future<(VecPoint foundLocations, VecDouble weights, VecPoint searchLocations)> detect2Async( + InputArray img, { + double hitThreshold = 0, + (int, int) winStride = (0, 0), + (int, int) padding = (0, 0), + }) async { + final rval = cvRunAsync3<(VecPoint, VecDouble, VecPoint)>( + (callback) => CFFI.HOGDescriptor_Detect_Async( + ref, + img.ref, + hitThreshold, + winStride.cvd.ref, + padding.cvd.ref, + callback, + ), (c, foundLocations, weights, searchLocations) { + return c.complete( + ( + VecPoint.fromPointer(foundLocations.cast()), + VecDouble.fromPointer(weights.cast()), + VecPoint.fromPointer(searchLocations.cast()) + ), + ); + }); + return rval; + } + + Future<(VecPoint foundLocations, VecPoint searchLocations)> detectAsync( + InputArray img, { + double hitThreshold = 0, + (int, int) winStride = (0, 0), + (int, int) padding = (0, 0), + }) async { + final rval = cvRunAsync2<(VecPoint, VecPoint)>( + (callback) => CFFI.HOGDescriptor_Detect2_Async( + ref, + img.ref, + hitThreshold, + winStride.cvd.ref, + padding.cvd.ref, + callback, + ), (c, foundLocations, searchLocations) { + return c.complete( + ( + VecPoint.fromPointer(foundLocations.cast()), + VecPoint.fromPointer(searchLocations.cast()) + ), + ); + }); + return rval; + } + + Future detectMultiScaleAsync( + InputArray image, { + double hitThreshold = 0, + int minNeighbors = 3, + (int, int) winStride = (0, 0), + (int, int) padding = (0, 0), + double scale = 1.05, + double groupThreshold = 2.0, + bool useMeanshiftGrouping = false, + }) async { + final rval = cvRunAsync( + (callback) => CFFI.HOGDescriptor_DetectMultiScaleWithParams_Async( + ref, + image.ref, + hitThreshold, + winStride.cvd.ref, + padding.cvd.ref, + scale, + groupThreshold, + useMeanshiftGrouping, + callback, + ), (c, rects) { + return c.complete(VecRect.fromPointer(rects.cast())); + }); + return rval; + } + + static Future getDefaultPeopleDetectorAsync() async { + final rval = cvRunAsync(CFFI.HOG_GetDefaultPeopleDetector_Async, (c, v) { + return c.complete(VecFloat.fromPointer(v.cast())); + }); + return rval; + } + + static Future getDaimlerPeopleDetectorAsync() async { + final rval = cvRunAsync(CFFI.HOGDescriptor_getDaimlerPeopleDetector_Async, (c, v) { + return c.complete(VecFloat.fromPointer(v.cast())); + }); + return rval; + } + + Future getDescriptorSizeAsync() async { + final rval = + cvRunAsync((callback) => CFFI.HOGDescriptor_getDescriptorSize_Async(ref, callback), (c, p) { + final rval = p.cast().value; + calloc.free(p); + return c.complete(rval); + }); + return rval; + } + + Future getWinSigmaAsync() async { + final rval = + cvRunAsync((callback) => CFFI.HOGDescriptor_getWinSigma_Async(ref, callback), (c, p) { + final rval = p.cast().value; + calloc.free(p); + return c.complete(rval); + }); + return rval; + } + + Future<(VecRect rectList, VecDouble weights)> groupRectanglesAsync( + VecRect rectList, + VecDouble weights, + int groupThreshold, + double eps, + ) async { + final rval = cvRunAsync0<(VecRect, VecDouble)>( + (callback) => CFFI.HOGDescriptor_groupRectangles_Async( + ref, + rectList.ref, + weights.ref, + groupThreshold, + eps, + callback, + ), (c) { + return c.complete((rectList, weights)); + }); + return rval; + } + + Future setSVMDetectorAsync(VecFloat det) async { + await cvRunAsync0((callback) => CFFI.HOGDescriptor_SetSVMDetector_Async(ref, det.ref, callback), + (c) { + return c.complete(); + }); + } +} + +Future groupRectanglesAsync( + VecRect rects, + int groupThreshold, + double eps, +) async { + final rval = cvRunAsync0( + (callback) => CFFI.GroupRectangles_Async(rects.ref, groupThreshold, eps, callback), (c) { + return c.complete(rects); + }); + return rval; +} + +extension QRCodeDetectorAsync on QRCodeDetector { + static Future emptyNewAsync() async => cvRunAsync( + CFFI.QRCodeDetector_New_Async, + (c, p) => c.complete(QRCodeDetector.fromPointer(p.cast())), + ); + + Future<(String rval, Mat straightQRcode)> decodeCurvedAsync( + InputArray img, + VecPoint points, + ) async { + final rval = cvRunAsync2<(String, Mat)>( + (callback) => CFFI.QRCodeDetector_decodeCurved_Async( + ref, + img.ref, + points.ref, + callback, + ), (c, prval, pstraightQRcode) { + // prval is a char ** pointer + final rval = prval.cast>().value.toDartString(); + calloc.free(prval); + return c.complete( + (rval, Mat.fromPointer(pstraightQRcode.cast())), + ); + }); + return rval; + } + + Future<(String rval, VecPoint points, Mat straightQRcode)> detectAndDecodeCurvedAsync( + InputArray img, + ) async { + final rval = cvRunAsync3<(String, VecPoint, Mat)>( + (callback) => CFFI.QRCodeDetector_detectAndDecodeCurved_Async( + ref, + img.ref, + callback, + ), (c, prval, points, straightQRcode) { + // prval is a char ** pointer + final rval = prval.cast>().value.toDartString(); + calloc.free(prval); + return c.complete( + ( + rval, + VecPoint.fromPointer(points.cast()), + Mat.fromPointer(straightQRcode.cast()), + ), + ); + }); + return rval; + } + + Future<(String ret, VecPoint points, Mat straightCode)> detectAndDecodeAsync(InputArray img) async { + final rval = cvRunAsync3<(String, VecPoint, Mat)>( + (callback) => CFFI.QRCodeDetector_DetectAndDecode_Async(ref, img.ref, callback), + (c, prval, points, straightCode) { + // prval is a char ** pointer + final rval = prval.cast>().value.toDartString(); + calloc.free(prval); + return c.complete( + ( + rval, + VecPoint.fromPointer(points.cast()), + Mat.fromPointer(straightCode.cast()), + ), + ); + }); + return rval; + } + + Future<(bool ret, VecPoint points)> detectAsync( + InputArray input, { + VecPoint? points, + }) async { + final rval = cvRunAsync2<(bool, VecPoint)>( + (callback) => CFFI.QRCodeDetector_Detect_Async(ref, input.ref, callback), (c, ret, points) { + final retValue = ret.cast().value; + calloc.free(ret); + return c.complete( + (retValue, VecPoint.fromPointer(points.cast())), + ); + }); + return rval; + } + + Future<(String ret, VecPoint? points, Mat? straightCode)> decodeAsync( + InputArray img, + ) async { + final rval = cvRunAsync3<(String, VecPoint, Mat)>( + (callback) => CFFI.QRCodeDetector_Decode_Async(ref, img.ref, callback), + (c, prval, points, straightCode) { + // prval is a char ** pointer + final rval = prval.cast>().value.toDartString(); + calloc.free(prval); + return c.complete( + ( + rval, + VecPoint.fromPointer(points.cast()), + Mat.fromPointer(straightCode.cast()), + ), + ); + }); + return rval; + } + + Future<(bool ret, VecPoint points)> detectMultiAsync( + InputArray img, + ) async { + final rval = cvRunAsync2<(bool, VecPoint)>( + (callback) => CFFI.QRCodeDetector_DetectMulti_Async(ref, img.ref, callback), (c, ret, points) { + final retValue = ret.cast().value; + calloc.free(ret); + return c.complete((retValue, VecPoint.fromPointer(points.cast()))); + }); + return rval; + } + + Future<(bool, List, VecPoint, VecMat)> detectAndDecodeMultiAsync( + InputArray img, + ) async { + final ret = cvRunAsync4<(bool, List, VecPoint, VecMat)>( + (callback) => CFFI.QRCodeDetector_DetectAndDecodeMulti_Async( + ref, + img.ref, + callback, + ), (c, rval, info, points, codes) { + final rvalValue = rval.cast().value; + calloc.free(rval); + final ret = ( + rvalValue, + VecVecChar.fromPointer(info.cast()).asStringList(), + VecPoint.fromPointer(points.cast()), + VecMat.fromPointer(codes.cast()) + ); + return c.complete(ret); + }); + return ret; + } + + Future setEpsXAsync(double epsX) async { + await cvRunAsync0((callback) => CFFI.QRCodeDetector_setEpsX_Async(ref, epsX, callback), (c) { + return c.complete(); + }); + } + + Future setEpsYAsync(double epsY) async { + await cvRunAsync0((callback) => CFFI.QRCodeDetector_setEpsY_Async(ref, epsY, callback), (c) { + return c.complete(); + }); + } + + Future setUseAlignmentMarkersAsync(bool useAlignmentMarkers) async { + await cvRunAsync0( + (callback) => CFFI.QRCodeDetector_setUseAlignmentMarkers_Async( + ref, + useAlignmentMarkers, + callback, + ), (c) { + return c.complete(); + }); + } +} + +extension FaceDetectorYNAsync on FaceDetectorYN { + static Future emptyNewAsync() async => cvRunAsync( + CFFI.CascadeClassifier_New_Async, + (c, p) => c.complete(CascadeClassifier.fromPointer(p.cast())), + ); + + static Future fromFileAsync( + String model, + String config, + (int, int) inputSize, { + double scoreThreshold = 0.9, + double nmsThreshold = 0.3, + int topK = 5000, + int backendId = 0, + int targetId = 0, + }) async { + final cModel = model.toNativeUtf8().cast(); + final cConfig = config.toNativeUtf8().cast(); + final rval = await cvRunAsync( + (callback) => CFFI.FaceDetectorYN_New_Async( + cModel, + cConfig, + inputSize.cvd.ref, + scoreThreshold, + nmsThreshold, + topK, + backendId, + targetId, + callback, + ), (c, p) { + return c.complete(FaceDetectorYN.fromPointer(p.cast())); + }); + calloc.free(cModel); + calloc.free(cConfig); + return rval; + } + + static Future fromBufferAsync( + String framework, + Uint8List bufferModel, + Uint8List bufferConfig, + (int, int) inputSize, { + double scoreThreshold = 0.9, + double nmsThreshold = 0.3, + int topK = 5000, + int backendId = 0, + int targetId = 0, + }) async { + final cFramework = framework.toNativeUtf8().cast(); + final bufM = VecUChar.fromList(bufferModel); + final bufC = VecUChar.fromList(bufferConfig); + + final rval = await cvRunAsync( + (callback) => CFFI.FaceDetectorYN_NewFromBuffer_Async( + cFramework, + bufM.ref, + bufC.ref, + inputSize.cvd.ref, + scoreThreshold, + nmsThreshold, + topK, + backendId, + targetId, + callback, + ), (c, p) { + return c.complete(FaceDetectorYN.fromPointer(p.cast())); + }); + calloc.free(cFramework); + bufM.dispose(); + bufC.dispose(); + + return rval; + } + + Future<(int, int)> getInputSizeAsync() async { + final rval = + cvRunAsync<(int, int)>((callback) => CFFI.FaceDetectorYN_GetInputSize_Async(ref, callback), (c, p) { + final size = p.cast().ref; + final ret = (size.width, size.height); + return c.complete(ret); + }); + return rval; + } + + Future getScoreThresholdAsync() async { + final rval = + cvRunAsync((callback) => CFFI.FaceDetectorYN_GetScoreThreshold_Async(ref, callback), (c, p) { + final rval = p.cast().value; + calloc.free(p); + return c.complete(rval); + }); + return rval; + } + + Future getNmsThresholdAsync() async { + final rval = + cvRunAsync((callback) => CFFI.FaceDetectorYN_GetNMSThreshold_Async(ref, callback), (c, p) { + final rval = p.cast().value; + calloc.free(p); + return c.complete(rval); + }); + return rval; + } + + Future getTopKAsync() async { + final rval = cvRunAsync((callback) => CFFI.FaceDetectorYN_GetTopK_Async(ref, callback), (c, p) { + final rval = p.cast().value; + calloc.free(p); + return c.complete(rval); + }); + return rval; + } + + Future detectAsync(Mat image) async { + final rval = + cvRunAsync((callback) => CFFI.FaceDetectorYN_Detect_Async(ref, image.ref, callback), (c, p) { + return c.complete(Mat.fromPointer(p.cast())); + }); + return rval; + } + + Future setInputSizeAsync((int, int) inputSize) async { + await cvRunAsync0( + (callback) => CFFI.FaceDetectorYN_SetInputSize_Async( + ref, + inputSize.cvd.ref, + callback, + ), (c) { + return c.complete(); + }); + } + + Future setScoreThresholdAsync(double scoreThreshold) async { + await cvRunAsync0( + (callback) => CFFI.FaceDetectorYN_SetScoreThreshold_Async( + ref, + scoreThreshold, + callback, + ), (c) { + return c.complete(); + }); + } + + Future setNMSThresholdAsync(double nmsThreshold) async { + await cvRunAsync0( + (callback) => CFFI.FaceDetectorYN_SetNMSThreshold_Async( + ref, + nmsThreshold, + callback, + ), (c) { + return c.complete(); + }); + } + + Future setTopKAsync(int topK) async { + await cvRunAsync0((callback) => CFFI.FaceDetectorYN_SetTopK_Async(ref, topK, callback), (c) { + return c.complete(); + }); + } +} + +extension FaceRecognizerSFAsync on FaceRecognizerSF { + static Future fromFileAsync( + String model, + String config, { + int backendId = 0, + int targetId = 0, + }) async { + final cModel = model.toNativeUtf8().cast(); + final cConfig = config.toNativeUtf8().cast(); + final rval = await cvRunAsync( + (callback) => CFFI.FaceRecognizerSF_New_Async( + cModel, + cConfig, + backendId, + targetId, + callback, + ), (c, p) { + return c.complete(FaceRecognizerSF.fromPointer(p.cast())); + }); + calloc.free(cModel); + calloc.free(cConfig); + return rval; + } + + Future alignCropAsync(Mat srcImg, Mat faceBox) async { + final rval = cvRunAsync( + (callback) => CFFI.FaceRecognizerSF_AlignCrop_Async( + ref, + srcImg.ref, + faceBox.ref, + callback, + ), (c, p) { + return c.complete(Mat.fromPointer(p.cast())); + }); + return rval; + } + + Future featureAsync(Mat alignedImg, {bool clone = false}) async { + final rval = cvRunAsync( + (callback) => CFFI.FaceRecognizerSF_Feature_Async( + ref, + alignedImg.ref, + clone, + callback, + ), (c, p) { + return c.complete(Mat.fromPointer(p.cast())); + }); + return rval; + } + + Future matchAsync( + Mat faceFeature1, + Mat faceFeature2, { + int disType = FaceRecognizerSF.FR_COSINE, + }) async { + final rval = cvRunAsync( + (callback) => CFFI.FaceRecognizerSF_Match_Async( + ref, + faceFeature1.ref, + faceFeature2.ref, + disType, + callback, + ), (c, p) { + final rval = p.cast().value; + calloc.free(p); + return c.complete(rval); + }); + return rval; + } +} diff --git a/lib/src/opencv.dart b/lib/src/opencv.dart deleted file mode 100644 index c1f416e4..00000000 --- a/lib/src/opencv.dart +++ /dev/null @@ -1,40 +0,0 @@ -library cv; - -export 'calib3d/calib3d.dart'; -export 'constants.g.dart'; -export 'contrib/aruco.dart'; -export 'contrib/aruco_dict.dart'; -export 'contrib/img_hash.dart'; -export 'contrib/wechat_qrcode.dart'; -export 'core/array.dart'; -export 'core/asyncarray.dart'; -export 'core/base.dart'; -export 'core/contours.dart'; -export 'core/core.dart'; -export 'core/cv_vec.dart'; -export 'core/dmatch.dart'; -export 'core/error_code.dart'; -export 'core/exception.dart'; -export 'core/keypoint.dart'; -export 'core/mat.dart'; -export 'core/mat_type.dart'; -export 'core/moments.dart'; -export 'core/point.dart'; -export 'core/rect.dart'; -export 'core/rng.dart'; -export 'core/scalar.dart'; -export 'core/size.dart'; -export 'core/vec.dart'; -export 'dnn/dnn.dart'; -export 'features2d/features2d.dart'; -export 'highgui/highgui.dart'; -export 'imgcodecs/imgcodecs.dart'; -export 'imgproc/clahe.dart'; -export 'imgproc/imgproc.dart'; -export 'imgproc/subdiv2d.dart'; -export 'objdetect/objdetect.dart'; -export 'photo/photo.dart'; -export 'stitching/stitching.dart'; -export 'svd/svd.dart'; -export 'video/video.dart'; -export 'video/videoio.dart'; diff --git a/lib/src/opencv.g.dart b/lib/src/opencv.g.dart index c33c592f..ab6840a5 100644 --- a/lib/src/opencv.g.dart +++ b/lib/src/opencv.g.dart @@ -41,6 +41,23 @@ 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, ) { @@ -55,6 +72,20 @@ 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, @@ -98,6 +129,47 @@ 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, @@ -126,6 +198,34 @@ class CvNative { ffi.Pointer Function( Mat, Mat, double, int, int, int, double)>(); + ffi.Pointer AdaptiveThreshold_Async( + Mat src, + double maxValue, + int adaptiveTyp, + int typ, + int blockSize, + double c, + CvCallback_1 callback, + ) { + return _AdaptiveThreshold_Async( + src, + maxValue, + adaptiveTyp, + typ, + blockSize, + c, + callback, + ); + } + + late final _AdaptiveThreshold_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, ffi.Double, ffi.Int, ffi.Int, + ffi.Int, ffi.Double, CvCallback_1)>>('AdaptiveThreshold_Async'); + late final _AdaptiveThreshold_Async = _AdaptiveThreshold_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, double, int, int, int, double, CvCallback_1)>(); + void AgastFeatureDetector_Close( AgastFeatureDetectorPtr a, ) { @@ -140,6 +240,25 @@ 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, ) { @@ -157,6 +276,21 @@ 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, @@ -178,6 +312,27 @@ 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, ) { @@ -230,6 +385,42 @@ class CvNative { ffi.Pointer Function( int, int, bool, ffi.Pointer)>(); + ffi.Pointer AlignMTB_CreateWithParams_Async( + int max_bits, + int exclude_range, + bool cut, + CvCallback_1 callback, + ) { + return _AlignMTB_CreateWithParams_Async( + max_bits, + exclude_range, + cut, + callback, + ); + } + + late final _AlignMTB_CreateWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Int, ffi.Int, ffi.Bool, + CvCallback_1)>>('AlignMTB_CreateWithParams_Async'); + late final _AlignMTB_CreateWithParams_Async = + _AlignMTB_CreateWithParams_AsyncPtr.asFunction< + ffi.Pointer Function(int, int, bool, CvCallback_1)>(); + + ffi.Pointer AlignMTB_Create_Async( + CvCallback_1 callback, + ) { + return _AlignMTB_Create_Async( + callback, + ); + } + + late final _AlignMTB_Create_AsyncPtr = + _lookup Function(CvCallback_1)>>( + 'AlignMTB_Create_Async'); + late final _AlignMTB_Create_Async = _AlignMTB_Create_AsyncPtr.asFunction< + ffi.Pointer Function(CvCallback_1)>(); + ffi.Pointer AlignMTB_Process( AlignMTB b, VecMat src, @@ -249,6 +440,25 @@ class CvNative { late final _AlignMTB_Process = _AlignMTB_ProcessPtr.asFunction< ffi.Pointer Function(AlignMTB, VecMat, ffi.Pointer)>(); + ffi.Pointer AlignMTB_Process_Async( + AlignMTB b, + VecMat src, + CvCallback_1 callback, + ) { + return _AlignMTB_Process_Async( + b, + src, + callback, + ); + } + + late final _AlignMTB_Process_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + AlignMTB, VecMat, CvCallback_1)>>('AlignMTB_Process_Async'); + late final _AlignMTB_Process_Async = _AlignMTB_Process_AsyncPtr.asFunction< + ffi.Pointer Function(AlignMTB, VecMat, CvCallback_1)>(); + ffi.Pointer ApplyColorMap( Mat src, Mat dst, @@ -267,6 +477,25 @@ class CvNative { late final _ApplyColorMap = _ApplyColorMapPtr.asFunction< ffi.Pointer Function(Mat, Mat, int)>(); + ffi.Pointer ApplyColorMap_Async( + Mat src, + int colormap, + CvCallback_1 callback, + ) { + return _ApplyColorMap_Async( + src, + colormap, + callback, + ); + } + + late final _ApplyColorMap_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, ffi.Int, CvCallback_1)>>('ApplyColorMap_Async'); + late final _ApplyColorMap_Async = _ApplyColorMap_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, CvCallback_1)>(); + ffi.Pointer ApplyCustomColorMap( Mat src, Mat dst, @@ -285,6 +514,25 @@ class CvNative { late final _ApplyCustomColorMap = _ApplyCustomColorMapPtr.asFunction< ffi.Pointer Function(Mat, Mat, Mat)>(); + ffi.Pointer ApplyCustomColorMap_Async( + Mat src, + Mat colormap, + CvCallback_1 callback, + ) { + return _ApplyCustomColorMap_Async( + src, + colormap, + callback, + ); + } + + late final _ApplyCustomColorMap_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, CvCallback_1)>>('ApplyCustomColorMap_Async'); + late final _ApplyCustomColorMap_Async = _ApplyCustomColorMap_AsyncPtr + .asFunction Function(Mat, Mat, CvCallback_1)>(); + ffi.Pointer ApproxPolyDP( VecPoint curve, double epsilon, @@ -307,6 +555,27 @@ class CvNative { ffi.Pointer Function( VecPoint, double, bool, ffi.Pointer)>(); + ffi.Pointer ApproxPolyDP_Async( + VecPoint curve, + double epsilon, + bool closed, + CvCallback_1 callback, + ) { + return _ApproxPolyDP_Async( + curve, + epsilon, + closed, + callback, + ); + } + + late final _ApproxPolyDP_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecPoint, ffi.Double, ffi.Bool, + CvCallback_1)>>('ApproxPolyDP_Async'); + late final _ApproxPolyDP_Async = _ApproxPolyDP_AsyncPtr.asFunction< + ffi.Pointer Function(VecPoint, double, bool, CvCallback_1)>(); + ffi.Pointer ArcLength( VecPoint curve, bool is_closed, @@ -327,6 +596,25 @@ class CvNative { ffi.Pointer Function( VecPoint, bool, ffi.Pointer)>(); + ffi.Pointer ArcLength_Async( + VecPoint curve, + bool is_closed, + CvCallback_1 callback, + ) { + return _ArcLength_Async( + curve, + is_closed, + callback, + ); + } + + late final _ArcLength_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPoint, ffi.Bool, CvCallback_1)>>('ArcLength_Async'); + late final _ArcLength_Async = _ArcLength_AsyncPtr.asFunction< + ffi.Pointer Function(VecPoint, bool, CvCallback_1)>(); + ffi.Pointer ArrowedLine( Mat img, Point pt1, @@ -357,6 +645,46 @@ class CvNative { ffi.Pointer Function( Mat, Point, Point, Scalar, int, int, int, double)>(); + ffi.Pointer ArrowedLine_Async( + Mat img, + Point pt1, + Point pt2, + Scalar color, + int thickness, + int line_type, + int shift, + double tipLength, + CvCallback_0 callback, + ) { + return _ArrowedLine_Async( + img, + pt1, + pt2, + color, + thickness, + line_type, + shift, + tipLength, + callback, + ); + } + + late final _ArrowedLine_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, + Point, + Point, + Scalar, + ffi.Int, + ffi.Int, + ffi.Int, + ffi.Double, + CvCallback_0)>>('ArrowedLine_Async'); + late final _ArrowedLine_Async = _ArrowedLine_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Point, Point, Scalar, int, int, int, double, CvCallback_0)>(); + void ArucoDetectorParameters_Close( ArucoDetectorParametersPtr ap, ) { @@ -1726,6 +2054,23 @@ 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, ) { @@ -1761,6 +2106,40 @@ 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, @@ -1785,6 +2164,31 @@ 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, @@ -1807,19 +2211,57 @@ class CvNative { ffi.Pointer Function( BFMatcher, Mat, Mat, ffi.Pointer)>(); - void BRISK_Close( - BRISKPtr b, + ffi.Pointer BFMatcher_Match_Async( + BFMatcher self, + Mat query, + Mat train, + CvCallback_1 callback, ) { - return _BRISK_Close( - b, + return _BFMatcher_Match_Async( + self, + query, + train, + callback, ); } - late final _BRISK_ClosePtr = - _lookup>('BRISK_Close'); + 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, + ) { + return _BRISK_Close( + b, + ); + } + + late final _BRISK_ClosePtr = + _lookup>('BRISK_Close'); 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, ) { @@ -1834,6 +2276,20 @@ 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, @@ -1877,6 +2333,47 @@ class CvNative { ffi.Pointer Function( BRISK, Mat, Mat, Mat, ffi.Pointer)>(); + ffi.Pointer BRISK_DetectAndCompute_Async( + BRISK self, + Mat src, + Mat mask, + CvCallback_2 callback, + ) { + return _BRISK_DetectAndCompute_Async( + self, + src, + mask, + callback, + ); + } + + late final _BRISK_DetectAndCompute_AsyncPtr = _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 BRISK_Detect_Async( + BRISK self, + Mat src, + CvCallback_1 callback, + ) { + return _BRISK_Detect_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, @@ -1897,6 +2394,27 @@ class CvNative { _BackgroundSubtractorKNN_ApplyPtr.asFunction< ffi.Pointer Function(BackgroundSubtractorKNN, Mat, Mat)>(); + ffi.Pointer BackgroundSubtractorKNN_Apply_Async( + BackgroundSubtractorKNN self, + Mat src, + CvCallback_1 callback, + ) { + return _BackgroundSubtractorKNN_Apply_Async( + self, + src, + callback, + ); + } + + late final _BackgroundSubtractorKNN_Apply_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(BackgroundSubtractorKNN, 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, ) { @@ -1953,6 +2471,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, @@ -1973,6 +2528,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, ) { @@ -2030,6 +2606,44 @@ class CvNative { ffi.Pointer Function( int, double, bool, ffi.Pointer)>(); + ffi.Pointer BackgroundSubtractorMOG2_CreateWithParams_Async( + int history, + double varThreshold, + bool detectShadows, + CvCallback_1 callback, + ) { + return _BackgroundSubtractorMOG2_CreateWithParams_Async( + history, + varThreshold, + detectShadows, + callback, + ); + } + + 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, @@ -2053,6 +2667,29 @@ class CvNative { late final _BilateralFilter = _BilateralFilterPtr.asFunction< ffi.Pointer Function(Mat, Mat, int, double, double)>(); + ffi.Pointer BilateralFilter_Async( + Mat src, + int d, + double sc, + double ss, + CvCallback_1 callback, + ) { + return _BilateralFilter_Async( + src, + d, + sc, + ss, + callback, + ); + } + + late final _BilateralFilter_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, ffi.Int, ffi.Double, ffi.Double, + CvCallback_1)>>('BilateralFilter_Async'); + late final _BilateralFilter_Async = _BilateralFilter_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, double, double, CvCallback_1)>(); + void BlockMeanHash_Close( BlockMeanHashPtr self, ) { @@ -2182,6 +2819,25 @@ class CvNative { late final _Blur = _BlurPtr.asFunction Function(Mat, Mat, Size)>(); + ffi.Pointer Blur_Async( + Mat src, + Size ps, + CvCallback_1 callback, + ) { + return _Blur_Async( + src, + ps, + callback, + ); + } + + late final _Blur_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Size, CvCallback_1)>>('Blur_Async'); + late final _Blur_Async = _Blur_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Size, CvCallback_1)>(); + ffi.Pointer BoundingRect( VecPoint pts, ffi.Pointer rval, @@ -2199,6 +2855,23 @@ class CvNative { late final _BoundingRect = _BoundingRectPtr.asFunction< ffi.Pointer Function(VecPoint, ffi.Pointer)>(); + ffi.Pointer BoundingRect_Async( + VecPoint pts, + CvCallback_1 callback, + ) { + return _BoundingRect_Async( + pts, + callback, + ); + } + + late final _BoundingRect_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPoint, CvCallback_1)>>('BoundingRect_Async'); + late final _BoundingRect_Async = _BoundingRect_AsyncPtr.asFunction< + ffi.Pointer Function(VecPoint, CvCallback_1)>(); + ffi.Pointer BoxFilter( Mat src, Mat dst, @@ -2220,6 +2893,27 @@ class CvNative { late final _BoxFilter = _BoxFilterPtr.asFunction< ffi.Pointer Function(Mat, Mat, int, Size)>(); + ffi.Pointer BoxFilter_Async( + Mat src, + int ddepth, + Size ps, + CvCallback_1 callback, + ) { + return _BoxFilter_Async( + src, + ddepth, + ps, + callback, + ); + } + + late final _BoxFilter_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, ffi.Int, Size, CvCallback_1)>>('BoxFilter_Async'); + late final _BoxFilter_Async = _BoxFilter_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, Size, CvCallback_1)>(); + ffi.Pointer BoxPoints( RotatedRect rect, ffi.Pointer boxPts, @@ -2237,6 +2931,23 @@ class CvNative { late final _BoxPoints = _BoxPointsPtr.asFunction< ffi.Pointer Function(RotatedRect, ffi.Pointer)>(); + ffi.Pointer BoxPoints_Async( + RotatedRect rect, + CvCallback_1 callback, + ) { + return _BoxPoints_Async( + rect, + callback, + ); + } + + late final _BoxPoints_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + RotatedRect, CvCallback_1)>>('BoxPoints_Async'); + late final _BoxPoints_Async = _BoxPoints_AsyncPtr.asFunction< + ffi.Pointer Function(RotatedRect, CvCallback_1)>(); + ffi.Pointer CLAHE_Apply( CLAHE c, Mat src, @@ -2255,6 +2966,25 @@ class CvNative { late final _CLAHE_Apply = _CLAHE_ApplyPtr.asFunction< ffi.Pointer Function(CLAHE, Mat, Mat)>(); + ffi.Pointer CLAHE_Apply_Async( + CLAHE self, + Mat src, + CvCallback_1 callback, + ) { + return _CLAHE_Apply_Async( + self, + src, + callback, + ); + } + + late final _CLAHE_Apply_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + CLAHE, Mat, CvCallback_1)>>('CLAHE_Apply_Async'); + late final _CLAHE_Apply_Async = _CLAHE_Apply_AsyncPtr.asFunction< + ffi.Pointer Function(CLAHE, Mat, CvCallback_1)>(); + void CLAHE_Close( CLAHEPtr c, ) { @@ -2268,6 +2998,22 @@ class CvNative { late final _CLAHE_Close = _CLAHE_ClosePtr.asFunction(); + void CLAHE_Close_Async( + CLAHEPtr self, + CvCallback_0 callback, + ) { + return _CLAHE_Close_Async( + self, + callback, + ); + } + + late final _CLAHE_Close_AsyncPtr = + _lookup>( + 'CLAHE_Close_Async'); + late final _CLAHE_Close_Async = + _CLAHE_Close_AsyncPtr.asFunction(); + ffi.Pointer CLAHE_CollectGarbage( CLAHE c, ) { @@ -2282,6 +3028,23 @@ class CvNative { late final _CLAHE_CollectGarbage = _CLAHE_CollectGarbagePtr.asFunction< ffi.Pointer Function(CLAHE)>(); + ffi.Pointer CLAHE_CollectGarbage_Async( + CLAHE self, + CvCallback_0 callback, + ) { + return _CLAHE_CollectGarbage_Async( + self, + callback, + ); + } + + late final _CLAHE_CollectGarbage_AsyncPtr = _lookup< + ffi + .NativeFunction Function(CLAHE, CvCallback_0)>>( + 'CLAHE_CollectGarbage_Async'); + late final _CLAHE_CollectGarbage_Async = _CLAHE_CollectGarbage_AsyncPtr + .asFunction Function(CLAHE, CvCallback_0)>(); + ffi.Pointer CLAHE_Create( ffi.Pointer rval, ) { @@ -2315,6 +3078,39 @@ class CvNative { late final _CLAHE_CreateWithParams = _CLAHE_CreateWithParamsPtr.asFunction< ffi.Pointer Function(double, Size, ffi.Pointer)>(); + ffi.Pointer CLAHE_CreateWithParams_Async( + double clipLimit, + Size tileGridSize, + CvCallback_1 callback, + ) { + return _CLAHE_CreateWithParams_Async( + clipLimit, + tileGridSize, + callback, + ); + } + + late final _CLAHE_CreateWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Double, Size, CvCallback_1)>>('CLAHE_CreateWithParams_Async'); + late final _CLAHE_CreateWithParams_Async = _CLAHE_CreateWithParams_AsyncPtr + .asFunction Function(double, Size, CvCallback_1)>(); + + ffi.Pointer CLAHE_Create_Async( + CvCallback_1 callback, + ) { + return _CLAHE_Create_Async( + callback, + ); + } + + late final _CLAHE_Create_AsyncPtr = + _lookup Function(CvCallback_1)>>( + 'CLAHE_Create_Async'); + late final _CLAHE_Create_Async = _CLAHE_Create_AsyncPtr.asFunction< + ffi.Pointer Function(CvCallback_1)>(); + ffi.Pointer CLAHE_GetClipLimit( CLAHE c, ffi.Pointer rval, @@ -2332,6 +3128,23 @@ class CvNative { late final _CLAHE_GetClipLimit = _CLAHE_GetClipLimitPtr.asFunction< ffi.Pointer Function(CLAHE, ffi.Pointer)>(); + ffi.Pointer CLAHE_GetClipLimit_Async( + CLAHE self, + CvCallback_1 callback, + ) { + return _CLAHE_GetClipLimit_Async( + self, + callback, + ); + } + + late final _CLAHE_GetClipLimit_AsyncPtr = _lookup< + ffi + .NativeFunction Function(CLAHE, CvCallback_1)>>( + 'CLAHE_GetClipLimit_Async'); + late final _CLAHE_GetClipLimit_Async = _CLAHE_GetClipLimit_AsyncPtr + .asFunction Function(CLAHE, CvCallback_1)>(); + ffi.Pointer CLAHE_GetTilesGridSize( CLAHE c, ffi.Pointer rval, @@ -2349,6 +3162,23 @@ class CvNative { late final _CLAHE_GetTilesGridSize = _CLAHE_GetTilesGridSizePtr.asFunction< ffi.Pointer Function(CLAHE, ffi.Pointer)>(); + ffi.Pointer CLAHE_GetTilesGridSize_Async( + CLAHE self, + CvCallback_1 callback, + ) { + return _CLAHE_GetTilesGridSize_Async( + self, + callback, + ); + } + + late final _CLAHE_GetTilesGridSize_AsyncPtr = _lookup< + ffi + .NativeFunction Function(CLAHE, CvCallback_1)>>( + 'CLAHE_GetTilesGridSize_Async'); + late final _CLAHE_GetTilesGridSize_Async = _CLAHE_GetTilesGridSize_AsyncPtr + .asFunction Function(CLAHE, CvCallback_1)>(); + ffi.Pointer CLAHE_SetClipLimit( CLAHE c, double clipLimit, @@ -2366,6 +3196,26 @@ class CvNative { late final _CLAHE_SetClipLimit = _CLAHE_SetClipLimitPtr.asFunction< ffi.Pointer Function(CLAHE, double)>(); + ffi.Pointer CLAHE_SetClipLimit_Async( + CLAHE self, + double clipLimit, + CvCallback_0 callback, + ) { + return _CLAHE_SetClipLimit_Async( + self, + clipLimit, + callback, + ); + } + + late final _CLAHE_SetClipLimit_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + CLAHE, ffi.Double, CvCallback_0)>>('CLAHE_SetClipLimit_Async'); + late final _CLAHE_SetClipLimit_Async = + _CLAHE_SetClipLimit_AsyncPtr.asFunction< + ffi.Pointer Function(CLAHE, double, CvCallback_0)>(); + ffi.Pointer CLAHE_SetTilesGridSize( CLAHE c, Size size, @@ -2382,13 +3232,32 @@ class CvNative { late final _CLAHE_SetTilesGridSize = _CLAHE_SetTilesGridSizePtr.asFunction< ffi.Pointer Function(CLAHE, Size)>(); - ffi.Pointer CalcBackProject( - VecMat mats, - VecInt chans, - Mat hist, - Mat backProject, - VecFloat rng, - bool uniform, + ffi.Pointer CLAHE_SetTilesGridSize_Async( + CLAHE self, + Size size, + CvCallback_0 callback, + ) { + return _CLAHE_SetTilesGridSize_Async( + self, + size, + callback, + ); + } + + late final _CLAHE_SetTilesGridSize_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + CLAHE, Size, CvCallback_0)>>('CLAHE_SetTilesGridSize_Async'); + late final _CLAHE_SetTilesGridSize_Async = _CLAHE_SetTilesGridSize_AsyncPtr + .asFunction Function(CLAHE, Size, CvCallback_0)>(); + + ffi.Pointer CalcBackProject( + VecMat mats, + VecInt chans, + Mat hist, + Mat backProject, + VecFloat rng, + double scale, ) { return _CalcBackProject( mats, @@ -2396,17 +3265,43 @@ class CvNative { hist, backProject, rng, - uniform, + scale, ); } late final _CalcBackProjectPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function(VecMat, VecInt, Mat, Mat, VecFloat, - ffi.Bool)>>('CalcBackProject'); + ffi.Double)>>('CalcBackProject'); late final _CalcBackProject = _CalcBackProjectPtr.asFunction< ffi.Pointer Function( - VecMat, VecInt, Mat, Mat, VecFloat, bool)>(); + VecMat, VecInt, Mat, Mat, VecFloat, double)>(); + + ffi.Pointer CalcBackProject_Async( + VecMat mats, + VecInt chans, + Mat backProject, + VecFloat rng, + double scale, + CvCallback_1 callback, + ) { + return _CalcBackProject_Async( + mats, + chans, + backProject, + rng, + scale, + callback, + ); + } + + late final _CalcBackProject_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecMat, VecInt, Mat, VecFloat, + ffi.Double, CvCallback_1)>>('CalcBackProject_Async'); + late final _CalcBackProject_Async = _CalcBackProject_AsyncPtr.asFunction< + ffi.Pointer Function( + VecMat, VecInt, Mat, VecFloat, double, CvCallback_1)>(); ffi.Pointer CalcHist( VecMat mats, @@ -2436,6 +3331,34 @@ class CvNative { ffi.Pointer Function( VecMat, VecInt, Mat, Mat, VecInt, VecFloat, bool)>(); + ffi.Pointer CalcHist_Async( + VecMat mats, + VecInt chans, + Mat mask, + VecInt sz, + VecFloat rng, + bool acc, + CvCallback_1 callback, + ) { + return _CalcHist_Async( + mats, + chans, + mask, + sz, + rng, + acc, + callback, + ); + } + + late final _CalcHist_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecMat, VecInt, Mat, VecInt, VecFloat, + ffi.Bool, CvCallback_1)>>('CalcHist_Async'); + late final _CalcHist_Async = _CalcHist_AsyncPtr.asFunction< + ffi.Pointer Function( + VecMat, VecInt, Mat, VecInt, VecFloat, bool, CvCallback_1)>(); + ffi.Pointer CalcOpticalFlowFarneback( Mat prevImg, Mat nextImg, @@ -2480,6 +3403,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, @@ -2563,6 +3533,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, @@ -2631,6 +3645,32 @@ class CvNative { late final _Canny = _CannyPtr.asFunction< ffi.Pointer Function(Mat, Mat, double, double, int, bool)>(); + ffi.Pointer Canny_Async( + Mat src, + double t1, + double t2, + int apertureSize, + bool l2gradient, + CvCallback_1 callback, + ) { + return _Canny_Async( + src, + t1, + t2, + apertureSize, + l2gradient, + callback, + ); + } + + late final _Canny_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, ffi.Double, ffi.Double, ffi.Int, + ffi.Bool, CvCallback_1)>>('Canny_Async'); + late final _Canny_Async = _Canny_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, double, double, int, bool, CvCallback_1)>(); + void CascadeClassifier_Close( CascadeClassifierPtr self, ) { @@ -2715,6 +3755,44 @@ class CvNative { Size, Size)>(); + ffi.Pointer CascadeClassifier_DetectMultiScale2_Async( + CascadeClassifier self, + Mat img, + double scaleFactor, + int minNeighbors, + int flags, + Size minSize, + Size maxSize, + CvCallback_2 callback, + ) { + return _CascadeClassifier_DetectMultiScale2_Async( + self, + img, + scaleFactor, + minNeighbors, + flags, + minSize, + maxSize, + callback, + ); + } + + late final _CascadeClassifier_DetectMultiScale2_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + CascadeClassifier, + Mat, + ffi.Double, + ffi.Int, + ffi.Int, + Size, + Size, + CvCallback_2)>>('CascadeClassifier_DetectMultiScale2_Async'); + late final _CascadeClassifier_DetectMultiScale2_Async = + _CascadeClassifier_DetectMultiScale2_AsyncPtr.asFunction< + ffi.Pointer Function(CascadeClassifier, Mat, double, int, + int, Size, Size, CvCallback_2)>(); + ffi.Pointer CascadeClassifier_DetectMultiScale3( CascadeClassifier self, Mat img, @@ -2772,6 +3850,47 @@ class CvNative { Size, bool)>(); + ffi.Pointer CascadeClassifier_DetectMultiScale3_Async( + CascadeClassifier self, + Mat img, + double scaleFactor, + int minNeighbors, + int flags, + Size minSize, + Size maxSize, + bool outputRejectLevels, + CvCallback_3 callback, + ) { + return _CascadeClassifier_DetectMultiScale3_Async( + self, + img, + scaleFactor, + minNeighbors, + flags, + minSize, + maxSize, + outputRejectLevels, + callback, + ); + } + + late final _CascadeClassifier_DetectMultiScale3_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + CascadeClassifier, + Mat, + ffi.Double, + ffi.Int, + ffi.Int, + Size, + Size, + ffi.Bool, + CvCallback_3)>>('CascadeClassifier_DetectMultiScale3_Async'); + late final _CascadeClassifier_DetectMultiScale3_Async = + _CascadeClassifier_DetectMultiScale3_AsyncPtr.asFunction< + ffi.Pointer Function(CascadeClassifier, Mat, double, int, + int, Size, Size, bool, CvCallback_3)>(); + ffi.Pointer CascadeClassifier_DetectMultiScaleWithParams( CascadeClassifier self, Mat img, @@ -2810,6 +3929,59 @@ class CvNative { ffi.Pointer Function(CascadeClassifier, Mat, ffi.Pointer, double, int, int, Size, Size)>(); + ffi.Pointer CascadeClassifier_DetectMultiScaleWithParams_Async( + CascadeClassifier self, + Mat img, + double scale, + int minNeighbors, + int flags, + Size minSize, + Size maxSize, + CvCallback_1 callback, + ) { + return _CascadeClassifier_DetectMultiScaleWithParams_Async( + self, + img, + scale, + minNeighbors, + flags, + minSize, + maxSize, + callback, + ); + } + + late final _CascadeClassifier_DetectMultiScaleWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(CascadeClassifier, Mat, ffi.Double, + ffi.Int, ffi.Int, Size, Size, CvCallback_1)>>( + 'CascadeClassifier_DetectMultiScaleWithParams_Async'); + late final _CascadeClassifier_DetectMultiScaleWithParams_Async = + _CascadeClassifier_DetectMultiScaleWithParams_AsyncPtr.asFunction< + ffi.Pointer Function(CascadeClassifier, Mat, double, int, + int, Size, Size, CvCallback_1)>(); + + ffi.Pointer CascadeClassifier_DetectMultiScale_Async( + CascadeClassifier self, + Mat img, + CvCallback_1 callback, + ) { + return _CascadeClassifier_DetectMultiScale_Async( + self, + img, + callback, + ); + } + + late final _CascadeClassifier_DetectMultiScale_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(CascadeClassifier, Mat, + CvCallback_1)>>('CascadeClassifier_DetectMultiScale_Async'); + late final _CascadeClassifier_DetectMultiScale_Async = + _CascadeClassifier_DetectMultiScale_AsyncPtr.asFunction< + ffi.Pointer Function( + CascadeClassifier, Mat, CvCallback_1)>(); + ffi.Pointer CascadeClassifier_Empty( CascadeClassifier self, ffi.Pointer rval, @@ -2828,6 +4000,24 @@ class CvNative { ffi.Pointer Function( CascadeClassifier, ffi.Pointer)>(); + ffi.Pointer CascadeClassifier_Empty_Async( + CascadeClassifier self, + CvCallback_1 callback, + ) { + return _CascadeClassifier_Empty_Async( + self, + callback, + ); + } + + late final _CascadeClassifier_Empty_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(CascadeClassifier, + CvCallback_1)>>('CascadeClassifier_Empty_Async'); + late final _CascadeClassifier_Empty_Async = + _CascadeClassifier_Empty_AsyncPtr.asFunction< + ffi.Pointer Function(CascadeClassifier, CvCallback_1)>(); + ffi.Pointer CascadeClassifier_Load( CascadeClassifier self, ffi.Pointer name, @@ -2850,10 +4040,33 @@ class CvNative { ffi.Pointer Function( CascadeClassifier, ffi.Pointer, ffi.Pointer)>(); - ffi.Pointer CascadeClassifier_New( - ffi.Pointer rval, + ffi.Pointer CascadeClassifier_Load_Async( + CascadeClassifier self, + ffi.Pointer name, + CvCallback_1 callback, ) { - return _CascadeClassifier_New( + return _CascadeClassifier_Load_Async( + self, + name, + callback, + ); + } + + late final _CascadeClassifier_Load_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + CascadeClassifier, + ffi.Pointer, + CvCallback_1)>>('CascadeClassifier_Load_Async'); + late final _CascadeClassifier_Load_Async = + _CascadeClassifier_Load_AsyncPtr.asFunction< + ffi.Pointer Function( + CascadeClassifier, ffi.Pointer, CvCallback_1)>(); + + ffi.Pointer CascadeClassifier_New( + ffi.Pointer rval, + ) { + return _CascadeClassifier_New( rval, ); } @@ -2885,6 +4098,39 @@ class CvNative { ffi.Pointer Function( ffi.Pointer, ffi.Pointer)>(); + ffi.Pointer CascadeClassifier_NewFromFile_Async( + ffi.Pointer filename, + CvCallback_1 callback, + ) { + return _CascadeClassifier_NewFromFile_Async( + filename, + callback, + ); + } + + late final _CascadeClassifier_NewFromFile_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + CvCallback_1)>>('CascadeClassifier_NewFromFile_Async'); + late final _CascadeClassifier_NewFromFile_Async = + _CascadeClassifier_NewFromFile_AsyncPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, CvCallback_1)>(); + + ffi.Pointer CascadeClassifier_New_Async( + CvCallback_1 callback, + ) { + return _CascadeClassifier_New_Async( + callback, + ); + } + + late final _CascadeClassifier_New_AsyncPtr = + _lookup Function(CvCallback_1)>>( + 'CascadeClassifier_New_Async'); + late final _CascadeClassifier_New_Async = _CascadeClassifier_New_AsyncPtr + .asFunction Function(CvCallback_1)>(); + ffi.Pointer CascadeClassifier_getFeatureType( CascadeClassifier self, ffi.Pointer rval, @@ -2904,6 +4150,24 @@ class CvNative { ffi.Pointer Function( CascadeClassifier, ffi.Pointer)>(); + ffi.Pointer CascadeClassifier_getFeatureType_Async( + CascadeClassifier self, + CvCallback_1 callback, + ) { + return _CascadeClassifier_getFeatureType_Async( + self, + callback, + ); + } + + late final _CascadeClassifier_getFeatureType_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(CascadeClassifier, + CvCallback_1)>>('CascadeClassifier_getFeatureType_Async'); + late final _CascadeClassifier_getFeatureType_Async = + _CascadeClassifier_getFeatureType_AsyncPtr.asFunction< + ffi.Pointer Function(CascadeClassifier, CvCallback_1)>(); + ffi.Pointer CascadeClassifier_getOriginalWindowSize( CascadeClassifier self, ffi.Pointer rval, @@ -2923,6 +4187,24 @@ class CvNative { ffi.Pointer Function( CascadeClassifier, ffi.Pointer)>(); + ffi.Pointer CascadeClassifier_getOriginalWindowSize_Async( + CascadeClassifier self, + CvCallback_1 callback, + ) { + return _CascadeClassifier_getOriginalWindowSize_Async( + self, + callback, + ); + } + + late final _CascadeClassifier_getOriginalWindowSize_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(CascadeClassifier, + CvCallback_1)>>('CascadeClassifier_getOriginalWindowSize_Async'); + late final _CascadeClassifier_getOriginalWindowSize_Async = + _CascadeClassifier_getOriginalWindowSize_AsyncPtr.asFunction< + ffi.Pointer Function(CascadeClassifier, CvCallback_1)>(); + ffi.Pointer CascadeClassifier_isOldFormatCascade( CascadeClassifier self, ffi.Pointer rval, @@ -2942,6 +4224,24 @@ class CvNative { ffi.Pointer Function( CascadeClassifier, ffi.Pointer)>(); + ffi.Pointer CascadeClassifier_isOldFormatCascade_Async( + CascadeClassifier self, + CvCallback_1 callback, + ) { + return _CascadeClassifier_isOldFormatCascade_Async( + self, + callback, + ); + } + + late final _CascadeClassifier_isOldFormatCascade_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(CascadeClassifier, + CvCallback_1)>>('CascadeClassifier_isOldFormatCascade_Async'); + late final _CascadeClassifier_isOldFormatCascade_Async = + _CascadeClassifier_isOldFormatCascade_AsyncPtr.asFunction< + ffi.Pointer Function(CascadeClassifier, CvCallback_1)>(); + ffi.Pointer Circle( Mat img, Point center, @@ -2992,6 +4292,62 @@ class CvNative { late final _CircleWithParams = _CircleWithParamsPtr.asFunction< ffi.Pointer Function(Mat, Point, int, Scalar, int, int, int)>(); + ffi.Pointer CircleWithParams_Async( + Mat img, + Point center, + int radius, + Scalar color, + int thickness, + int lineType, + int shift, + CvCallback_0 callback, + ) { + return _CircleWithParams_Async( + img, + center, + radius, + color, + thickness, + lineType, + shift, + callback, + ); + } + + late final _CircleWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Point, ffi.Int, Scalar, ffi.Int, + ffi.Int, ffi.Int, CvCallback_0)>>('CircleWithParams_Async'); + late final _CircleWithParams_Async = _CircleWithParams_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Point, int, Scalar, int, int, int, CvCallback_0)>(); + + ffi.Pointer Circle_Async( + Mat img, + Point center, + int radius, + Scalar color, + int thickness, + CvCallback_0 callback, + ) { + return _Circle_Async( + img, + center, + radius, + color, + thickness, + callback, + ); + } + + late final _Circle_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Point, ffi.Int, Scalar, ffi.Int, + CvCallback_0)>>('Circle_Async'); + late final _Circle_Async = _Circle_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Point, int, Scalar, int, CvCallback_0)>(); + ffi.Pointer ClipLine( Rect imgRect, Point pt1, @@ -3014,6 +4370,27 @@ class CvNative { ffi.Pointer Function( Rect, Point, Point, ffi.Pointer)>(); + ffi.Pointer ClipLine_Async( + Rect imgRect, + Point pt1, + Point pt2, + CvCallback_1 callback, + ) { + return _ClipLine_Async( + imgRect, + pt1, + pt2, + callback, + ); + } + + late final _ClipLine_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Rect, Point, Point, CvCallback_1)>>('ClipLine_Async'); + late final _ClipLine_Async = _ClipLine_AsyncPtr.asFunction< + ffi.Pointer Function(Rect, Point, Point, CvCallback_1)>(); + ffi.Pointer ColorChange( Mat src, Mat mask, @@ -3039,6 +4416,32 @@ class CvNative { late final _ColorChange = _ColorChangePtr.asFunction< ffi.Pointer Function(Mat, Mat, Mat, double, double, double)>(); + ffi.Pointer ColorChange_Async( + Mat src, + Mat mask, + double red_mul, + double green_mul, + double blue_mul, + CvCallback_1 callback, + ) { + return _ColorChange_Async( + src, + mask, + red_mul, + green_mul, + blue_mul, + callback, + ); + } + + late final _ColorChange_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, ffi.Float, ffi.Float, + ffi.Float, CvCallback_1)>>('ColorChange_Async'); + late final _ColorChange_Async = _ColorChange_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, double, double, double, CvCallback_1)>(); + ffi.Pointer CompareHist( Mat hist1, Mat hist2, @@ -3060,6 +4463,27 @@ class CvNative { late final _CompareHist = _CompareHistPtr.asFunction< ffi.Pointer Function(Mat, Mat, int, ffi.Pointer)>(); + ffi.Pointer CompareHist_Async( + Mat hist1, + Mat hist2, + int method, + CvCallback_1 callback, + ) { + return _CompareHist_Async( + hist1, + hist2, + method, + callback, + ); + } + + late final _CompareHist_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, ffi.Int, CvCallback_1)>>('CompareHist_Async'); + late final _CompareHist_Async = _CompareHist_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, int, CvCallback_1)>(); + ffi.Pointer ConnectedComponents( Mat src, Mat dst, @@ -3117,6 +4541,54 @@ class CvNative { ffi.Pointer Function( Mat, Mat, Mat, Mat, int, int, int, ffi.Pointer)>(); + ffi.Pointer ConnectedComponentsWithStats_Async( + Mat src, + int connectivity, + int ltype, + int ccltype, + CvCallback_4 callback, + ) { + return _ConnectedComponentsWithStats_Async( + src, + connectivity, + ltype, + ccltype, + callback, + ); + } + + late final _ConnectedComponentsWithStats_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, ffi.Int, ffi.Int, ffi.Int, + CvCallback_4)>>('ConnectedComponentsWithStats_Async'); + late final _ConnectedComponentsWithStats_Async = + _ConnectedComponentsWithStats_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, int, int, CvCallback_4)>(); + + ffi.Pointer ConnectedComponents_Async( + Mat src, + int connectivity, + int ltype, + int ccltype, + CvCallback_2 callback, + ) { + return _ConnectedComponents_Async( + src, + connectivity, + ltype, + ccltype, + callback, + ); + } + + late final _ConnectedComponents_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, ffi.Int, ffi.Int, ffi.Int, + CvCallback_2)>>('ConnectedComponents_Async'); + late final _ConnectedComponents_Async = + _ConnectedComponents_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, int, int, CvCallback_2)>(); + ffi.Pointer ContourArea( VecPoint pts, ffi.Pointer rval, @@ -3134,6 +4606,23 @@ class CvNative { late final _ContourArea = _ContourAreaPtr.asFunction< ffi.Pointer Function(VecPoint, ffi.Pointer)>(); + ffi.Pointer ContourArea_Async( + VecPoint pts, + CvCallback_1 callback, + ) { + return _ContourArea_Async( + pts, + callback, + ); + } + + late final _ContourArea_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPoint, CvCallback_1)>>('ContourArea_Async'); + late final _ContourArea_Async = _ContourArea_AsyncPtr.asFunction< + ffi.Pointer Function(VecPoint, CvCallback_1)>(); + ffi.Pointer ConvexHull( VecPoint points, Mat hull, @@ -3155,6 +4644,27 @@ class CvNative { late final _ConvexHull = _ConvexHullPtr.asFunction< ffi.Pointer Function(VecPoint, Mat, bool, bool)>(); + ffi.Pointer ConvexHull_Async( + VecPoint points, + bool clockwise, + bool returnPoints, + CvCallback_1 callback, + ) { + return _ConvexHull_Async( + points, + clockwise, + returnPoints, + callback, + ); + } + + late final _ConvexHull_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPoint, ffi.Bool, ffi.Bool, CvCallback_1)>>('ConvexHull_Async'); + late final _ConvexHull_Async = _ConvexHull_AsyncPtr.asFunction< + ffi.Pointer Function(VecPoint, bool, bool, CvCallback_1)>(); + ffi.Pointer ConvexityDefects( VecPoint points, Mat hull, @@ -3174,6 +4684,25 @@ class CvNative { late final _ConvexityDefects = _ConvexityDefectsPtr.asFunction< ffi.Pointer Function(VecPoint, Mat, Mat)>(); + ffi.Pointer ConvexityDefects_Async( + VecPoint points, + Mat hull, + CvCallback_1 callback, + ) { + return _ConvexityDefects_Async( + points, + hull, + callback, + ); + } + + late final _ConvexityDefects_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPoint, Mat, CvCallback_1)>>('ConvexityDefects_Async'); + late final _ConvexityDefects_Async = _ConvexityDefects_AsyncPtr.asFunction< + ffi.Pointer Function(VecPoint, Mat, CvCallback_1)>(); + ffi.Pointer CornerSubPix( Mat img, VecPoint2f corners, @@ -3198,6 +4727,32 @@ class CvNative { ffi.Pointer Function( Mat, VecPoint2f, Size, Size, TermCriteria)>(); + ffi.Pointer CornerSubPix_Async( + Mat img, + VecPoint2f corners, + Size winSize, + Size zeroZone, + TermCriteria criteria, + CvCallback_0 callback, + ) { + return _CornerSubPix_Async( + img, + corners, + winSize, + zeroZone, + criteria, + callback, + ); + } + + late final _CornerSubPix_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, VecPoint2f, Size, Size, + TermCriteria, CvCallback_0)>>('CornerSubPix_Async'); + late final _CornerSubPix_Async = _CornerSubPix_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, VecPoint2f, Size, Size, TermCriteria, CvCallback_0)>(); + void CvStatus_Close( ffi.Pointer self, ) { @@ -3230,6 +4785,25 @@ class CvNative { late final _CvtColor = _CvtColorPtr.asFunction Function(Mat, Mat, int)>(); + ffi.Pointer CvtColor_Async( + Mat src, + int code, + CvCallback_1 callback, + ) { + return _CvtColor_Async( + src, + code, + callback, + ); + } + + late final _CvtColor_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, ffi.Int, CvCallback_1)>>('CvtColor_Async'); + late final _CvtColor_Async = _CvtColor_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, CvCallback_1)>(); + ffi.Pointer DetailEnhance( Mat src, Mat dst, @@ -3251,12 +4825,33 @@ class CvNative { late final _DetailEnhance = _DetailEnhancePtr.asFunction< ffi.Pointer Function(Mat, Mat, double, double)>(); - ffi.Pointer Dilate( + ffi.Pointer DetailEnhance_Async( Mat src, - Mat dst, - Mat kernel, + double sigma_s, + double sigma_r, + CvCallback_1 callback, ) { - return _Dilate( + return _DetailEnhance_Async( + src, + sigma_s, + sigma_r, + callback, + ); + } + + late final _DetailEnhance_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, ffi.Float, ffi.Float, CvCallback_1)>>('DetailEnhance_Async'); + late final _DetailEnhance_Async = _DetailEnhance_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, double, double, CvCallback_1)>(); + + ffi.Pointer Dilate( + Mat src, + Mat dst, + Mat kernel, + ) { + return _Dilate( src, dst, kernel, @@ -3296,6 +4891,53 @@ class CvNative { late final _DilateWithParams = _DilateWithParamsPtr.asFunction< ffi.Pointer Function(Mat, Mat, Mat, Point, int, int, Scalar)>(); + ffi.Pointer DilateWithParams_Async( + Mat src, + Mat kernel, + Point anchor, + int iterations, + int borderType, + Scalar borderValue, + CvCallback_1 callback, + ) { + return _DilateWithParams_Async( + src, + kernel, + anchor, + iterations, + borderType, + borderValue, + callback, + ); + } + + late final _DilateWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, Point, ffi.Int, ffi.Int, + Scalar, CvCallback_1)>>('DilateWithParams_Async'); + late final _DilateWithParams_Async = _DilateWithParams_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, Point, int, int, Scalar, CvCallback_1)>(); + + ffi.Pointer Dilate_Async( + Mat src, + Mat kernel, + CvCallback_1 callback, + ) { + return _Dilate_Async( + src, + kernel, + callback, + ); + } + + late final _Dilate_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, CvCallback_1)>>('Dilate_Async'); + late final _Dilate_Async = _Dilate_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, CvCallback_1)>(); + ffi.Pointer DistanceTransform( Mat src, Mat dst, @@ -3321,6 +4963,29 @@ class CvNative { late final _DistanceTransform = _DistanceTransformPtr.asFunction< ffi.Pointer Function(Mat, Mat, Mat, int, int, int)>(); + ffi.Pointer DistanceTransform_Async( + Mat src, + int distanceType, + int maskSize, + int labelType, + CvCallback_2 callback, + ) { + return _DistanceTransform_Async( + src, + distanceType, + maskSize, + labelType, + callback, + ); + } + + late final _DistanceTransform_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, ffi.Int, ffi.Int, ffi.Int, + CvCallback_2)>>('DistanceTransform_Async'); + late final _DistanceTransform_Async = _DistanceTransform_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, int, int, CvCallback_2)>(); + ffi.Pointer DrawChessboardCorners( Mat image, Size patternSize, @@ -3405,6 +5070,76 @@ class CvNative { ffi.Pointer Function( Mat, VecVecPoint, int, Scalar, int, int, Mat, int, Point)>(); + ffi.Pointer DrawContoursWithParams_Async( + Mat src, + VecVecPoint contours, + int contourIdx, + Scalar color, + int thickness, + int lineType, + Mat hierarchy, + int maxLevel, + Point offset, + CvCallback_0 callback, + ) { + return _DrawContoursWithParams_Async( + src, + contours, + contourIdx, + color, + thickness, + lineType, + hierarchy, + maxLevel, + offset, + callback, + ); + } + + late final _DrawContoursWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, + VecVecPoint, + ffi.Int, + Scalar, + ffi.Int, + ffi.Int, + Mat, + ffi.Int, + Point, + CvCallback_0)>>('DrawContoursWithParams_Async'); + late final _DrawContoursWithParams_Async = + _DrawContoursWithParams_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, VecVecPoint, int, Scalar, int, + int, Mat, int, Point, CvCallback_0)>(); + + ffi.Pointer DrawContours_Async( + Mat src, + VecVecPoint contours, + int contourIdx, + Scalar color, + int thickness, + CvCallback_0 callback, + ) { + return _DrawContours_Async( + src, + contours, + contourIdx, + color, + thickness, + callback, + ); + } + + late final _DrawContours_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, VecVecPoint, ffi.Int, Scalar, + ffi.Int, CvCallback_0)>>('DrawContours_Async'); + late final _DrawContours_Async = _DrawContours_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, VecVecPoint, int, Scalar, int, CvCallback_0)>(); + ffi.Pointer DrawKeyPoints( Mat src, VecKeyPoint kp, @@ -3428,6 +5163,32 @@ 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, @@ -3471,6 +5232,52 @@ 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, @@ -3494,6 +5301,31 @@ class CvNative { late final _EdgePreservingFilter = _EdgePreservingFilterPtr.asFunction< ffi.Pointer Function(Mat, Mat, int, double, double)>(); + ffi.Pointer EdgePreservingFilter_Async( + Mat src, + int filter, + double sigma_s, + double sigma_r, + CvCallback_1 callback, + ) { + return _EdgePreservingFilter_Async( + src, + filter, + sigma_s, + sigma_r, + callback, + ); + } + + late final _EdgePreservingFilter_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, ffi.Int, ffi.Float, ffi.Float, + CvCallback_1)>>('EdgePreservingFilter_Async'); + late final _EdgePreservingFilter_Async = + _EdgePreservingFilter_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, int, double, double, CvCallback_1)>(); + ffi.Pointer Ellipse( Mat img, Point center, @@ -3567,37 +5399,140 @@ class CvNative { ffi.Pointer Function( Mat, Point, Point, double, double, double, Scalar, int, int, int)>(); - ffi.Pointer EqualizeHist( - Mat src, - Mat dst, + ffi.Pointer EllipseWithParams_Async( + Mat img, + Point center, + Point axes, + double angle, + double startAngle, + double endAngle, + Scalar color, + int thickness, + int lineType, + int shift, + CvCallback_0 callback, ) { - return _EqualizeHist( - src, - dst, + return _EllipseWithParams_Async( + img, + center, + axes, + angle, + startAngle, + endAngle, + color, + thickness, + lineType, + shift, + callback, ); } - late final _EqualizeHistPtr = - _lookup Function(Mat, Mat)>>( - 'EqualizeHist'); - late final _EqualizeHist = - _EqualizeHistPtr.asFunction Function(Mat, Mat)>(); + late final _EllipseWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, + Point, + Point, + ffi.Double, + ffi.Double, + ffi.Double, + Scalar, + ffi.Int, + ffi.Int, + ffi.Int, + CvCallback_0)>>('EllipseWithParams_Async'); + late final _EllipseWithParams_Async = _EllipseWithParams_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Point, Point, double, double, double, + Scalar, int, int, int, CvCallback_0)>(); - ffi.Pointer Erode( - Mat src, - Mat dst, - Mat kernel, + ffi.Pointer Ellipse_Async( + Mat img, + Point center, + Point axes, + double angle, + double startAngle, + double endAngle, + Scalar color, + int thickness, + CvCallback_0 callback, ) { - return _Erode( - src, - dst, - kernel, - ); - } - - late final _ErodePtr = _lookup< - ffi - .NativeFunction Function(Mat, Mat, Mat)>>('Erode'); + return _Ellipse_Async( + img, + center, + axes, + angle, + startAngle, + endAngle, + color, + thickness, + callback, + ); + } + + late final _Ellipse_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, + Point, + Point, + ffi.Double, + ffi.Double, + ffi.Double, + Scalar, + ffi.Int, + CvCallback_0)>>('Ellipse_Async'); + late final _Ellipse_Async = _Ellipse_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Point, Point, double, double, double, + Scalar, int, CvCallback_0)>(); + + ffi.Pointer EqualizeHist( + Mat src, + Mat dst, + ) { + return _EqualizeHist( + src, + dst, + ); + } + + late final _EqualizeHistPtr = + _lookup Function(Mat, Mat)>>( + 'EqualizeHist'); + late final _EqualizeHist = + _EqualizeHistPtr.asFunction Function(Mat, Mat)>(); + + ffi.Pointer EqualizeHist_Async( + Mat src, + CvCallback_1 callback, + ) { + return _EqualizeHist_Async( + src, + callback, + ); + } + + late final _EqualizeHist_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Mat, CvCallback_1)>>( + 'EqualizeHist_Async'); + late final _EqualizeHist_Async = _EqualizeHist_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, CvCallback_1)>(); + + ffi.Pointer Erode( + Mat src, + Mat dst, + Mat kernel, + ) { + return _Erode( + src, + dst, + kernel, + ); + } + + late final _ErodePtr = _lookup< + ffi + .NativeFunction Function(Mat, Mat, Mat)>>('Erode'); late final _Erode = _ErodePtr.asFunction Function(Mat, Mat, Mat)>(); @@ -3628,6 +5563,53 @@ class CvNative { late final _ErodeWithParams = _ErodeWithParamsPtr.asFunction< ffi.Pointer Function(Mat, Mat, Mat, Point, int, int, Scalar)>(); + ffi.Pointer ErodeWithParams_Async( + Mat src, + Mat kernel, + Point anchor, + int iterations, + int borderType, + Scalar borderValue, + CvCallback_1 callback, + ) { + return _ErodeWithParams_Async( + src, + kernel, + anchor, + iterations, + borderType, + borderValue, + callback, + ); + } + + late final _ErodeWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, Point, ffi.Int, ffi.Int, + Scalar, CvCallback_1)>>('ErodeWithParams_Async'); + late final _ErodeWithParams_Async = _ErodeWithParams_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, Point, int, int, Scalar, CvCallback_1)>(); + + ffi.Pointer Erode_Async( + Mat src, + Mat kernel, + CvCallback_1 callback, + ) { + return _Erode_Async( + src, + kernel, + callback, + ); + } + + late final _Erode_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, CvCallback_1)>>('Erode_Async'); + late final _Erode_Async = _Erode_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, CvCallback_1)>(); + ffi.Pointer EstimateAffine2D( VecPoint2f from, VecPoint2f to, @@ -3804,6 +5786,26 @@ class CvNative { late final _FaceDetectorYN_Detect = _FaceDetectorYN_DetectPtr.asFunction< ffi.Pointer Function(FaceDetectorYN, Mat, ffi.Pointer)>(); + ffi.Pointer FaceDetectorYN_Detect_Async( + FaceDetectorYN self, + Mat img, + CvCallback_1 callback, + ) { + return _FaceDetectorYN_Detect_Async( + self, + img, + callback, + ); + } + + late final _FaceDetectorYN_Detect_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(FaceDetectorYN, Mat, + CvCallback_1)>>('FaceDetectorYN_Detect_Async'); + late final _FaceDetectorYN_Detect_Async = + _FaceDetectorYN_Detect_AsyncPtr.asFunction< + ffi.Pointer Function(FaceDetectorYN, Mat, CvCallback_1)>(); + ffi.Pointer FaceDetectorYN_GetInputSize( FaceDetectorYN self, ffi.Pointer input_size, @@ -3822,6 +5824,24 @@ class CvNative { _FaceDetectorYN_GetInputSizePtr.asFunction< ffi.Pointer Function(FaceDetectorYN, ffi.Pointer)>(); + ffi.Pointer FaceDetectorYN_GetInputSize_Async( + FaceDetectorYN self, + CvCallback_1 callback, + ) { + return _FaceDetectorYN_GetInputSize_Async( + self, + callback, + ); + } + + late final _FaceDetectorYN_GetInputSize_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(FaceDetectorYN, + CvCallback_1)>>('FaceDetectorYN_GetInputSize_Async'); + late final _FaceDetectorYN_GetInputSize_Async = + _FaceDetectorYN_GetInputSize_AsyncPtr.asFunction< + ffi.Pointer Function(FaceDetectorYN, CvCallback_1)>(); + ffi.Pointer FaceDetectorYN_GetNMSThreshold( FaceDetectorYN self, ffi.Pointer nms_threshold, @@ -3841,6 +5861,24 @@ class CvNative { ffi.Pointer Function( FaceDetectorYN, ffi.Pointer)>(); + ffi.Pointer FaceDetectorYN_GetNMSThreshold_Async( + FaceDetectorYN self, + CvCallback_1 callback, + ) { + return _FaceDetectorYN_GetNMSThreshold_Async( + self, + callback, + ); + } + + late final _FaceDetectorYN_GetNMSThreshold_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(FaceDetectorYN, + CvCallback_1)>>('FaceDetectorYN_GetNMSThreshold_Async'); + late final _FaceDetectorYN_GetNMSThreshold_Async = + _FaceDetectorYN_GetNMSThreshold_AsyncPtr.asFunction< + ffi.Pointer Function(FaceDetectorYN, CvCallback_1)>(); + ffi.Pointer FaceDetectorYN_GetScoreThreshold( FaceDetectorYN self, ffi.Pointer score_threshold, @@ -3860,6 +5898,24 @@ class CvNative { ffi.Pointer Function( FaceDetectorYN, ffi.Pointer)>(); + ffi.Pointer FaceDetectorYN_GetScoreThreshold_Async( + FaceDetectorYN self, + CvCallback_1 callback, + ) { + return _FaceDetectorYN_GetScoreThreshold_Async( + self, + callback, + ); + } + + late final _FaceDetectorYN_GetScoreThreshold_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(FaceDetectorYN, + CvCallback_1)>>('FaceDetectorYN_GetScoreThreshold_Async'); + late final _FaceDetectorYN_GetScoreThreshold_Async = + _FaceDetectorYN_GetScoreThreshold_AsyncPtr.asFunction< + ffi.Pointer Function(FaceDetectorYN, CvCallback_1)>(); + ffi.Pointer FaceDetectorYN_GetTopK( FaceDetectorYN self, ffi.Pointer top_k, @@ -3877,6 +5933,24 @@ class CvNative { late final _FaceDetectorYN_GetTopK = _FaceDetectorYN_GetTopKPtr.asFunction< ffi.Pointer Function(FaceDetectorYN, ffi.Pointer)>(); + ffi.Pointer FaceDetectorYN_GetTopK_Async( + FaceDetectorYN self, + CvCallback_1 callback, + ) { + return _FaceDetectorYN_GetTopK_Async( + self, + callback, + ); + } + + late final _FaceDetectorYN_GetTopK_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + FaceDetectorYN, CvCallback_1)>>('FaceDetectorYN_GetTopK_Async'); + late final _FaceDetectorYN_GetTopK_Async = + _FaceDetectorYN_GetTopK_AsyncPtr.asFunction< + ffi.Pointer Function(FaceDetectorYN, CvCallback_1)>(); + ffi.Pointer FaceDetectorYN_New( ffi.Pointer model, ffi.Pointer config, @@ -3978,6 +6052,99 @@ class CvNative { int, ffi.Pointer)>(); + ffi.Pointer FaceDetectorYN_NewFromBuffer_Async( + ffi.Pointer framework, + VecUChar buffer, + VecUChar buffer_config, + Size input_size, + double score_threshold, + double nms_threshold, + int top_k, + int backend_id, + int target_id, + CvCallback_1 callback, + ) { + return _FaceDetectorYN_NewFromBuffer_Async( + framework, + buffer, + buffer_config, + input_size, + score_threshold, + nms_threshold, + top_k, + backend_id, + target_id, + callback, + ); + } + + late final _FaceDetectorYN_NewFromBuffer_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + VecUChar, + VecUChar, + Size, + ffi.Float, + ffi.Float, + ffi.Int, + ffi.Int, + ffi.Int, + CvCallback_1)>>('FaceDetectorYN_NewFromBuffer_Async'); + late final _FaceDetectorYN_NewFromBuffer_Async = + _FaceDetectorYN_NewFromBuffer_AsyncPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, VecUChar, + VecUChar, Size, double, double, int, int, int, CvCallback_1)>(); + + ffi.Pointer FaceDetectorYN_New_Async( + ffi.Pointer model, + ffi.Pointer config, + Size input_size, + double score_threshold, + double nms_threshold, + int top_k, + int backend_id, + int target_id, + CvCallback_1 callback, + ) { + return _FaceDetectorYN_New_Async( + model, + config, + input_size, + score_threshold, + nms_threshold, + top_k, + backend_id, + target_id, + callback, + ); + } + + late final _FaceDetectorYN_New_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + Size, + ffi.Float, + ffi.Float, + ffi.Int, + ffi.Int, + ffi.Int, + CvCallback_1)>>('FaceDetectorYN_New_Async'); + late final _FaceDetectorYN_New_Async = + _FaceDetectorYN_New_AsyncPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + Size, + double, + double, + int, + int, + int, + CvCallback_1)>(); + ffi.Pointer FaceDetectorYN_SetInputSize( FaceDetectorYN self, Size input_size, @@ -3995,6 +6162,26 @@ class CvNative { late final _FaceDetectorYN_SetInputSize = _FaceDetectorYN_SetInputSizePtr .asFunction Function(FaceDetectorYN, Size)>(); + ffi.Pointer FaceDetectorYN_SetInputSize_Async( + FaceDetectorYN self, + Size input_size, + CvCallback_0 callback, + ) { + return _FaceDetectorYN_SetInputSize_Async( + self, + input_size, + callback, + ); + } + + late final _FaceDetectorYN_SetInputSize_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(FaceDetectorYN, Size, + CvCallback_0)>>('FaceDetectorYN_SetInputSize_Async'); + late final _FaceDetectorYN_SetInputSize_Async = + _FaceDetectorYN_SetInputSize_AsyncPtr.asFunction< + ffi.Pointer Function(FaceDetectorYN, Size, CvCallback_0)>(); + ffi.Pointer FaceDetectorYN_SetNMSThreshold( FaceDetectorYN self, double nms_threshold, @@ -4013,6 +6200,27 @@ class CvNative { _FaceDetectorYN_SetNMSThresholdPtr.asFunction< ffi.Pointer Function(FaceDetectorYN, double)>(); + ffi.Pointer FaceDetectorYN_SetNMSThreshold_Async( + FaceDetectorYN self, + double nms_threshold, + CvCallback_0 callback, + ) { + return _FaceDetectorYN_SetNMSThreshold_Async( + self, + nms_threshold, + callback, + ); + } + + late final _FaceDetectorYN_SetNMSThreshold_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(FaceDetectorYN, ffi.Float, + CvCallback_0)>>('FaceDetectorYN_SetNMSThreshold_Async'); + late final _FaceDetectorYN_SetNMSThreshold_Async = + _FaceDetectorYN_SetNMSThreshold_AsyncPtr.asFunction< + ffi.Pointer Function( + FaceDetectorYN, double, CvCallback_0)>(); + ffi.Pointer FaceDetectorYN_SetScoreThreshold( FaceDetectorYN self, double score_threshold, @@ -4031,23 +6239,64 @@ class CvNative { _FaceDetectorYN_SetScoreThresholdPtr.asFunction< ffi.Pointer Function(FaceDetectorYN, double)>(); - ffi.Pointer FaceDetectorYN_SetTopK( + ffi.Pointer FaceDetectorYN_SetScoreThreshold_Async( FaceDetectorYN self, - int top_k, + double score_threshold, + CvCallback_0 callback, ) { - return _FaceDetectorYN_SetTopK( + return _FaceDetectorYN_SetScoreThreshold_Async( self, - top_k, + score_threshold, + callback, ); } - late final _FaceDetectorYN_SetTopKPtr = _lookup< + late final _FaceDetectorYN_SetScoreThreshold_AsyncPtr = _lookup< ffi.NativeFunction< + ffi.Pointer Function(FaceDetectorYN, ffi.Float, + CvCallback_0)>>('FaceDetectorYN_SetScoreThreshold_Async'); + late final _FaceDetectorYN_SetScoreThreshold_Async = + _FaceDetectorYN_SetScoreThreshold_AsyncPtr.asFunction< ffi.Pointer Function( - FaceDetectorYN, ffi.Int)>>('FaceDetectorYN_SetTopK'); - late final _FaceDetectorYN_SetTopK = _FaceDetectorYN_SetTopKPtr.asFunction< + FaceDetectorYN, double, CvCallback_0)>(); + + ffi.Pointer FaceDetectorYN_SetTopK( + FaceDetectorYN self, + int top_k, + ) { + return _FaceDetectorYN_SetTopK( + self, + top_k, + ); + } + + late final _FaceDetectorYN_SetTopKPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + FaceDetectorYN, ffi.Int)>>('FaceDetectorYN_SetTopK'); + late final _FaceDetectorYN_SetTopK = _FaceDetectorYN_SetTopKPtr.asFunction< ffi.Pointer Function(FaceDetectorYN, int)>(); + ffi.Pointer FaceDetectorYN_SetTopK_Async( + FaceDetectorYN self, + int top_k, + CvCallback_0 callback, + ) { + return _FaceDetectorYN_SetTopK_Async( + self, + top_k, + callback, + ); + } + + late final _FaceDetectorYN_SetTopK_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(FaceDetectorYN, ffi.Int, + CvCallback_0)>>('FaceDetectorYN_SetTopK_Async'); + late final _FaceDetectorYN_SetTopK_Async = + _FaceDetectorYN_SetTopK_AsyncPtr.asFunction< + ffi.Pointer Function(FaceDetectorYN, int, CvCallback_0)>(); + ffi.Pointer FaceRecognizerSF_AlignCrop( FaceRecognizerSF self, Mat src_img, @@ -4071,6 +6320,29 @@ class CvNative { ffi.Pointer Function( FaceRecognizerSF, Mat, Mat, ffi.Pointer)>(); + ffi.Pointer FaceRecognizerSF_AlignCrop_Async( + FaceRecognizerSF self, + Mat src_img, + Mat face_box, + CvCallback_1 callback, + ) { + return _FaceRecognizerSF_AlignCrop_Async( + self, + src_img, + face_box, + callback, + ); + } + + late final _FaceRecognizerSF_AlignCrop_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(FaceRecognizerSF, Mat, Mat, + CvCallback_1)>>('FaceRecognizerSF_AlignCrop_Async'); + late final _FaceRecognizerSF_AlignCrop_Async = + _FaceRecognizerSF_AlignCrop_AsyncPtr.asFunction< + ffi.Pointer Function( + FaceRecognizerSF, Mat, Mat, CvCallback_1)>(); + void FaceRecognizerSF_Close( FaceRecognizerSFPtr self, ) { @@ -4108,6 +6380,29 @@ class CvNative { ffi.Pointer Function( FaceRecognizerSF, Mat, bool, ffi.Pointer)>(); + ffi.Pointer FaceRecognizerSF_Feature_Async( + FaceRecognizerSF self, + Mat aligned_img, + bool clone, + CvCallback_1 callback, + ) { + return _FaceRecognizerSF_Feature_Async( + self, + aligned_img, + clone, + callback, + ); + } + + late final _FaceRecognizerSF_Feature_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(FaceRecognizerSF, Mat, ffi.Bool, + CvCallback_1)>>('FaceRecognizerSF_Feature_Async'); + late final _FaceRecognizerSF_Feature_Async = + _FaceRecognizerSF_Feature_AsyncPtr.asFunction< + ffi.Pointer Function( + FaceRecognizerSF, Mat, bool, CvCallback_1)>(); + ffi.Pointer FaceRecognizerSF_Match( FaceRecognizerSF self, Mat face_feature1, @@ -4132,6 +6427,31 @@ class CvNative { ffi.Pointer Function( FaceRecognizerSF, Mat, Mat, int, ffi.Pointer)>(); + ffi.Pointer FaceRecognizerSF_Match_Async( + FaceRecognizerSF self, + Mat face_feature1, + Mat face_feature2, + int dis_type, + CvCallback_1 callback, + ) { + return _FaceRecognizerSF_Match_Async( + self, + face_feature1, + face_feature2, + dis_type, + callback, + ); + } + + late final _FaceRecognizerSF_Match_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(FaceRecognizerSF, Mat, Mat, ffi.Int, + CvCallback_1)>>('FaceRecognizerSF_Match_Async'); + late final _FaceRecognizerSF_Match_Async = + _FaceRecognizerSF_Match_AsyncPtr.asFunction< + ffi.Pointer Function( + FaceRecognizerSF, Mat, Mat, int, CvCallback_1)>(); + ffi.Pointer FaceRecognizerSF_New( ffi.Pointer model, ffi.Pointer config, @@ -4160,6 +6480,35 @@ class CvNative { ffi.Pointer Function(ffi.Pointer, ffi.Pointer, int, int, ffi.Pointer)>(); + ffi.Pointer FaceRecognizerSF_New_Async( + ffi.Pointer model, + ffi.Pointer config, + int backend_id, + int target_id, + CvCallback_1 callback, + ) { + return _FaceRecognizerSF_New_Async( + model, + config, + backend_id, + target_id, + callback, + ); + } + + late final _FaceRecognizerSF_New_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Int, + ffi.Int, + CvCallback_1)>>('FaceRecognizerSF_New_Async'); + late final _FaceRecognizerSF_New_Async = + _FaceRecognizerSF_New_AsyncPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, int, int, CvCallback_1)>(); + void FastFeatureDetector_Close( FastFeatureDetectorPtr f, ) { @@ -4174,6 +6523,25 @@ 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, ) { @@ -4214,6 +6582,43 @@ 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, @@ -4235,6 +6640,27 @@ 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, @@ -4327,6 +6753,60 @@ class CvNative { ffi.Pointer Function( VecMat, Mat, int, int, double, double, int, int)>(); + ffi.Pointer FastNlMeansDenoisingColoredMultiWithParams_Async( + VecMat src, + int imgToDenoiseIndex, + int temporalWindowSize, + double h, + double hColor, + int templateWindowSize, + int searchWindowSize, + CvCallback_1 callback, + ) { + return _FastNlMeansDenoisingColoredMultiWithParams_Async( + src, + imgToDenoiseIndex, + temporalWindowSize, + h, + hColor, + templateWindowSize, + searchWindowSize, + callback, + ); + } + + late final _FastNlMeansDenoisingColoredMultiWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecMat, ffi.Int, ffi.Int, + ffi.Float, ffi.Float, ffi.Int, ffi.Int, CvCallback_1)>>( + 'FastNlMeansDenoisingColoredMultiWithParams_Async'); + late final _FastNlMeansDenoisingColoredMultiWithParams_Async = + _FastNlMeansDenoisingColoredMultiWithParams_AsyncPtr.asFunction< + ffi.Pointer Function( + VecMat, int, int, double, double, int, int, CvCallback_1)>(); + + ffi.Pointer FastNlMeansDenoisingColoredMulti_Async( + VecMat src, + int imgToDenoiseIndex, + int temporalWindowSize, + CvCallback_1 callback, + ) { + return _FastNlMeansDenoisingColoredMulti_Async( + src, + imgToDenoiseIndex, + temporalWindowSize, + callback, + ); + } + + late final _FastNlMeansDenoisingColoredMulti_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecMat, ffi.Int, ffi.Int, + CvCallback_1)>>('FastNlMeansDenoisingColoredMulti_Async'); + late final _FastNlMeansDenoisingColoredMulti_Async = + _FastNlMeansDenoisingColoredMulti_AsyncPtr.asFunction< + ffi.Pointer Function(VecMat, int, int, CvCallback_1)>(); + ffi.Pointer FastNlMeansDenoisingColoredWithParams( Mat src, Mat dst, @@ -4353,6 +6833,56 @@ class CvNative { _FastNlMeansDenoisingColoredWithParamsPtr.asFunction< ffi.Pointer Function(Mat, Mat, double, double, int, int)>(); + ffi.Pointer FastNlMeansDenoisingColoredWithParams_Async( + Mat src, + double h, + double hColor, + int templateWindowSize, + int searchWindowSize, + CvCallback_1 callback, + ) { + return _FastNlMeansDenoisingColoredWithParams_Async( + src, + h, + hColor, + templateWindowSize, + searchWindowSize, + callback, + ); + } + + late final _FastNlMeansDenoisingColoredWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, + ffi.Float, + ffi.Float, + ffi.Int, + ffi.Int, + CvCallback_1)>>('FastNlMeansDenoisingColoredWithParams_Async'); + late final _FastNlMeansDenoisingColoredWithParams_Async = + _FastNlMeansDenoisingColoredWithParams_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, double, double, int, int, CvCallback_1)>(); + + ffi.Pointer FastNlMeansDenoisingColored_Async( + Mat src, + CvCallback_1 callback, + ) { + return _FastNlMeansDenoisingColored_Async( + src, + callback, + ); + } + + late final _FastNlMeansDenoisingColored_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Mat, CvCallback_1)>>( + 'FastNlMeansDenoisingColored_Async'); + late final _FastNlMeansDenoisingColored_Async = + _FastNlMeansDenoisingColored_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, CvCallback_1)>(); + ffi.Pointer FastNlMeansDenoisingWithParams( Mat src, Mat dst, @@ -4377,6 +6907,48 @@ class CvNative { _FastNlMeansDenoisingWithParamsPtr.asFunction< ffi.Pointer Function(Mat, Mat, double, int, int)>(); + ffi.Pointer FastNlMeansDenoisingWithParams_Async( + Mat src, + double h, + int templateWindowSize, + int searchWindowSize, + CvCallback_1 callback, + ) { + return _FastNlMeansDenoisingWithParams_Async( + src, + h, + templateWindowSize, + searchWindowSize, + callback, + ); + } + + late final _FastNlMeansDenoisingWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, ffi.Float, ffi.Int, ffi.Int, + CvCallback_1)>>('FastNlMeansDenoisingWithParams_Async'); + late final _FastNlMeansDenoisingWithParams_Async = + _FastNlMeansDenoisingWithParams_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, double, int, int, CvCallback_1)>(); + + ffi.Pointer FastNlMeansDenoising_Async( + Mat src, + CvCallback_1 callback, + ) { + return _FastNlMeansDenoising_Async( + src, + callback, + ); + } + + late final _FastNlMeansDenoising_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Mat, CvCallback_1)>>( + 'FastNlMeansDenoising_Async'); + late final _FastNlMeansDenoising_Async = _FastNlMeansDenoising_AsyncPtr + .asFunction Function(Mat, CvCallback_1)>(); + ffi.Pointer FillPoly( Mat img, VecVecPoint points, @@ -4422,33 +6994,111 @@ class CvNative { ffi.Pointer Function( Mat, VecVecPoint, Scalar, int, int, Point)>(); - ffi.Pointer Filter2D( - Mat src, - Mat dst, - int ddepth, - Mat kernel, - Point anchor, - double delta, - int borderType, + ffi.Pointer FillPolyWithParams_Async( + Mat img, + VecVecPoint points, + Scalar color, + int lineType, + int shift, + Point offset, + CvCallback_0 callback, ) { - return _Filter2D( - src, - dst, - ddepth, - kernel, - anchor, - delta, - borderType, - ); - } - - late final _Filter2DPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( + return _FillPolyWithParams_Async( + img, + points, + color, + lineType, + shift, + offset, + callback, + ); + } + + late final _FillPolyWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, VecVecPoint, Scalar, ffi.Int, + ffi.Int, Point, CvCallback_0)>>('FillPolyWithParams_Async'); + late final _FillPolyWithParams_Async = + _FillPolyWithParams_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, VecVecPoint, Scalar, int, int, Point, CvCallback_0)>(); + + ffi.Pointer FillPoly_Async( + Mat img, + VecVecPoint points, + Scalar color, + CvCallback_0 callback, + ) { + return _FillPoly_Async( + img, + points, + color, + callback, + ); + } + + late final _FillPoly_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, VecVecPoint, Scalar, CvCallback_0)>>('FillPoly_Async'); + late final _FillPoly_Async = _FillPoly_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, VecVecPoint, Scalar, CvCallback_0)>(); + + ffi.Pointer Filter2D( + Mat src, + Mat dst, + int ddepth, + Mat kernel, + Point anchor, + double delta, + int borderType, + ) { + return _Filter2D( + src, + dst, + ddepth, + kernel, + anchor, + delta, + borderType, + ); + } + + late final _Filter2DPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( Mat, Mat, ffi.Int, Mat, Point, ffi.Double, ffi.Int)>>('Filter2D'); late final _Filter2D = _Filter2DPtr.asFunction< ffi.Pointer Function(Mat, Mat, int, Mat, Point, double, int)>(); + ffi.Pointer Filter2D_Async( + Mat src, + int ddepth, + Mat kernel, + Point anchor, + double delta, + int borderType, + CvCallback_1 callback, + ) { + return _Filter2D_Async( + src, + ddepth, + kernel, + anchor, + delta, + borderType, + callback, + ); + } + + late final _Filter2D_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, ffi.Int, Mat, Point, ffi.Double, + ffi.Int, CvCallback_1)>>('Filter2D_Async'); + late final _Filter2D_Async = _Filter2D_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, int, Mat, Point, double, int, CvCallback_1)>(); + ffi.Pointer FindChessboardCorners( Mat image, Size patternSize, @@ -4548,6 +7198,27 @@ class CvNative { ffi.Pointer Function( Mat, Mat, int, int, ffi.Pointer)>(); + ffi.Pointer FindContours_Async( + Mat src, + int mode, + int method, + CvCallback_2 callback, + ) { + return _FindContours_Async( + src, + mode, + method, + callback, + ); + } + + late final _FindContours_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, ffi.Int, ffi.Int, CvCallback_2)>>('FindContours_Async'); + late final _FindContours_Async = _FindContours_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, int, CvCallback_2)>(); + ffi.Pointer FindHomography( Mat src, Mat dst, @@ -4578,6 +7249,34 @@ class CvNative { ffi.Pointer Function( Mat, Mat, int, double, Mat, int, double, ffi.Pointer)>(); + ffi.Pointer FindHomography_Async( + Mat src, + Mat dst, + int method, + double ransacReprojThreshold, + int maxIters, + double confidence, + CvCallback_2 callback, + ) { + return _FindHomography_Async( + src, + dst, + method, + ransacReprojThreshold, + maxIters, + confidence, + callback, + ); + } + + late final _FindHomography_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, ffi.Int, ffi.Double, ffi.Int, + ffi.Double, CvCallback_2)>>('FindHomography_Async'); + late final _FindHomography_Async = _FindHomography_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, int, double, int, double, CvCallback_2)>(); + ffi.Pointer FindTransformECC( Mat templateImage, Mat inputImage, @@ -4608,6 +7307,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, @@ -4729,6 +7458,23 @@ class CvNative { late final _FitEllipse = _FitEllipsePtr.asFunction< ffi.Pointer Function(VecPoint, ffi.Pointer)>(); + ffi.Pointer FitEllipse_Async( + VecPoint pts, + CvCallback_1 callback, + ) { + return _FitEllipse_Async( + pts, + callback, + ); + } + + late final _FitEllipse_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPoint, CvCallback_1)>>('FitEllipse_Async'); + late final _FitEllipse_Async = _FitEllipse_AsyncPtr.asFunction< + ffi.Pointer Function(VecPoint, CvCallback_1)>(); + ffi.Pointer FitLine( VecPoint pts, Mat line, @@ -4755,6 +7501,32 @@ class CvNative { ffi.Pointer Function( VecPoint, Mat, int, double, double, double)>(); + ffi.Pointer FitLine_Async( + VecPoint pts, + int distType, + double param, + double reps, + double aeps, + CvCallback_1 callback, + ) { + return _FitLine_Async( + pts, + distType, + param, + reps, + aeps, + callback, + ); + } + + late final _FitLine_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecPoint, ffi.Int, ffi.Double, + ffi.Double, ffi.Double, CvCallback_1)>>('FitLine_Async'); + late final _FitLine_Async = _FitLine_AsyncPtr.asFunction< + ffi.Pointer Function( + VecPoint, int, double, double, double, CvCallback_1)>(); + void FlannBasedMatcher_Close( FlannBasedMatcherPtr f, ) { @@ -4769,6 +7541,24 @@ 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, ) { @@ -4785,6 +7575,21 @@ 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, @@ -4810,107 +7615,382 @@ class CvNative { ffi.Pointer Function( FlannBasedMatcher, Mat, Mat, int, ffi.Pointer)>(); - void GFTTDetector_Close( - GFTTDetectorPtr a, + ffi.Pointer FlannBasedMatcher_KnnMatch_Async( + FlannBasedMatcher self, + Mat query, + Mat train, + int k, + CvCallback_1 callback, ) { - return _GFTTDetector_Close( - a, + return _FlannBasedMatcher_KnnMatch_Async( + self, + query, + train, + k, + callback, ); } - late final _GFTTDetector_ClosePtr = - _lookup>( - 'GFTTDetector_Close'); - late final _GFTTDetector_Close = - _GFTTDetector_ClosePtr.asFunction(); + 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 GFTTDetector_Create( - ffi.Pointer rval, + ffi.Pointer GArrayGArrayPoint_FromVec( + VecVecPoint points, + ffi.Pointer rval, ) { - return _GFTTDetector_Create( + return _GArrayGArrayPoint_FromVec( + points, rval, ); } - late final _GFTTDetector_CreatePtr = _lookup< + late final _GArrayGArrayPoint_FromVecPtr = _lookup< ffi.NativeFunction< + ffi.Pointer Function(VecVecPoint, + ffi.Pointer)>>('GArrayGArrayPoint_FromVec'); + late final _GArrayGArrayPoint_FromVec = + _GArrayGArrayPoint_FromVecPtr.asFunction< ffi.Pointer Function( - ffi.Pointer)>>('GFTTDetector_Create'); - late final _GFTTDetector_Create = _GFTTDetector_CreatePtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + VecVecPoint, ffi.Pointer)>(); - ffi.Pointer GFTTDetector_Detect( - GFTTDetector a, - Mat src, - ffi.Pointer rval, + ffi.Pointer GArrayPoint2d_FromVec( + VecPoint v, + ffi.Pointer rval, ) { - return _GFTTDetector_Detect( - a, - src, + return _GArrayPoint2d_FromVec( + v, rval, ); } - late final _GFTTDetector_DetectPtr = _lookup< + late final _GArrayPoint2d_FromVecPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(GFTTDetector, Mat, - ffi.Pointer)>>('GFTTDetector_Detect'); - late final _GFTTDetector_Detect = _GFTTDetector_DetectPtr.asFunction< - ffi.Pointer Function( - GFTTDetector, Mat, ffi.Pointer)>(); + ffi.Pointer Function( + VecPoint, ffi.Pointer)>>('GArrayPoint2d_FromVec'); + late final _GArrayPoint2d_FromVec = _GArrayPoint2d_FromVecPtr.asFunction< + ffi.Pointer Function(VecPoint, ffi.Pointer)>(); - ffi.Pointer GaussianBlur( - Mat src, - Mat dst, - Size ps, - double sX, - double sY, - int bt, + ffi.Pointer GArrayPoint2f_FromVec( + VecPoint v, + ffi.Pointer rval, ) { - return _GaussianBlur( - src, - dst, - ps, - sX, - sY, - bt, + return _GArrayPoint2f_FromVec( + v, + rval, ); } - late final _GaussianBlurPtr = _lookup< + late final _GArrayPoint2f_FromVecPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Mat, Mat, Size, ffi.Double, ffi.Double, - ffi.Int)>>('GaussianBlur'); - late final _GaussianBlur = _GaussianBlurPtr.asFunction< - ffi.Pointer Function(Mat, Mat, Size, double, double, int)>(); + ffi.Pointer Function( + VecPoint, ffi.Pointer)>>('GArrayPoint2f_FromVec'); + late final _GArrayPoint2f_FromVec = _GArrayPoint2f_FromVecPtr.asFunction< + ffi.Pointer Function(VecPoint, ffi.Pointer)>(); - ffi.Pointer GetAffineTransform( - VecPoint src, - VecPoint dst, - ffi.Pointer rval, + ffi.Pointer GArrayPoint2i_FromVec( + VecPoint v, + ffi.Pointer rval, ) { - return _GetAffineTransform( - src, - dst, + return _GArrayPoint2i_FromVec( + v, rval, ); } - late final _GetAffineTransformPtr = _lookup< + late final _GArrayPoint2i_FromVecPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecPoint, VecPoint, ffi.Pointer)>>('GetAffineTransform'); - late final _GetAffineTransform = _GetAffineTransformPtr.asFunction< - ffi.Pointer Function(VecPoint, VecPoint, ffi.Pointer)>(); + VecPoint, ffi.Pointer)>>('GArrayPoint2i_FromVec'); + late final _GArrayPoint2i_FromVec = _GArrayPoint2i_FromVecPtr.asFunction< + ffi.Pointer Function(VecPoint, ffi.Pointer)>(); - ffi.Pointer GetAffineTransform2f( - VecPoint2f src, - VecPoint2f dst, - ffi.Pointer rval, + ffi.Pointer GArrayPoint3d_FromVec( + VecPoint v, + ffi.Pointer rval, ) { - return _GetAffineTransform2f( - src, - dst, + return _GArrayPoint3d_FromVec( + v, + rval, + ); + } + + late final _GArrayPoint3d_FromVecPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPoint, ffi.Pointer)>>('GArrayPoint3d_FromVec'); + late final _GArrayPoint3d_FromVec = _GArrayPoint3d_FromVecPtr.asFunction< + ffi.Pointer Function(VecPoint, ffi.Pointer)>(); + + ffi.Pointer GArrayPoint3f_FromVec( + VecPoint v, + ffi.Pointer rval, + ) { + return _GArrayPoint3f_FromVec( + v, + rval, + ); + } + + late final _GArrayPoint3f_FromVecPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPoint, ffi.Pointer)>>('GArrayPoint3f_FromVec'); + late final _GArrayPoint3f_FromVec = _GArrayPoint3f_FromVecPtr.asFunction< + ffi.Pointer Function(VecPoint, ffi.Pointer)>(); + + ffi.Pointer GArrayPoint3i_FromVec( + VecPoint v, + ffi.Pointer rval, + ) { + return _GArrayPoint3i_FromVec( + v, + rval, + ); + } + + late final _GArrayPoint3i_FromVecPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPoint, ffi.Pointer)>>('GArrayPoint3i_FromVec'); + late final _GArrayPoint3i_FromVec = _GArrayPoint3i_FromVecPtr.asFunction< + ffi.Pointer Function(VecPoint, ffi.Pointer)>(); + + ffi.Pointer GArrayPoint_FromVec( + VecPoint v, + ffi.Pointer rval, + ) { + return _GArrayPoint_FromVec( + v, + rval, + ); + } + + late final _GArrayPoint_FromVecPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPoint, ffi.Pointer)>>('GArrayPoint_FromVec'); + late final _GArrayPoint_FromVec = _GArrayPoint_FromVecPtr.asFunction< + ffi.Pointer Function(VecPoint, ffi.Pointer)>(); + + ffi.Pointer GArrayPrim_FromVec( + VecPrim v, + ffi.Pointer rval, + ) { + return _GArrayPrim_FromVec( + v, + rval, + ); + } + + late final _GArrayPrim_FromVecPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPrim, ffi.Pointer)>>('GArrayPrim_FromVec'); + late final _GArrayPrim_FromVec = _GArrayPrim_FromVecPtr.asFunction< + ffi.Pointer Function(VecPrim, ffi.Pointer)>(); + + ffi.Pointer GArrayVec4i_FromVec( + VecVec4i v, + ffi.Pointer rval, + ) { + return _GArrayVec4i_FromVec( + v, + rval, + ); + } + + late final _GArrayVec4i_FromVecPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecVec4i, ffi.Pointer)>>('GArrayVec4i_FromVec'); + late final _GArrayVec4i_FromVec = _GArrayVec4i_FromVecPtr.asFunction< + ffi.Pointer Function(VecVec4i, ffi.Pointer)>(); + + void GFTTDetector_Close( + GFTTDetectorPtr a, + ) { + return _GFTTDetector_Close( + a, + ); + } + + late final _GFTTDetector_ClosePtr = + _lookup>( + 'GFTTDetector_Close'); + 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, + ) { + return _GFTTDetector_Create( + rval, + ); + } + + late final _GFTTDetector_CreatePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('GFTTDetector_Create'); + 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, + ffi.Pointer rval, + ) { + return _GFTTDetector_Detect( + a, + src, + rval, + ); + } + + late final _GFTTDetector_DetectPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(GFTTDetector, Mat, + ffi.Pointer)>>('GFTTDetector_Detect'); + late final _GFTTDetector_Detect = _GFTTDetector_DetectPtr.asFunction< + 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, + Size ps, + double sX, + double sY, + int bt, + ) { + return _GaussianBlur( + src, + dst, + ps, + sX, + sY, + bt, + ); + } + + late final _GaussianBlurPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, Size, ffi.Double, ffi.Double, + ffi.Int)>>('GaussianBlur'); + late final _GaussianBlur = _GaussianBlurPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Size, double, double, int)>(); + + ffi.Pointer GaussianBlur_Async( + Mat src, + Size ps, + double sX, + double sY, + int bt, + CvCallback_1 callback, + ) { + return _GaussianBlur_Async( + src, + ps, + sX, + sY, + bt, + callback, + ); + } + + late final _GaussianBlur_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Size, ffi.Double, ffi.Double, + ffi.Int, CvCallback_1)>>('GaussianBlur_Async'); + late final _GaussianBlur_Async = _GaussianBlur_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Size, double, double, int, CvCallback_1)>(); + + ffi.Pointer GetAffineTransform( + VecPoint src, + VecPoint dst, + ffi.Pointer rval, + ) { + return _GetAffineTransform( + src, + dst, + rval, + ); + } + + late final _GetAffineTransformPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPoint, VecPoint, ffi.Pointer)>>('GetAffineTransform'); + late final _GetAffineTransform = _GetAffineTransformPtr.asFunction< + ffi.Pointer Function(VecPoint, VecPoint, ffi.Pointer)>(); + + ffi.Pointer GetAffineTransform2f( + VecPoint2f src, + VecPoint2f dst, + ffi.Pointer rval, + ) { + return _GetAffineTransform2f( + src, + dst, rval, ); } @@ -4923,6 +8003,47 @@ class CvNative { ffi.Pointer Function( VecPoint2f, VecPoint2f, ffi.Pointer)>(); + ffi.Pointer GetAffineTransform2f_Async( + VecPoint2f src, + VecPoint2f dst, + CvCallback_1 callback, + ) { + return _GetAffineTransform2f_Async( + src, + dst, + callback, + ); + } + + late final _GetAffineTransform2f_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecPoint2f, VecPoint2f, + CvCallback_1)>>('GetAffineTransform2f_Async'); + late final _GetAffineTransform2f_Async = + _GetAffineTransform2f_AsyncPtr.asFunction< + ffi.Pointer Function( + VecPoint2f, VecPoint2f, CvCallback_1)>(); + + ffi.Pointer GetAffineTransform_Async( + VecPoint src, + VecPoint dst, + CvCallback_1 callback, + ) { + return _GetAffineTransform_Async( + src, + dst, + callback, + ); + } + + late final _GetAffineTransform_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPoint, VecPoint, CvCallback_1)>>('GetAffineTransform_Async'); + late final _GetAffineTransform_Async = + _GetAffineTransform_AsyncPtr.asFunction< + ffi.Pointer Function(VecPoint, VecPoint, CvCallback_1)>(); + ffi.Pointer GetCVTickCount( ffi.Pointer rval, ) { @@ -4959,6 +8080,27 @@ class CvNative { late final _GetGaussianKernel = _GetGaussianKernelPtr.asFunction< ffi.Pointer Function(int, double, int, ffi.Pointer)>(); + ffi.Pointer GetGaussianKernel_Async( + int ksize, + double sigma, + int ktype, + CvCallback_1 callback, + ) { + return _GetGaussianKernel_Async( + ksize, + sigma, + ktype, + callback, + ); + } + + late final _GetGaussianKernel_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Int, ffi.Double, ffi.Int, + CvCallback_1)>>('GetGaussianKernel_Async'); + late final _GetGaussianKernel_Async = _GetGaussianKernel_AsyncPtr.asFunction< + ffi.Pointer Function(int, double, int, CvCallback_1)>(); + ffi.Pointer GetNumThreads( ffi.Pointer rval, ) { @@ -5057,29 +8199,96 @@ class CvNative { ffi.Pointer Function( VecPoint2f, VecPoint2f, ffi.Pointer, int)>(); - ffi.Pointer GetRectSubPix( - Mat src, - Size patchSize, - Point2f center, - Mat dst, + ffi.Pointer GetPerspectiveTransform2f_Async( + VecPoint2f src, + VecPoint2f dst, + int solveMethod, + CvCallback_1 callback, ) { - return _GetRectSubPix( + return _GetPerspectiveTransform2f_Async( src, - patchSize, - center, dst, + solveMethod, + callback, ); } - late final _GetRectSubPixPtr = _lookup< + late final _GetPerspectiveTransform2f_AsyncPtr = _lookup< ffi.NativeFunction< + ffi.Pointer Function(VecPoint2f, VecPoint2f, ffi.Int, + CvCallback_1)>>('GetPerspectiveTransform2f_Async'); + late final _GetPerspectiveTransform2f_Async = + _GetPerspectiveTransform2f_AsyncPtr.asFunction< ffi.Pointer Function( - Mat, Size, Point2f, Mat)>>('GetRectSubPix'); - late final _GetRectSubPix = _GetRectSubPixPtr.asFunction< - ffi.Pointer Function(Mat, Size, Point2f, Mat)>(); + VecPoint2f, VecPoint2f, int, CvCallback_1)>(); - ffi.Pointer GetRotationMatrix2D( - Point2f center, + ffi.Pointer GetPerspectiveTransform_Async( + VecPoint src, + VecPoint dst, + int solveMethod, + CvCallback_1 callback, + ) { + return _GetPerspectiveTransform_Async( + src, + dst, + solveMethod, + callback, + ); + } + + late final _GetPerspectiveTransform_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecPoint, VecPoint, ffi.Int, + CvCallback_1)>>('GetPerspectiveTransform_Async'); + late final _GetPerspectiveTransform_Async = + _GetPerspectiveTransform_AsyncPtr.asFunction< + ffi.Pointer Function( + VecPoint, VecPoint, int, CvCallback_1)>(); + + ffi.Pointer GetRectSubPix( + Mat src, + Size patchSize, + Point2f center, + Mat dst, + ) { + return _GetRectSubPix( + src, + patchSize, + center, + dst, + ); + } + + late final _GetRectSubPixPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Size, Point2f, Mat)>>('GetRectSubPix'); + late final _GetRectSubPix = _GetRectSubPixPtr.asFunction< + ffi.Pointer Function(Mat, Size, Point2f, Mat)>(); + + ffi.Pointer GetRectSubPix_Async( + Mat src, + Size patchSize, + Point2f center, + CvCallback_1 callback, + ) { + return _GetRectSubPix_Async( + src, + patchSize, + center, + callback, + ); + } + + late final _GetRectSubPix_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Size, Point2f, CvCallback_1)>>('GetRectSubPix_Async'); + late final _GetRectSubPix_Async = _GetRectSubPix_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Size, Point2f, CvCallback_1)>(); + + ffi.Pointer GetRotationMatrix2D( + Point2f center, double angle, double scale, ffi.Pointer rval, @@ -5100,6 +8309,29 @@ class CvNative { ffi.Pointer Function( Point2f, double, double, ffi.Pointer)>(); + ffi.Pointer GetRotationMatrix2D_Async( + Point2f center, + double angle, + double scale, + CvCallback_1 callback, + ) { + return _GetRotationMatrix2D_Async( + center, + angle, + scale, + callback, + ); + } + + late final _GetRotationMatrix2D_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Point2f, ffi.Double, ffi.Double, + CvCallback_1)>>('GetRotationMatrix2D_Async'); + late final _GetRotationMatrix2D_Async = + _GetRotationMatrix2D_AsyncPtr.asFunction< + ffi.Pointer Function( + Point2f, double, double, CvCallback_1)>(); + ffi.Pointer GetStructuringElement( int shape, Size ksize, @@ -5119,6 +8351,28 @@ class CvNative { late final _GetStructuringElement = _GetStructuringElementPtr.asFunction< ffi.Pointer Function(int, Size, ffi.Pointer)>(); + ffi.Pointer GetStructuringElement_Async( + int shape, + Size ksize, + Point anchor, + CvCallback_1 callback, + ) { + return _GetStructuringElement_Async( + shape, + ksize, + anchor, + callback, + ); + } + + late final _GetStructuringElement_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Int, Size, Point, + CvCallback_1)>>('GetStructuringElement_Async'); + late final _GetStructuringElement_Async = + _GetStructuringElement_AsyncPtr.asFunction< + ffi.Pointer Function(int, Size, Point, CvCallback_1)>(); + ffi.Pointer GetTextSizeWithBaseline( ffi.Pointer text, int fontFace, @@ -5150,6 +8404,35 @@ class CvNative { ffi.Pointer Function(ffi.Pointer, int, double, int, ffi.Pointer, ffi.Pointer)>(); + ffi.Pointer GetTextSizeWithBaseline_Async( + ffi.Pointer text, + int fontFace, + double fontScale, + int thickness, + CvCallback_2 callback, + ) { + return _GetTextSizeWithBaseline_Async( + text, + fontFace, + fontScale, + thickness, + callback, + ); + } + + late final _GetTextSizeWithBaseline_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Int, + ffi.Double, + ffi.Int, + CvCallback_2)>>('GetTextSizeWithBaseline_Async'); + late final _GetTextSizeWithBaseline_Async = + _GetTextSizeWithBaseline_AsyncPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, double, int, CvCallback_2)>(); + ffi.Pointer GetTickFrequency( ffi.Pointer rval, ) { @@ -5249,6 +8532,91 @@ class CvNative { ffi.Pointer Function(Mat, ffi.Pointer, int, double, double, Mat, int, int, bool, double)>(); + ffi.Pointer GoodFeaturesToTrackWithGradient_Async( + Mat img, + int maxCorners, + double quality, + double minDist, + Mat mask, + int blockSize, + int gradientSize, + bool useHarrisDetector, + double k, + CvCallback_1 callback, + ) { + return _GoodFeaturesToTrackWithGradient_Async( + img, + maxCorners, + quality, + minDist, + mask, + blockSize, + gradientSize, + useHarrisDetector, + k, + callback, + ); + } + + late final _GoodFeaturesToTrackWithGradient_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, + ffi.Int, + ffi.Double, + ffi.Double, + Mat, + ffi.Int, + ffi.Int, + ffi.Bool, + ffi.Double, + CvCallback_1)>>('GoodFeaturesToTrackWithGradient_Async'); + late final _GoodFeaturesToTrackWithGradient_Async = + _GoodFeaturesToTrackWithGradient_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, double, double, Mat, int, + int, bool, double, CvCallback_1)>(); + + ffi.Pointer GoodFeaturesToTrack_Async( + Mat img, + int maxCorners, + double quality, + double minDist, + Mat mask, + int blockSize, + bool useHarrisDetector, + double k, + CvCallback_1 callback, + ) { + return _GoodFeaturesToTrack_Async( + img, + maxCorners, + quality, + minDist, + mask, + blockSize, + useHarrisDetector, + k, + callback, + ); + } + + late final _GoodFeaturesToTrack_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, + ffi.Int, + ffi.Double, + ffi.Double, + Mat, + ffi.Int, + ffi.Bool, + ffi.Double, + CvCallback_1)>>('GoodFeaturesToTrack_Async'); + late final _GoodFeaturesToTrack_Async = + _GoodFeaturesToTrack_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, double, double, Mat, int, + bool, double, CvCallback_1)>(); + ffi.Pointer GrabCut( Mat img, Mat mask, @@ -5276,6 +8644,36 @@ class CvNative { late final _GrabCut = _GrabCutPtr.asFunction< ffi.Pointer Function(Mat, Mat, Rect, Mat, Mat, int, int)>(); + ffi.Pointer GrabCut_Async( + Mat img, + Mat mask, + Rect rect, + Mat bgdModel, + Mat fgdModel, + int iterCount, + int mode, + CvCallback_0 callback, + ) { + return _GrabCut_Async( + img, + mask, + rect, + bgdModel, + fgdModel, + iterCount, + mode, + callback, + ); + } + + late final _GrabCut_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, Rect, Mat, Mat, ffi.Int, + ffi.Int, CvCallback_0)>>('GrabCut_Async'); + late final _GrabCut_Async = _GrabCut_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, Rect, Mat, Mat, int, int, CvCallback_0)>(); + ffi.Pointer GroupRectangles( VecRect rects, int groupThreshold, @@ -5295,6 +8693,27 @@ class CvNative { late final _GroupRectangles = _GroupRectanglesPtr.asFunction< ffi.Pointer Function(VecRect, int, double)>(); + ffi.Pointer GroupRectangles_Async( + VecRect rects, + int groupThreshold, + double eps, + CvCallback_0 callback, + ) { + return _GroupRectangles_Async( + rects, + groupThreshold, + eps, + callback, + ); + } + + late final _GroupRectangles_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecRect, ffi.Int, ffi.Double, + CvCallback_0)>>('GroupRectangles_Async'); + late final _GroupRectangles_Async = _GroupRectangles_AsyncPtr.asFunction< + ffi.Pointer Function(VecRect, int, double, CvCallback_0)>(); + void HOGDescriptor_Close( HOGDescriptorPtr self, ) { @@ -5340,6 +8759,31 @@ class CvNative { ffi.Pointer Function(HOGDescriptor, Mat, ffi.Pointer, Size, Size, ffi.Pointer)>(); + ffi.Pointer HOGDescriptor_Compute_Async( + HOGDescriptor self, + Mat img, + Size winStride, + Size padding, + CvCallback_2 callback, + ) { + return _HOGDescriptor_Compute_Async( + self, + img, + winStride, + padding, + callback, + ); + } + + late final _HOGDescriptor_Compute_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(HOGDescriptor, Mat, Size, Size, + CvCallback_2)>>('HOGDescriptor_Compute_Async'); + late final _HOGDescriptor_Compute_Async = + _HOGDescriptor_Compute_AsyncPtr.asFunction< + ffi.Pointer Function( + HOGDescriptor, Mat, Size, Size, CvCallback_2)>(); + ffi.Pointer HOGDescriptor_Detect( HOGDescriptor self, Mat img, @@ -5411,6 +8855,33 @@ class CvNative { ffi.Pointer Function(HOGDescriptor, Mat, ffi.Pointer, double, Size, Size, ffi.Pointer)>(); + ffi.Pointer HOGDescriptor_Detect2_Async( + HOGDescriptor self, + Mat img, + double hitThresh, + Size winStride, + Size padding, + CvCallback_2 callback, + ) { + return _HOGDescriptor_Detect2_Async( + self, + img, + hitThresh, + winStride, + padding, + callback, + ); + } + + late final _HOGDescriptor_Detect2_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(HOGDescriptor, Mat, ffi.Double, Size, + Size, CvCallback_2)>>('HOGDescriptor_Detect2_Async'); + late final _HOGDescriptor_Detect2_Async = + _HOGDescriptor_Detect2_AsyncPtr.asFunction< + ffi.Pointer Function( + HOGDescriptor, Mat, double, Size, Size, CvCallback_2)>(); + ffi.Pointer HOGDescriptor_DetectMultiScale( HOGDescriptor self, Mat img, @@ -5474,26 +8945,135 @@ class CvNative { ffi.Pointer Function(HOGDescriptor, Mat, double, Size, Size, double, double, bool, ffi.Pointer)>(); - ffi.Pointer HOGDescriptor_Load( + ffi.Pointer HOGDescriptor_DetectMultiScaleWithParams_Async( HOGDescriptor self, - ffi.Pointer name, - ffi.Pointer rval, + Mat img, + double hitThresh, + Size winStride, + Size padding, + double scale, + double finalThreshold, + bool useMeanshiftGrouping, + CvCallback_1 callback, ) { - return _HOGDescriptor_Load( + return _HOGDescriptor_DetectMultiScaleWithParams_Async( self, - name, - rval, - ); - } - - late final _HOGDescriptor_LoadPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(HOGDescriptor, ffi.Pointer, + img, + hitThresh, + winStride, + padding, + scale, + finalThreshold, + useMeanshiftGrouping, + callback, + ); + } + + late final _HOGDescriptor_DetectMultiScaleWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + HOGDescriptor, + Mat, + ffi.Double, + Size, + Size, + ffi.Double, + ffi.Double, + ffi.Bool, + CvCallback_1)>>('HOGDescriptor_DetectMultiScaleWithParams_Async'); + late final _HOGDescriptor_DetectMultiScaleWithParams_Async = + _HOGDescriptor_DetectMultiScaleWithParams_AsyncPtr.asFunction< + ffi.Pointer Function(HOGDescriptor, Mat, double, Size, Size, + double, double, bool, CvCallback_1)>(); + + ffi.Pointer HOGDescriptor_DetectMultiScale_Async( + HOGDescriptor self, + Mat img, + CvCallback_1 callback, + ) { + return _HOGDescriptor_DetectMultiScale_Async( + self, + img, + callback, + ); + } + + late final _HOGDescriptor_DetectMultiScale_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(HOGDescriptor, Mat, + CvCallback_1)>>('HOGDescriptor_DetectMultiScale_Async'); + late final _HOGDescriptor_DetectMultiScale_Async = + _HOGDescriptor_DetectMultiScale_AsyncPtr.asFunction< + ffi.Pointer Function(HOGDescriptor, Mat, CvCallback_1)>(); + + ffi.Pointer HOGDescriptor_Detect_Async( + HOGDescriptor self, + Mat img, + double hitThresh, + Size winStride, + Size padding, + CvCallback_3 callback, + ) { + return _HOGDescriptor_Detect_Async( + self, + img, + hitThresh, + winStride, + padding, + callback, + ); + } + + late final _HOGDescriptor_Detect_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(HOGDescriptor, Mat, ffi.Double, Size, + Size, CvCallback_3)>>('HOGDescriptor_Detect_Async'); + late final _HOGDescriptor_Detect_Async = + _HOGDescriptor_Detect_AsyncPtr.asFunction< + ffi.Pointer Function( + HOGDescriptor, Mat, double, Size, Size, CvCallback_3)>(); + + ffi.Pointer HOGDescriptor_Load( + HOGDescriptor self, + ffi.Pointer name, + ffi.Pointer rval, + ) { + return _HOGDescriptor_Load( + self, + name, + rval, + ); + } + + late final _HOGDescriptor_LoadPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(HOGDescriptor, ffi.Pointer, ffi.Pointer)>>('HOGDescriptor_Load'); late final _HOGDescriptor_Load = _HOGDescriptor_LoadPtr.asFunction< ffi.Pointer Function( HOGDescriptor, ffi.Pointer, ffi.Pointer)>(); + ffi.Pointer HOGDescriptor_Load_Async( + HOGDescriptor self, + ffi.Pointer name, + CvCallback_1 callback, + ) { + return _HOGDescriptor_Load_Async( + self, + name, + callback, + ); + } + + late final _HOGDescriptor_Load_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(HOGDescriptor, ffi.Pointer, + CvCallback_1)>>('HOGDescriptor_Load_Async'); + late final _HOGDescriptor_Load_Async = + _HOGDescriptor_Load_AsyncPtr.asFunction< + ffi.Pointer Function( + HOGDescriptor, ffi.Pointer, CvCallback_1)>(); + ffi.Pointer HOGDescriptor_New( ffi.Pointer rval, ) { @@ -5528,6 +9108,39 @@ class CvNative { ffi.Pointer Function( ffi.Pointer, ffi.Pointer)>(); + ffi.Pointer HOGDescriptor_NewFromFile_Async( + ffi.Pointer filename, + CvCallback_1 callback, + ) { + return _HOGDescriptor_NewFromFile_Async( + filename, + callback, + ); + } + + late final _HOGDescriptor_NewFromFile_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + CvCallback_1)>>('HOGDescriptor_NewFromFile_Async'); + late final _HOGDescriptor_NewFromFile_Async = + _HOGDescriptor_NewFromFile_AsyncPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, CvCallback_1)>(); + + ffi.Pointer HOGDescriptor_New_Async( + CvCallback_1 callback, + ) { + return _HOGDescriptor_New_Async( + callback, + ); + } + + late final _HOGDescriptor_New_AsyncPtr = + _lookup Function(CvCallback_1)>>( + 'HOGDescriptor_New_Async'); + late final _HOGDescriptor_New_Async = _HOGDescriptor_New_AsyncPtr.asFunction< + ffi.Pointer Function(CvCallback_1)>(); + ffi.Pointer HOGDescriptor_SetSVMDetector( HOGDescriptor self, VecFloat det, @@ -5545,6 +9158,27 @@ class CvNative { late final _HOGDescriptor_SetSVMDetector = _HOGDescriptor_SetSVMDetectorPtr .asFunction Function(HOGDescriptor, VecFloat)>(); + ffi.Pointer HOGDescriptor_SetSVMDetector_Async( + HOGDescriptor self, + VecFloat det, + CvCallback_0 callback, + ) { + return _HOGDescriptor_SetSVMDetector_Async( + self, + det, + callback, + ); + } + + late final _HOGDescriptor_SetSVMDetector_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(HOGDescriptor, VecFloat, + CvCallback_0)>>('HOGDescriptor_SetSVMDetector_Async'); + late final _HOGDescriptor_SetSVMDetector_Async = + _HOGDescriptor_SetSVMDetector_AsyncPtr.asFunction< + ffi.Pointer Function( + HOGDescriptor, VecFloat, CvCallback_0)>(); + ffi.Pointer HOGDescriptor_computeGradient( HOGDescriptor self, Mat img, @@ -5572,6 +9206,35 @@ class CvNative { ffi.Pointer Function( HOGDescriptor, Mat, Mat, Mat, Size, Size)>(); + ffi.Pointer HOGDescriptor_computeGradient_Async( + HOGDescriptor self, + Mat img, + Mat grad, + Mat angleOfs, + Size paddingTL, + Size paddingBR, + CvCallback_0 callback, + ) { + return _HOGDescriptor_computeGradient_Async( + self, + img, + grad, + angleOfs, + paddingTL, + paddingBR, + callback, + ); + } + + late final _HOGDescriptor_computeGradient_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(HOGDescriptor, Mat, Mat, Mat, Size, + Size, CvCallback_0)>>('HOGDescriptor_computeGradient_Async'); + late final _HOGDescriptor_computeGradient_Async = + _HOGDescriptor_computeGradient_AsyncPtr.asFunction< + ffi.Pointer Function( + HOGDescriptor, Mat, Mat, Mat, Size, Size, CvCallback_0)>(); + ffi.Pointer HOGDescriptor_getDaimlerPeopleDetector( ffi.Pointer rval, ) { @@ -5588,6 +9251,21 @@ class CvNative { _HOGDescriptor_getDaimlerPeopleDetectorPtr.asFunction< ffi.Pointer Function(ffi.Pointer)>(); + ffi.Pointer HOGDescriptor_getDaimlerPeopleDetector_Async( + CvCallback_1 callback, + ) { + return _HOGDescriptor_getDaimlerPeopleDetector_Async( + callback, + ); + } + + late final _HOGDescriptor_getDaimlerPeopleDetector_AsyncPtr = + _lookup Function(CvCallback_1)>>( + 'HOGDescriptor_getDaimlerPeopleDetector_Async'); + late final _HOGDescriptor_getDaimlerPeopleDetector_Async = + _HOGDescriptor_getDaimlerPeopleDetector_AsyncPtr.asFunction< + ffi.Pointer Function(CvCallback_1)>(); + ffi.Pointer HOGDescriptor_getDescriptorSize( HOGDescriptor self, ffi.Pointer rval, @@ -5607,6 +9285,24 @@ class CvNative { ffi.Pointer Function( HOGDescriptor, ffi.Pointer)>(); + ffi.Pointer HOGDescriptor_getDescriptorSize_Async( + HOGDescriptor self, + CvCallback_1 callback, + ) { + return _HOGDescriptor_getDescriptorSize_Async( + self, + callback, + ); + } + + late final _HOGDescriptor_getDescriptorSize_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(HOGDescriptor, + CvCallback_1)>>('HOGDescriptor_getDescriptorSize_Async'); + late final _HOGDescriptor_getDescriptorSize_Async = + _HOGDescriptor_getDescriptorSize_AsyncPtr.asFunction< + ffi.Pointer Function(HOGDescriptor, CvCallback_1)>(); + ffi.Pointer HOGDescriptor_getWinSigma( HOGDescriptor self, ffi.Pointer rval, @@ -5626,6 +9322,24 @@ class CvNative { ffi.Pointer Function( HOGDescriptor, ffi.Pointer)>(); + ffi.Pointer HOGDescriptor_getWinSigma_Async( + HOGDescriptor self, + CvCallback_1 callback, + ) { + return _HOGDescriptor_getWinSigma_Async( + self, + callback, + ); + } + + late final _HOGDescriptor_getWinSigma_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + HOGDescriptor, CvCallback_1)>>('HOGDescriptor_getWinSigma_Async'); + late final _HOGDescriptor_getWinSigma_Async = + _HOGDescriptor_getWinSigma_AsyncPtr.asFunction< + ffi.Pointer Function(HOGDescriptor, CvCallback_1)>(); + ffi.Pointer HOGDescriptor_groupRectangles( HOGDescriptor self, VecRect rectList, @@ -5651,6 +9365,38 @@ class CvNative { ffi.Pointer Function( HOGDescriptor, VecRect, VecDouble, int, double)>(); + ffi.Pointer HOGDescriptor_groupRectangles_Async( + HOGDescriptor self, + VecRect rectList, + VecDouble weights, + int groupThreshold, + double eps, + CvCallback_0 callback, + ) { + return _HOGDescriptor_groupRectangles_Async( + self, + rectList, + weights, + groupThreshold, + eps, + callback, + ); + } + + late final _HOGDescriptor_groupRectangles_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + HOGDescriptor, + VecRect, + VecDouble, + ffi.Int, + ffi.Double, + CvCallback_0)>>('HOGDescriptor_groupRectangles_Async'); + late final _HOGDescriptor_groupRectangles_Async = + _HOGDescriptor_groupRectangles_AsyncPtr.asFunction< + ffi.Pointer Function( + HOGDescriptor, VecRect, VecDouble, int, double, CvCallback_0)>(); + ffi.Pointer HOG_GetDefaultPeopleDetector( ffi.Pointer rval, ) { @@ -5666,6 +9412,21 @@ class CvNative { late final _HOG_GetDefaultPeopleDetector = _HOG_GetDefaultPeopleDetectorPtr .asFunction Function(ffi.Pointer)>(); + ffi.Pointer HOG_GetDefaultPeopleDetector_Async( + CvCallback_1 callback, + ) { + return _HOG_GetDefaultPeopleDetector_Async( + callback, + ); + } + + late final _HOG_GetDefaultPeopleDetector_AsyncPtr = + _lookup Function(CvCallback_1)>>( + 'HOG_GetDefaultPeopleDetector_Async'); + late final _HOG_GetDefaultPeopleDetector_Async = + _HOG_GetDefaultPeopleDetector_AsyncPtr.asFunction< + ffi.Pointer Function(CvCallback_1)>(); + ffi.Pointer HoughCircles( Mat src, Mat circles, @@ -5729,6 +9490,70 @@ class CvNative { ffi.Pointer Function( Mat, Mat, int, double, double, double, double, int, int)>(); + ffi.Pointer HoughCirclesWithParams_Async( + Mat src, + int method, + double dp, + double minDist, + double param1, + double param2, + int minRadius, + int maxRadius, + CvCallback_1 callback, + ) { + return _HoughCirclesWithParams_Async( + src, + method, + dp, + minDist, + param1, + param2, + minRadius, + maxRadius, + callback, + ); + } + + late final _HoughCirclesWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, + ffi.Int, + ffi.Double, + ffi.Double, + ffi.Double, + ffi.Double, + ffi.Int, + ffi.Int, + CvCallback_1)>>('HoughCirclesWithParams_Async'); + late final _HoughCirclesWithParams_Async = + _HoughCirclesWithParams_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, double, double, double, + double, int, int, CvCallback_1)>(); + + ffi.Pointer HoughCircles_Async( + Mat src, + int method, + double dp, + double minDist, + CvCallback_1 callback, + ) { + return _HoughCircles_Async( + src, + method, + dp, + minDist, + callback, + ); + } + + late final _HoughCircles_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, ffi.Int, ffi.Double, ffi.Double, + CvCallback_1)>>('HoughCircles_Async'); + late final _HoughCircles_Async = _HoughCircles_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, double, double, CvCallback_1)>(); + ffi.Pointer HoughLines( Mat src, Mat lines, @@ -5820,24 +9645,82 @@ class CvNative { ffi.Pointer Function( Mat, Mat, double, double, int, double, double)>(); - ffi.Pointer HoughLinesPointSet( - Mat points, - Mat lines, - int lines_max, + ffi.Pointer HoughLinesPWithParams_Async( + Mat src, + double rho, + double theta, int threshold, - double min_rho, - double max_rho, - double rho_step, - double min_theta, - double max_theta, - double theta_step, + double minLineLength, + double maxLineGap, + CvCallback_1 callback, ) { - return _HoughLinesPointSet( - points, - lines, - lines_max, + return _HoughLinesPWithParams_Async( + src, + rho, + theta, threshold, - min_rho, + minLineLength, + maxLineGap, + callback, + ); + } + + late final _HoughLinesPWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, + ffi.Double, + ffi.Double, + ffi.Int, + ffi.Double, + ffi.Double, + CvCallback_1)>>('HoughLinesPWithParams_Async'); + late final _HoughLinesPWithParams_Async = + _HoughLinesPWithParams_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, double, double, int, double, double, CvCallback_1)>(); + + ffi.Pointer HoughLinesP_Async( + Mat src, + double rho, + double theta, + int threshold, + CvCallback_1 callback, + ) { + return _HoughLinesP_Async( + src, + rho, + theta, + threshold, + callback, + ); + } + + late final _HoughLinesP_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, ffi.Double, ffi.Double, ffi.Int, + CvCallback_1)>>('HoughLinesP_Async'); + late final _HoughLinesP_Async = _HoughLinesP_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, double, double, int, CvCallback_1)>(); + + ffi.Pointer HoughLinesPointSet( + Mat points, + Mat lines, + int lines_max, + int threshold, + double min_rho, + double max_rho, + double rho_step, + double min_theta, + double max_theta, + double theta_step, + ) { + return _HoughLinesPointSet( + points, + lines, + lines_max, + threshold, + min_rho, max_rho, rho_step, min_theta, @@ -5863,6 +9746,90 @@ class CvNative { ffi.Pointer Function(Mat, Mat, int, int, double, double, double, double, double, double)>(); + ffi.Pointer HoughLinesPointSet_Async( + Mat points, + int lines_max, + int threshold, + double min_rho, + double max_rho, + double rho_step, + double min_theta, + double max_theta, + double theta_step, + CvCallback_1 callback, + ) { + return _HoughLinesPointSet_Async( + points, + lines_max, + threshold, + min_rho, + max_rho, + rho_step, + min_theta, + max_theta, + theta_step, + callback, + ); + } + + late final _HoughLinesPointSet_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, + ffi.Int, + ffi.Int, + ffi.Double, + ffi.Double, + ffi.Double, + ffi.Double, + ffi.Double, + ffi.Double, + CvCallback_1)>>('HoughLinesPointSet_Async'); + late final _HoughLinesPointSet_Async = + _HoughLinesPointSet_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, int, double, double, double, + double, double, double, CvCallback_1)>(); + + ffi.Pointer HoughLines_Async( + Mat src, + double rho, + double theta, + int threshold, + double srn, + double stn, + double min_theta, + double max_theta, + CvCallback_1 callback, + ) { + return _HoughLines_Async( + src, + rho, + theta, + threshold, + srn, + stn, + min_theta, + max_theta, + callback, + ); + } + + late final _HoughLines_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, + ffi.Double, + ffi.Double, + ffi.Int, + ffi.Double, + ffi.Double, + ffi.Double, + ffi.Double, + CvCallback_1)>>('HoughLines_Async'); + late final _HoughLines_Async = _HoughLines_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, double, double, int, double, double, + double, double, CvCallback_1)>(); + ffi.Pointer IlluminationChange( Mat src, Mat mask, @@ -5886,6 +9853,31 @@ class CvNative { late final _IlluminationChange = _IlluminationChangePtr.asFunction< ffi.Pointer Function(Mat, Mat, Mat, double, double)>(); + ffi.Pointer IlluminationChange_Async( + Mat src, + Mat mask, + double alpha, + double beta, + CvCallback_1 callback, + ) { + return _IlluminationChange_Async( + src, + mask, + alpha, + beta, + callback, + ); + } + + late final _IlluminationChange_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, ffi.Float, ffi.Float, + CvCallback_1)>>('IlluminationChange_Async'); + late final _IlluminationChange_Async = + _IlluminationChange_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, double, double, CvCallback_1)>(); + ffi.Pointer Image_IMDecode( VecUChar buf, int flags, @@ -5905,6 +9897,25 @@ class CvNative { late final _Image_IMDecode = _Image_IMDecodePtr.asFunction< ffi.Pointer Function(VecUChar, int, ffi.Pointer)>(); + ffi.Pointer Image_IMDecode_Async( + VecUChar buf, + int flags, + CvCallback_1 callback, + ) { + return _Image_IMDecode_Async( + buf, + flags, + callback, + ); + } + + late final _Image_IMDecode_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecUChar, ffi.Int, CvCallback_1)>>('Image_IMDecode_Async'); + late final _Image_IMDecode_Async = _Image_IMDecode_AsyncPtr.asFunction< + ffi.Pointer Function(VecUChar, int, CvCallback_1)>(); + ffi.Pointer Image_IMEncode( ffi.Pointer fileExt, Mat img, @@ -5927,6 +9938,26 @@ class CvNative { ffi.Pointer Function(ffi.Pointer, Mat, ffi.Pointer, ffi.Pointer)>(); + ffi.Pointer Image_IMEncode_Async( + ffi.Pointer fileExt, + Mat img, + CvCallback_2 callback, + ) { + return _Image_IMEncode_Async( + fileExt, + img, + callback, + ); + } + + late final _Image_IMEncode_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, Mat, + CvCallback_2)>>('Image_IMEncode_Async'); + late final _Image_IMEncode_Async = _Image_IMEncode_AsyncPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, Mat, CvCallback_2)>(); + ffi.Pointer Image_IMEncode_WithParams( ffi.Pointer fileExt, Mat img, @@ -5956,6 +9987,29 @@ class CvNative { ffi.Pointer Function(ffi.Pointer, Mat, VecInt, ffi.Pointer, ffi.Pointer)>(); + ffi.Pointer Image_IMEncode_WithParams_Async( + ffi.Pointer fileExt, + Mat img, + VecInt params, + CvCallback_2 callback, + ) { + return _Image_IMEncode_WithParams_Async( + fileExt, + img, + params, + callback, + ); + } + + late final _Image_IMEncode_WithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, Mat, VecInt, + CvCallback_2)>>('Image_IMEncode_WithParams_Async'); + late final _Image_IMEncode_WithParams_Async = + _Image_IMEncode_WithParams_AsyncPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, Mat, VecInt, CvCallback_2)>(); + ffi.Pointer Image_IMRead( ffi.Pointer filename, int flags, @@ -5976,6 +10030,26 @@ class CvNative { ffi.Pointer Function( ffi.Pointer, int, ffi.Pointer)>(); + ffi.Pointer Image_IMRead_Async( + ffi.Pointer filename, + int flags, + CvCallback_1 callback, + ) { + return _Image_IMRead_Async( + filename, + flags, + callback, + ); + } + + late final _Image_IMRead_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Int, + CvCallback_1)>>('Image_IMRead_Async'); + late final _Image_IMRead_Async = _Image_IMRead_AsyncPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, CvCallback_1)>(); + ffi.Pointer Image_IMWrite( ffi.Pointer filename, Mat img, @@ -5996,6 +10070,26 @@ class CvNative { ffi.Pointer Function( ffi.Pointer, Mat, ffi.Pointer)>(); + ffi.Pointer Image_IMWrite_Async( + ffi.Pointer filename, + Mat img, + CvCallback_1 callback, + ) { + return _Image_IMWrite_Async( + filename, + img, + callback, + ); + } + + late final _Image_IMWrite_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, Mat, + CvCallback_1)>>('Image_IMWrite_Async'); + late final _Image_IMWrite_Async = _Image_IMWrite_AsyncPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, Mat, CvCallback_1)>(); + ffi.Pointer Image_IMWrite_WithParams( ffi.Pointer filename, Mat img, @@ -6019,6 +10113,29 @@ class CvNative { ffi.Pointer Function( ffi.Pointer, Mat, VecInt, ffi.Pointer)>(); + ffi.Pointer Image_IMWrite_WithParams_Async( + ffi.Pointer filename, + Mat img, + VecInt params, + CvCallback_1 callback, + ) { + return _Image_IMWrite_WithParams_Async( + filename, + img, + params, + callback, + ); + } + + late final _Image_IMWrite_WithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, Mat, VecInt, + CvCallback_1)>>('Image_IMWrite_WithParams_Async'); + late final _Image_IMWrite_WithParams_Async = + _Image_IMWrite_WithParams_AsyncPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, Mat, VecInt, CvCallback_1)>(); + ffi.Pointer InitUndistortRectifyMap( Mat cameraMatrix, Mat distCoeffs, @@ -6074,6 +10191,27 @@ class CvNative { late final _Integral = _IntegralPtr.asFunction< ffi.Pointer Function(Mat, Mat, Mat, Mat, int, int)>(); + ffi.Pointer Integral_Async( + Mat src, + int sdepth, + int sqdepth, + CvCallback_3 callback, + ) { + return _Integral_Async( + src, + sdepth, + sqdepth, + callback, + ); + } + + late final _Integral_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, ffi.Int, ffi.Int, CvCallback_3)>>('Integral_Async'); + late final _Integral_Async = _Integral_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, int, CvCallback_3)>(); + ffi.Pointer InvertAffineTransform( Mat src, Mat dst, @@ -6090,6 +10228,23 @@ class CvNative { late final _InvertAffineTransform = _InvertAffineTransformPtr.asFunction< ffi.Pointer Function(Mat, Mat)>(); + ffi.Pointer InvertAffineTransform_Async( + Mat src, + CvCallback_1 callback, + ) { + return _InvertAffineTransform_Async( + src, + callback, + ); + } + + late final _InvertAffineTransform_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Mat, CvCallback_1)>>( + 'InvertAffineTransform_Async'); + late final _InvertAffineTransform_Async = _InvertAffineTransform_AsyncPtr + .asFunction Function(Mat, CvCallback_1)>(); + void KAZE_Close( KAZEPtr a, ) { @@ -6102,6 +10257,23 @@ 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, ) { @@ -6116,6 +10288,20 @@ 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, @@ -6159,10 +10345,51 @@ class CvNative { ffi.Pointer Function( KAZE, Mat, Mat, Mat, ffi.Pointer)>(); - ffi.Pointer KMeans( - Mat data, - int k, - Mat bestLabels, + 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, + Mat bestLabels, TermCriteria criteria, int attempts, int flags, @@ -6252,6 +10479,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, @@ -6270,6 +10517,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, @@ -6288,6 +10553,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, @@ -6306,6 +10589,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, @@ -6323,6 +10624,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, @@ -6341,6 +10659,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, @@ -6359,6 +10695,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, @@ -6377,6 +10731,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, @@ -6395,6 +10767,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, @@ -6413,6 +10803,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, @@ -6430,6 +10838,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, @@ -6447,6 +10872,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, @@ -6464,6 +10906,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, @@ -6481,6 +10940,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, @@ -6498,6 +10974,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, @@ -6516,6 +11009,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, @@ -6559,6 +11070,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, @@ -6583,6 +11147,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, @@ -6621,22 +11208,79 @@ class CvNative { ffi.Pointer Function( KalmanFilter, Mat, ffi.Pointer)>(); - ffi.Pointer KalmanFilter_SetControlMatrix( + ffi.Pointer KalmanFilter_PredictWithParams_Async( KalmanFilter self, - Mat controlMatrix, + Mat control, + CvCallback_1 callback, ) { - return _KalmanFilter_SetControlMatrix( + return _KalmanFilter_PredictWithParams_Async( self, - controlMatrix, + control, + callback, ); } - late final _KalmanFilter_SetControlMatrixPtr = _lookup< - ffi - .NativeFunction Function(KalmanFilter, Mat)>>( - 'KalmanFilter_SetControlMatrix'); - late final _KalmanFilter_SetControlMatrix = _KalmanFilter_SetControlMatrixPtr - .asFunction Function(KalmanFilter, Mat)>(); + 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, + ) { + return _KalmanFilter_SetControlMatrix( + self, + controlMatrix, + ); + } + + late final _KalmanFilter_SetControlMatrixPtr = _lookup< + ffi + .NativeFunction Function(KalmanFilter, Mat)>>( + 'KalmanFilter_SetControlMatrix'); + 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, @@ -6655,6 +11299,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, @@ -6672,6 +11336,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, @@ -6689,6 +11373,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, @@ -6707,6 +11411,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, @@ -6725,6 +11449,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, @@ -6743,6 +11487,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, @@ -6760,6 +11524,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, @@ -6777,6 +11561,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, @@ -6795,6 +11599,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, @@ -6840,6 +11664,34 @@ class CvNative { ffi.Pointer Function( Mat, Mat, int, int, double, double, int)>(); + ffi.Pointer Laplacian_Async( + Mat src, + int dDepth, + int kSize, + double scale, + double delta, + int borderType, + CvCallback_1 callback, + ) { + return _Laplacian_Async( + src, + dDepth, + kSize, + scale, + delta, + borderType, + callback, + ); + } + + late final _Laplacian_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, ffi.Int, ffi.Int, ffi.Double, + ffi.Double, ffi.Int, CvCallback_1)>>('Laplacian_Async'); + late final _Laplacian_Async = _Laplacian_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, int, int, double, double, int, CvCallback_1)>(); + void Layer_Close( LayerPtr layer, ) { @@ -6853,6 +11705,22 @@ class CvNative { late final _Layer_Close = _Layer_ClosePtr.asFunction(); + void Layer_Close_Async( + LayerPtr layer, + CvCallback_0 callback, + ) { + return _Layer_Close_Async( + layer, + callback, + ); + } + + late final _Layer_Close_AsyncPtr = + _lookup>( + 'Layer_Close_Async'); + late final _Layer_Close_Async = + _Layer_Close_AsyncPtr.asFunction(); + ffi.Pointer Layer_GetName( Layer layer, ffi.Pointer> rval, @@ -6871,6 +11739,23 @@ class CvNative { ffi.Pointer Function( Layer, ffi.Pointer>)>(); + ffi.Pointer Layer_GetName_Async( + Layer layer, + CvCallback_1 callback, + ) { + return _Layer_GetName_Async( + layer, + callback, + ); + } + + late final _Layer_GetName_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Layer, CvCallback_1)>>( + 'Layer_GetName_Async'); + late final _Layer_GetName_Async = _Layer_GetName_AsyncPtr.asFunction< + ffi.Pointer Function(Layer, CvCallback_1)>(); + ffi.Pointer Layer_GetType( Layer layer, ffi.Pointer> rval, @@ -6889,6 +11774,23 @@ class CvNative { ffi.Pointer Function( Layer, ffi.Pointer>)>(); + ffi.Pointer Layer_GetType_Async( + Layer layer, + CvCallback_1 callback, + ) { + return _Layer_GetType_Async( + layer, + callback, + ); + } + + late final _Layer_GetType_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Layer, CvCallback_1)>>( + 'Layer_GetType_Async'); + late final _Layer_GetType_Async = _Layer_GetType_AsyncPtr.asFunction< + ffi.Pointer Function(Layer, CvCallback_1)>(); + ffi.Pointer Layer_InputNameToIndex( Layer layer, ffi.Pointer name, @@ -6909,6 +11811,27 @@ class CvNative { ffi.Pointer Function( Layer, ffi.Pointer, ffi.Pointer)>(); + ffi.Pointer Layer_InputNameToIndex_Async( + Layer layer, + ffi.Pointer name, + CvCallback_1 callback, + ) { + return _Layer_InputNameToIndex_Async( + layer, + name, + callback, + ); + } + + late final _Layer_InputNameToIndex_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Layer, ffi.Pointer, + CvCallback_1)>>('Layer_InputNameToIndex_Async'); + late final _Layer_InputNameToIndex_Async = + _Layer_InputNameToIndex_AsyncPtr.asFunction< + ffi.Pointer Function( + Layer, ffi.Pointer, CvCallback_1)>(); + ffi.Pointer Layer_OutputNameToIndex( Layer layer, ffi.Pointer name, @@ -6929,6 +11852,27 @@ class CvNative { ffi.Pointer Function( Layer, ffi.Pointer, ffi.Pointer)>(); + ffi.Pointer Layer_OutputNameToIndex_Async( + Layer layer, + ffi.Pointer name, + CvCallback_1 callback, + ) { + return _Layer_OutputNameToIndex_Async( + layer, + name, + callback, + ); + } + + late final _Layer_OutputNameToIndex_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Layer, ffi.Pointer, + CvCallback_1)>>('Layer_OutputNameToIndex_Async'); + late final _Layer_OutputNameToIndex_Async = + _Layer_OutputNameToIndex_AsyncPtr.asFunction< + ffi.Pointer Function( + Layer, ffi.Pointer, CvCallback_1)>(); + ffi.Pointer Line( Mat img, Point pt1, @@ -6957,6 +11901,36 @@ class CvNative { ffi.Pointer Function( Mat, Point, Point, Scalar, int, int, int)>(); + ffi.Pointer Line_Async( + Mat img, + Point pt1, + Point pt2, + Scalar color, + int thickness, + int lineType, + int shift, + CvCallback_0 callback, + ) { + return _Line_Async( + img, + pt1, + pt2, + color, + thickness, + lineType, + shift, + callback, + ); + } + + late final _Line_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Point, Point, Scalar, ffi.Int, + ffi.Int, ffi.Int, CvCallback_0)>>('Line_Async'); + late final _Line_Async = _Line_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Point, Point, Scalar, int, int, int, CvCallback_0)>(); + ffi.Pointer LinearPolar( Mat src, Mat dst, @@ -6980,6 +11954,30 @@ class CvNative { late final _LinearPolar = _LinearPolarPtr.asFunction< ffi.Pointer Function(Mat, Mat, Point2f, double, int)>(); + ffi.Pointer LinearPolar_Async( + Mat src, + Point2f center, + double maxRadius, + int flags, + CvCallback_1 callback, + ) { + return _LinearPolar_Async( + src, + center, + maxRadius, + flags, + callback, + ); + } + + late final _LinearPolar_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Point2f, ffi.Double, ffi.Int, + CvCallback_1)>>('LinearPolar_Async'); + late final _LinearPolar_Async = _LinearPolar_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Point2f, double, int, CvCallback_1)>(); + ffi.Pointer LogPolar( Mat src, Mat dst, @@ -7003,8 +12001,32 @@ class CvNative { late final _LogPolar = _LogPolarPtr.asFunction< ffi.Pointer Function(Mat, Mat, Point2f, double, int)>(); - void MSER_Close( - MSERPtr a, + ffi.Pointer LogPolar_Async( + Mat src, + Point2f center, + double m, + int flags, + CvCallback_1 callback, + ) { + return _LogPolar_Async( + src, + center, + m, + flags, + callback, + ); + } + + late final _LogPolar_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Point2f, ffi.Double, ffi.Int, + CvCallback_1)>>('LogPolar_Async'); + late final _LogPolar_Async = _LogPolar_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Point2f, double, int, CvCallback_1)>(); + + void MSER_Close( + MSERPtr a, ) { return _MSER_Close( a, @@ -7015,6 +12037,23 @@ 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, ) { @@ -7029,6 +12068,20 @@ 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, @@ -7048,6 +12101,25 @@ class CvNative { 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, + src, + callback, + ); + } + + late final _MSER_Detect_AsyncPtr = _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)>(); + ffi.Pointer Mat_AbsDiff( Mat src1, Mat src2, @@ -7121,6 +12193,52 @@ class CvNative { late final _Mat_AccumulateProductWithMask = _Mat_AccumulateProductWithMaskPtr .asFunction Function(Mat, Mat, Mat, Mat)>(); + ffi.Pointer Mat_AccumulateProductWithMask_Async( + Mat src1, + Mat src2, + Mat dst, + Mat mask, + CvCallback_0 callback, + ) { + return _Mat_AccumulateProductWithMask_Async( + src1, + src2, + dst, + mask, + callback, + ); + } + + late final _Mat_AccumulateProductWithMask_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, Mat, Mat, + CvCallback_0)>>('Mat_AccumulateProductWithMask_Async'); + late final _Mat_AccumulateProductWithMask_Async = + _Mat_AccumulateProductWithMask_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, Mat, CvCallback_0)>(); + + ffi.Pointer Mat_AccumulateProduct_Async( + Mat src1, + Mat src2, + Mat dst, + CvCallback_0 callback, + ) { + return _Mat_AccumulateProduct_Async( + src1, + src2, + dst, + callback, + ); + } + + late final _Mat_AccumulateProduct_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, Mat, CvCallback_0)>>('Mat_AccumulateProduct_Async'); + late final _Mat_AccumulateProduct_Async = + _Mat_AccumulateProduct_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, CvCallback_0)>(); + ffi.Pointer Mat_AccumulateSquare( Mat src, Mat dst, @@ -7155,6 +12273,47 @@ class CvNative { late final _Mat_AccumulateSquareWithMask = _Mat_AccumulateSquareWithMaskPtr .asFunction Function(Mat, Mat, Mat)>(); + ffi.Pointer Mat_AccumulateSquareWithMask_Async( + Mat src, + Mat dst, + Mat mask, + CvCallback_0 callback, + ) { + return _Mat_AccumulateSquareWithMask_Async( + src, + dst, + mask, + callback, + ); + } + + late final _Mat_AccumulateSquareWithMask_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, Mat, + CvCallback_0)>>('Mat_AccumulateSquareWithMask_Async'); + late final _Mat_AccumulateSquareWithMask_Async = + _Mat_AccumulateSquareWithMask_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, CvCallback_0)>(); + + ffi.Pointer Mat_AccumulateSquare_Async( + Mat src, + Mat dst, + CvCallback_0 callback, + ) { + return _Mat_AccumulateSquare_Async( + src, + dst, + callback, + ); + } + + late final _Mat_AccumulateSquare_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, CvCallback_0)>>('Mat_AccumulateSquare_Async'); + late final _Mat_AccumulateSquare_Async = _Mat_AccumulateSquare_AsyncPtr + .asFunction Function(Mat, Mat, CvCallback_0)>(); + ffi.Pointer Mat_AccumulateWithMask( Mat src, Mat dst, @@ -7173,6 +12332,47 @@ class CvNative { late final _Mat_AccumulateWithMask = _Mat_AccumulateWithMaskPtr.asFunction< ffi.Pointer Function(Mat, Mat, Mat)>(); + ffi.Pointer Mat_AccumulateWithMask_Async( + Mat src, + Mat dst, + Mat mask, + CvCallback_0 callback, + ) { + return _Mat_AccumulateWithMask_Async( + src, + dst, + mask, + callback, + ); + } + + late final _Mat_AccumulateWithMask_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, Mat, CvCallback_0)>>('Mat_AccumulateWithMask_Async'); + late final _Mat_AccumulateWithMask_Async = + _Mat_AccumulateWithMask_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, CvCallback_0)>(); + + ffi.Pointer Mat_Accumulate_Async( + Mat src, + Mat dst, + CvCallback_0 callback, + ) { + return _Mat_Accumulate_Async( + src, + dst, + callback, + ); + } + + late final _Mat_Accumulate_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, CvCallback_0)>>('Mat_Accumulate_Async'); + late final _Mat_Accumulate_Async = _Mat_Accumulate_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, CvCallback_0)>(); + ffi.Pointer Mat_AccumulatedWeighted( Mat src, Mat dst, @@ -7214,6 +12414,53 @@ class CvNative { _Mat_AccumulatedWeightedWithMaskPtr.asFunction< ffi.Pointer Function(Mat, Mat, double, Mat)>(); + ffi.Pointer Mat_AccumulatedWeightedWithMask_Async( + Mat src, + Mat dst, + double alpha, + Mat mask, + CvCallback_0 callback, + ) { + return _Mat_AccumulatedWeightedWithMask_Async( + src, + dst, + alpha, + mask, + callback, + ); + } + + late final _Mat_AccumulatedWeightedWithMask_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, ffi.Double, Mat, + CvCallback_0)>>('Mat_AccumulatedWeightedWithMask_Async'); + late final _Mat_AccumulatedWeightedWithMask_Async = + _Mat_AccumulatedWeightedWithMask_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, double, Mat, CvCallback_0)>(); + + ffi.Pointer Mat_AccumulatedWeighted_Async( + Mat src, + Mat dst, + double alpha, + CvCallback_0 callback, + ) { + return _Mat_AccumulatedWeighted_Async( + src, + dst, + alpha, + callback, + ); + } + + late final _Mat_AccumulatedWeighted_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, ffi.Double, + CvCallback_0)>>('Mat_AccumulatedWeighted_Async'); + late final _Mat_AccumulatedWeighted_Async = + _Mat_AccumulatedWeighted_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, double, CvCallback_0)>(); + ffi.Pointer Mat_Add( Mat src1, Mat src2, @@ -7653,6 +12900,23 @@ class CvNative { late final _Mat_Clone = _Mat_ClonePtr.asFunction< ffi.Pointer Function(Mat, ffi.Pointer)>(); + ffi.Pointer Mat_Clone_Async( + Mat self, + CvCallback_1 callback, + ) { + return _Mat_Clone_Async( + self, + callback, + ); + } + + late final _Mat_Clone_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Mat, CvCallback_1)>>( + 'Mat_Clone_Async'); + late final _Mat_Clone_Async = _Mat_Clone_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, CvCallback_1)>(); + void Mat_Close( MatPtr m, ) { @@ -7812,6 +13076,50 @@ class CvNative { late final _Mat_ConvertToWithParams = _Mat_ConvertToWithParamsPtr.asFunction< ffi.Pointer Function(Mat, Mat, int, double, double)>(); + ffi.Pointer Mat_ConvertToWithParams_Async( + Mat self, + int type, + double alpha, + double beta, + CvCallback_1 callback, + ) { + return _Mat_ConvertToWithParams_Async( + self, + type, + alpha, + beta, + callback, + ); + } + + late final _Mat_ConvertToWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, ffi.Int, ffi.Float, ffi.Float, + CvCallback_1)>>('Mat_ConvertToWithParams_Async'); + late final _Mat_ConvertToWithParams_Async = + _Mat_ConvertToWithParams_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, int, double, double, CvCallback_1)>(); + + ffi.Pointer Mat_ConvertTo_Async( + Mat self, + int type, + CvCallback_1 callback, + ) { + return _Mat_ConvertTo_Async( + self, + type, + callback, + ); + } + + late final _Mat_ConvertTo_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, ffi.Int, CvCallback_1)>>('Mat_ConvertTo_Async'); + late final _Mat_ConvertTo_Async = _Mat_ConvertTo_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, CvCallback_1)>(); + ffi.Pointer Mat_CopyMakeBorder( Mat src, Mat dst, @@ -7876,6 +13184,47 @@ class CvNative { late final _Mat_CopyToWithMask = _Mat_CopyToWithMaskPtr.asFunction< ffi.Pointer Function(Mat, Mat, Mat)>(); + ffi.Pointer Mat_CopyToWithMask_Async( + Mat self, + Mat dst, + Mat mask, + CvCallback_0 callback, + ) { + return _Mat_CopyToWithMask_Async( + self, + dst, + mask, + callback, + ); + } + + late final _Mat_CopyToWithMask_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, Mat, CvCallback_0)>>('Mat_CopyToWithMask_Async'); + late final _Mat_CopyToWithMask_Async = + _Mat_CopyToWithMask_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, CvCallback_0)>(); + + ffi.Pointer Mat_CopyTo_Async( + Mat self, + Mat dst, + CvCallback_0 callback, + ) { + return _Mat_CopyTo_Async( + self, + dst, + callback, + ); + } + + late final _Mat_CopyTo_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, CvCallback_0)>>('Mat_CopyTo_Async'); + late final _Mat_CopyTo_Async = _Mat_CopyTo_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, CvCallback_0)>(); + ffi.Pointer Mat_CountNonZero( Mat src, ffi.Pointer rval, @@ -8189,6 +13538,27 @@ class CvNative { late final _Mat_ExtractChannel = _Mat_ExtractChannelPtr.asFunction< ffi.Pointer Function(Mat, Mat, int)>(); + ffi.Pointer Mat_Eye_Async( + int rows, + int cols, + int type, + CvCallback_1 callback, + ) { + return _Mat_Eye_Async( + rows, + cols, + type, + callback, + ); + } + + late final _Mat_Eye_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Int, ffi.Int, ffi.Int, CvCallback_1)>>('Mat_Eye_Async'); + late final _Mat_Eye_Async = _Mat_Eye_AsyncPtr.asFunction< + ffi.Pointer Function(int, int, int, CvCallback_1)>(); + ffi.Pointer Mat_FindNonZero( Mat src, Mat idx, @@ -9679,7 +15049,6 @@ class CvNative { int cols, int type, ffi.Pointer buf, - int step, ffi.Pointer rval, ) { return _Mat_NewFromBytes( @@ -9687,12 +15056,37 @@ class CvNative { cols, type, buf, - step, rval, ); } late final _Mat_NewFromBytesPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Int, ffi.Int, ffi.Int, + ffi.Pointer, ffi.Pointer)>>('Mat_NewFromBytes'); + late final _Mat_NewFromBytes = _Mat_NewFromBytesPtr.asFunction< + ffi.Pointer Function( + int, int, int, ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer Mat_NewFromBytes_Async( + int rows, + int cols, + int type, + ffi.Pointer buf, + int step, + CvCallback_1 callback, + ) { + return _Mat_NewFromBytes_Async( + rows, + cols, + type, + buf, + step, + callback, + ); + } + + late final _Mat_NewFromBytes_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( ffi.Int, @@ -9700,10 +15094,10 @@ class CvNative { ffi.Int, ffi.Pointer, ffi.Int, - ffi.Pointer)>>('Mat_NewFromBytes'); - late final _Mat_NewFromBytes = _Mat_NewFromBytesPtr.asFunction< + CvCallback_1)>>('Mat_NewFromBytes_Async'); + late final _Mat_NewFromBytes_Async = _Mat_NewFromBytes_AsyncPtr.asFunction< ffi.Pointer Function( - int, int, int, ffi.Pointer, int, ffi.Pointer)>(); + int, int, int, ffi.Pointer, int, CvCallback_1)>(); ffi.Pointer Mat_NewFromScalar( Scalar ar, @@ -9724,16 +15118,39 @@ class CvNative { late final _Mat_NewFromScalar = _Mat_NewFromScalarPtr.asFunction< ffi.Pointer Function(Scalar, int, ffi.Pointer)>(); - ffi.Pointer Mat_NewFromVecPoint( - VecPoint vec, - ffi.Pointer rval, + ffi.Pointer Mat_NewFromScalar_Async( + Scalar s, + int rows, + int cols, + int type, + CvCallback_1 callback, ) { - return _Mat_NewFromVecPoint( - vec, - rval, - ); - } - + return _Mat_NewFromScalar_Async( + s, + rows, + cols, + type, + callback, + ); + } + + late final _Mat_NewFromScalar_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Scalar, ffi.Int, ffi.Int, ffi.Int, + CvCallback_1)>>('Mat_NewFromScalar_Async'); + late final _Mat_NewFromScalar_Async = _Mat_NewFromScalar_AsyncPtr.asFunction< + ffi.Pointer Function(Scalar, int, int, int, CvCallback_1)>(); + + ffi.Pointer Mat_NewFromVecPoint( + VecPoint vec, + ffi.Pointer rval, + ) { + return _Mat_NewFromVecPoint( + vec, + rval, + ); + } + late final _Mat_NewFromVecPointPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( @@ -9758,6 +15175,23 @@ class CvNative { late final _Mat_NewFromVecPoint2f = _Mat_NewFromVecPoint2fPtr.asFunction< ffi.Pointer Function(VecPoint2f, ffi.Pointer)>(); + ffi.Pointer Mat_NewFromVecPoint2f_Async( + VecPoint2f vec, + CvCallback_1 callback, + ) { + return _Mat_NewFromVecPoint2f_Async( + vec, + callback, + ); + } + + late final _Mat_NewFromVecPoint2f_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPoint2f, CvCallback_1)>>('Mat_NewFromVecPoint2f_Async'); + late final _Mat_NewFromVecPoint2f_Async = _Mat_NewFromVecPoint2f_AsyncPtr + .asFunction Function(VecPoint2f, CvCallback_1)>(); + ffi.Pointer Mat_NewFromVecPoint3f( VecPoint3f vec, ffi.Pointer rval, @@ -9775,6 +15209,40 @@ class CvNative { late final _Mat_NewFromVecPoint3f = _Mat_NewFromVecPoint3fPtr.asFunction< ffi.Pointer Function(VecPoint3f, ffi.Pointer)>(); + ffi.Pointer Mat_NewFromVecPoint3f_Async( + VecPoint3f vec, + CvCallback_1 callback, + ) { + return _Mat_NewFromVecPoint3f_Async( + vec, + callback, + ); + } + + late final _Mat_NewFromVecPoint3f_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPoint3f, CvCallback_1)>>('Mat_NewFromVecPoint3f_Async'); + late final _Mat_NewFromVecPoint3f_Async = _Mat_NewFromVecPoint3f_AsyncPtr + .asFunction Function(VecPoint3f, CvCallback_1)>(); + + ffi.Pointer Mat_NewFromVecPoint_Async( + VecPoint vec, + CvCallback_1 callback, + ) { + return _Mat_NewFromVecPoint_Async( + vec, + callback, + ); + } + + late final _Mat_NewFromVecPoint_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPoint, CvCallback_1)>>('Mat_NewFromVecPoint_Async'); + late final _Mat_NewFromVecPoint_Async = _Mat_NewFromVecPoint_AsyncPtr + .asFunction Function(VecPoint, CvCallback_1)>(); + ffi.Pointer Mat_NewWithSize( int rows, int cols, @@ -9821,6 +15289,27 @@ class CvNative { ffi.Pointer Function( Scalar, int, int, int, ffi.Pointer)>(); + ffi.Pointer Mat_NewWithSize_Async( + int rows, + int cols, + int type, + CvCallback_1 callback, + ) { + return _Mat_NewWithSize_Async( + rows, + cols, + type, + callback, + ); + } + + late final _Mat_NewWithSize_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Int, ffi.Int, ffi.Int, + CvCallback_1)>>('Mat_NewWithSize_Async'); + late final _Mat_NewWithSize_Async = _Mat_NewWithSize_AsyncPtr.asFunction< + ffi.Pointer Function(int, int, int, CvCallback_1)>(); + ffi.Pointer Mat_NewWithSizes( VecInt sizes, int type, @@ -9863,6 +15352,28 @@ class CvNative { ffi.Pointer Function( VecInt, int, VecChar, ffi.Pointer)>(); + ffi.Pointer Mat_NewWithSizesFromBytes_Async( + VecInt sizes, + int type, + VecChar buf, + CvCallback_1 callback, + ) { + return _Mat_NewWithSizesFromBytes_Async( + sizes, + type, + buf, + callback, + ); + } + + late final _Mat_NewWithSizesFromBytes_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecInt, ffi.Int, VecChar, + CvCallback_1)>>('Mat_NewWithSizesFromBytes_Async'); + late final _Mat_NewWithSizesFromBytes_Async = + _Mat_NewWithSizesFromBytes_AsyncPtr.asFunction< + ffi.Pointer Function(VecInt, int, VecChar, CvCallback_1)>(); + ffi.Pointer Mat_NewWithSizesFromScalar( VecInt sizes, int type, @@ -9886,6 +15397,61 @@ class CvNative { ffi.Pointer Function( VecInt, int, Scalar, ffi.Pointer)>(); + ffi.Pointer Mat_NewWithSizesScalar_Async( + VecInt sizes, + int type, + Scalar s, + CvCallback_1 callback, + ) { + return _Mat_NewWithSizesScalar_Async( + sizes, + type, + s, + callback, + ); + } + + late final _Mat_NewWithSizesScalar_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecInt, ffi.Int, Scalar, + CvCallback_1)>>('Mat_NewWithSizesScalar_Async'); + late final _Mat_NewWithSizesScalar_Async = + _Mat_NewWithSizesScalar_AsyncPtr.asFunction< + ffi.Pointer Function(VecInt, int, Scalar, CvCallback_1)>(); + + ffi.Pointer Mat_NewWithSizes_Async( + VecInt sizes, + int type, + CvCallback_1 callback, + ) { + return _Mat_NewWithSizes_Async( + sizes, + type, + callback, + ); + } + + late final _Mat_NewWithSizes_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecInt, ffi.Int, CvCallback_1)>>('Mat_NewWithSizes_Async'); + late final _Mat_NewWithSizes_Async = _Mat_NewWithSizes_AsyncPtr.asFunction< + ffi.Pointer Function(VecInt, int, CvCallback_1)>(); + + ffi.Pointer Mat_New_Async( + CvCallback_1 callback, + ) { + return _Mat_New_Async( + callback, + ); + } + + late final _Mat_New_AsyncPtr = + _lookup Function(CvCallback_1)>>( + 'Mat_New_Async'); + late final _Mat_New_Async = _Mat_New_AsyncPtr.asFunction< + ffi.Pointer Function(CvCallback_1)>(); + ffi.Pointer Mat_Normalize( Mat src, Mat dst, @@ -9909,6 +15475,27 @@ class CvNative { late final _Mat_Normalize = _Mat_NormalizePtr.asFunction< ffi.Pointer Function(Mat, Mat, double, double, int)>(); + ffi.Pointer Mat_Ones_Async( + int rows, + int cols, + int type, + CvCallback_1 callback, + ) { + return _Mat_Ones_Async( + rows, + cols, + type, + callback, + ); + } + + late final _Mat_Ones_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Int, ffi.Int, ffi.Int, CvCallback_1)>>('Mat_Ones_Async'); + late final _Mat_Ones_Async = _Mat_Ones_AsyncPtr.asFunction< + ffi.Pointer Function(int, int, int, CvCallback_1)>(); + ffi.Pointer Mat_PCACompute( Mat src, Mat mean, @@ -10574,6 +16161,25 @@ class CvNative { late final _Mat_Region = _Mat_RegionPtr.asFunction< ffi.Pointer Function(Mat, Rect, ffi.Pointer)>(); + ffi.Pointer Mat_Region_Async( + Mat self, + Rect r, + CvCallback_1 callback, + ) { + return _Mat_Region_Async( + self, + r, + callback, + ); + } + + late final _Mat_Region_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Rect, CvCallback_1)>>('Mat_Region_Async'); + late final _Mat_Region_Async = _Mat_Region_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Rect, CvCallback_1)>(); + ffi.Pointer Mat_Release( ffi.Pointer m, ) { @@ -10630,6 +16236,27 @@ class CvNative { late final _Mat_Reshape = _Mat_ReshapePtr.asFunction< ffi.Pointer Function(Mat, int, int, ffi.Pointer)>(); + ffi.Pointer Mat_Reshape_Async( + Mat self, + int cn, + int rows, + CvCallback_1 callback, + ) { + return _Mat_Reshape_Async( + self, + cn, + rows, + callback, + ); + } + + late final _Mat_Reshape_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, ffi.Int, ffi.Int, CvCallback_1)>>('Mat_Reshape_Async'); + late final _Mat_Reshape_Async = _Mat_Reshape_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, int, CvCallback_1)>(); + ffi.Pointer Mat_Rows( Mat m, ffi.Pointer rval, @@ -11784,6 +17411,23 @@ class CvNative { late final _Mat_ToVecChar = _Mat_ToVecCharPtr.asFunction< ffi.Pointer Function(Mat, ffi.Pointer)>(); + ffi.Pointer Mat_ToVecChar_Async( + Mat self, + CvCallback_1 callback, + ) { + return _Mat_ToVecChar_Async( + self, + callback, + ); + } + + late final _Mat_ToVecChar_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Mat, CvCallback_1)>>( + 'Mat_ToVecChar_Async'); + late final _Mat_ToVecChar_Async = _Mat_ToVecChar_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, CvCallback_1)>(); + ffi.Pointer Mat_ToVecUChar( Mat m, ffi.Pointer rval, @@ -11801,6 +17445,23 @@ class CvNative { late final _Mat_ToVecUChar = _Mat_ToVecUCharPtr.asFunction< ffi.Pointer Function(Mat, ffi.Pointer)>(); + ffi.Pointer Mat_ToVecUChar_Async( + Mat self, + CvCallback_1 callback, + ) { + return _Mat_ToVecUChar_Async( + self, + callback, + ); + } + + late final _Mat_ToVecUChar_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Mat, CvCallback_1)>>( + 'Mat_ToVecUChar_Async'); + late final _Mat_ToVecUChar_Async = _Mat_ToVecUChar_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, CvCallback_1)>(); + ffi.Pointer Mat_Total( Mat m, ffi.Pointer rval, @@ -11904,6 +17565,27 @@ class CvNative { late final _Mat_Vconcat = _Mat_VconcatPtr.asFunction< ffi.Pointer Function(Mat, Mat, Mat)>(); + ffi.Pointer Mat_Zeros_Async( + int rows, + int cols, + int type, + CvCallback_1 callback, + ) { + return _Mat_Zeros_Async( + rows, + cols, + type, + callback, + ); + } + + late final _Mat_Zeros_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Int, ffi.Int, ffi.Int, CvCallback_1)>>('Mat_Zeros_Async'); + late final _Mat_Zeros_Async = _Mat_Zeros_AsyncPtr.asFunction< + ffi.Pointer Function(int, int, int, CvCallback_1)>(); + ffi.Pointer Mat_colRange( Mat m, int start, @@ -11970,6 +17652,30 @@ class CvNative { ffi.Pointer Function( VecPoint, VecPoint, int, double, ffi.Pointer)>(); + ffi.Pointer MatchShapes_Async( + VecPoint contour1, + VecPoint contour2, + int method, + double parameter, + CvCallback_1 callback, + ) { + return _MatchShapes_Async( + contour1, + contour2, + method, + parameter, + callback, + ); + } + + late final _MatchShapes_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecPoint, VecPoint, ffi.Int, + ffi.Double, CvCallback_1)>>('MatchShapes_Async'); + late final _MatchShapes_Async = _MatchShapes_AsyncPtr.asFunction< + ffi.Pointer Function( + VecPoint, VecPoint, int, double, CvCallback_1)>(); + ffi.Pointer MatchTemplate( Mat image, Mat templ, @@ -11993,6 +17699,29 @@ class CvNative { late final _MatchTemplate = _MatchTemplatePtr.asFunction< ffi.Pointer Function(Mat, Mat, Mat, int, Mat)>(); + ffi.Pointer MatchTemplate_Async( + Mat image, + Mat templ, + int method, + Mat mask, + CvCallback_1 callback, + ) { + return _MatchTemplate_Async( + image, + templ, + method, + mask, + callback, + ); + } + + late final _MatchTemplate_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, ffi.Int, Mat, CvCallback_1)>>('MatchTemplate_Async'); + late final _MatchTemplate_Async = _MatchTemplate_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, int, Mat, CvCallback_1)>(); + ffi.Pointer MedianBlur( Mat src, Mat dst, @@ -12011,6 +17740,25 @@ class CvNative { late final _MedianBlur = _MedianBlurPtr.asFunction< ffi.Pointer Function(Mat, Mat, int)>(); + ffi.Pointer MedianBlur_Async( + Mat src, + int ksize, + CvCallback_1 callback, + ) { + return _MedianBlur_Async( + src, + ksize, + callback, + ); + } + + late final _MedianBlur_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, ffi.Int, CvCallback_1)>>('MedianBlur_Async'); + late final _MedianBlur_Async = _MedianBlur_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, CvCallback_1)>(); + void MergeMertens_Close( MergeMertensPtr b, ) { @@ -12063,6 +17811,43 @@ class CvNative { ffi.Pointer Function( double, double, double, ffi.Pointer)>(); + ffi.Pointer MergeMertens_CreateWithParams_Async( + double contrast_weight, + double saturation_weight, + double exposure_weight, + CvCallback_1 callback, + ) { + return _MergeMertens_CreateWithParams_Async( + contrast_weight, + saturation_weight, + exposure_weight, + callback, + ); + } + + late final _MergeMertens_CreateWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Float, ffi.Float, ffi.Float, + CvCallback_1)>>('MergeMertens_CreateWithParams_Async'); + late final _MergeMertens_CreateWithParams_Async = + _MergeMertens_CreateWithParams_AsyncPtr.asFunction< + ffi.Pointer Function( + double, double, double, CvCallback_1)>(); + + ffi.Pointer MergeMertens_Create_Async( + CvCallback_1 callback, + ) { + return _MergeMertens_Create_Async( + callback, + ); + } + + late final _MergeMertens_Create_AsyncPtr = + _lookup Function(CvCallback_1)>>( + 'MergeMertens_Create_Async'); + late final _MergeMertens_Create_Async = _MergeMertens_Create_AsyncPtr + .asFunction Function(CvCallback_1)>(); + ffi.Pointer MergeMertens_Process( MergeMertens b, VecMat src, @@ -12082,6 +17867,26 @@ class CvNative { late final _MergeMertens_Process = _MergeMertens_ProcessPtr.asFunction< ffi.Pointer Function(MergeMertens, VecMat, Mat)>(); + ffi.Pointer MergeMertens_Process_Async( + MergeMertens b, + VecMat src, + CvCallback_1 callback, + ) { + return _MergeMertens_Process_Async( + b, + src, + callback, + ); + } + + late final _MergeMertens_Process_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(MergeMertens, VecMat, + CvCallback_1)>>('MergeMertens_Process_Async'); + late final _MergeMertens_Process_Async = + _MergeMertens_Process_AsyncPtr.asFunction< + ffi.Pointer Function(MergeMertens, VecMat, CvCallback_1)>(); + ffi.Pointer MinAreaRect( VecPoint pts, ffi.Pointer rval, @@ -12099,10 +17904,27 @@ class CvNative { late final _MinAreaRect = _MinAreaRectPtr.asFunction< ffi.Pointer Function(VecPoint, ffi.Pointer)>(); - ffi.Pointer MinEnclosingCircle( + ffi.Pointer MinAreaRect_Async( VecPoint pts, - ffi.Pointer center, - ffi.Pointer radius, + CvCallback_1 callback, + ) { + return _MinAreaRect_Async( + pts, + callback, + ); + } + + late final _MinAreaRect_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPoint, CvCallback_1)>>('MinAreaRect_Async'); + late final _MinAreaRect_Async = _MinAreaRect_AsyncPtr.asFunction< + ffi.Pointer Function(VecPoint, CvCallback_1)>(); + + ffi.Pointer MinEnclosingCircle( + VecPoint pts, + ffi.Pointer center, + ffi.Pointer radius, ) { return _MinEnclosingCircle( pts, @@ -12119,6 +17941,23 @@ class CvNative { ffi.Pointer Function( VecPoint, ffi.Pointer, ffi.Pointer)>(); + ffi.Pointer MinEnclosingCircle_Async( + VecPoint pts, + CvCallback_2 callback, + ) { + return _MinEnclosingCircle_Async( + pts, + callback, + ); + } + + late final _MinEnclosingCircle_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPoint, CvCallback_2)>>('MinEnclosingCircle_Async'); + late final _MinEnclosingCircle_Async = _MinEnclosingCircle_AsyncPtr + .asFunction Function(VecPoint, CvCallback_2)>(); + ffi.Pointer Moments( Mat src, bool binaryImage, @@ -12138,6 +17977,25 @@ class CvNative { late final _Moments = _MomentsPtr.asFunction< ffi.Pointer Function(Mat, bool, ffi.Pointer)>(); + ffi.Pointer Moments_Async( + Mat src, + bool binaryImage, + CvCallback_1 callback, + ) { + return _Moments_Async( + src, + binaryImage, + callback, + ); + } + + late final _Moments_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, ffi.Bool, CvCallback_1)>>('Moments_Async'); + late final _Moments_Async = _Moments_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, bool, CvCallback_1)>(); + ffi.Pointer MorphologyDefaultBorderValue( ffi.Pointer rval, ) { @@ -12153,6 +18011,21 @@ class CvNative { late final _MorphologyDefaultBorderValue = _MorphologyDefaultBorderValuePtr .asFunction Function(ffi.Pointer)>(); + ffi.Pointer MorphologyDefaultBorderValue_Async( + CvCallback_1 callback, + ) { + return _MorphologyDefaultBorderValue_Async( + callback, + ); + } + + late final _MorphologyDefaultBorderValue_AsyncPtr = + _lookup Function(CvCallback_1)>>( + 'MorphologyDefaultBorderValue_Async'); + late final _MorphologyDefaultBorderValue_Async = + _MorphologyDefaultBorderValue_AsyncPtr.asFunction< + ffi.Pointer Function(CvCallback_1)>(); + ffi.Pointer MorphologyEx( Mat src, Mat dst, @@ -12204,6 +18077,58 @@ class CvNative { ffi.Pointer Function( Mat, Mat, int, Mat, Point, int, int, Scalar)>(); + ffi.Pointer MorphologyExWithParams_Async( + Mat src, + int op, + Mat kernel, + Point pt, + int iterations, + int borderType, + Scalar borderValue, + CvCallback_1 callback, + ) { + return _MorphologyExWithParams_Async( + src, + op, + kernel, + pt, + iterations, + borderType, + borderValue, + callback, + ); + } + + late final _MorphologyExWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, ffi.Int, Mat, Point, ffi.Int, + ffi.Int, Scalar, CvCallback_1)>>('MorphologyExWithParams_Async'); + late final _MorphologyExWithParams_Async = + _MorphologyExWithParams_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, int, Mat, Point, int, int, Scalar, CvCallback_1)>(); + + ffi.Pointer MorphologyEx_Async( + Mat src, + int op, + Mat kernel, + CvCallback_1 callback, + ) { + return _MorphologyEx_Async( + src, + op, + kernel, + callback, + ); + } + + late final _MorphologyEx_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, ffi.Int, Mat, CvCallback_1)>>('MorphologyEx_Async'); + late final _MorphologyEx_Async = _MorphologyEx_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, Mat, CvCallback_1)>(); + ffi.Pointer NMSBoxes( VecRect bboxes, VecFloat scores, @@ -12262,6 +18187,65 @@ class CvNative { ffi.Pointer Function(VecRect, VecFloat, double, double, ffi.Pointer, double, int)>(); + ffi.Pointer NMSBoxesWithParams_Async( + VecRect bboxes, + VecFloat scores, + double score_threshold, + double nms_threshold, + double eta, + int top_k, + CvCallback_1 callback, + ) { + return _NMSBoxesWithParams_Async( + bboxes, + scores, + score_threshold, + nms_threshold, + eta, + top_k, + callback, + ); + } + + late final _NMSBoxesWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecRect, + VecFloat, + ffi.Float, + ffi.Float, + ffi.Float, + ffi.Int, + CvCallback_1)>>('NMSBoxesWithParams_Async'); + late final _NMSBoxesWithParams_Async = + _NMSBoxesWithParams_AsyncPtr.asFunction< + ffi.Pointer Function( + VecRect, VecFloat, double, double, double, int, CvCallback_1)>(); + + ffi.Pointer NMSBoxes_Async( + VecRect bboxes, + VecFloat scores, + double score_threshold, + double nms_threshold, + CvCallback_1 callback, + ) { + return _NMSBoxes_Async( + bboxes, + scores, + score_threshold, + nms_threshold, + callback, + ); + } + + late final _NMSBoxes_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecRect, VecFloat, ffi.Float, + ffi.Float, CvCallback_1)>>('NMSBoxes_Async'); + late final _NMSBoxes_Async = _NMSBoxes_AsyncPtr.asFunction< + ffi.Pointer Function( + VecRect, VecFloat, double, double, CvCallback_1)>(); + ffi.Pointer Net_BlobFromImage( Mat image, Mat blob, @@ -12292,6 +18276,43 @@ class CvNative { ffi.Pointer Function( Mat, Mat, double, Size, Scalar, bool, bool, int)>(); + ffi.Pointer Net_BlobFromImage_Async( + Mat image, + double scalefactor, + Size size, + Scalar mean, + bool swapRB, + bool crop, + int ddepth, + CvCallback_1 callback, + ) { + return _Net_BlobFromImage_Async( + image, + scalefactor, + size, + mean, + swapRB, + crop, + ddepth, + callback, + ); + } + + late final _Net_BlobFromImage_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, + ffi.Double, + Size, + Scalar, + ffi.Bool, + ffi.Bool, + ffi.Int, + CvCallback_1)>>('Net_BlobFromImage_Async'); + late final _Net_BlobFromImage_Async = _Net_BlobFromImage_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, double, Size, Scalar, bool, bool, int, CvCallback_1)>(); + ffi.Pointer Net_BlobFromImages( VecMat images, Mat blob, @@ -12322,6 +18343,44 @@ class CvNative { ffi.Pointer Function( VecMat, Mat, double, Size, Scalar, bool, bool, int)>(); + ffi.Pointer Net_BlobFromImages_Async( + VecMat images, + double scalefactor, + Size size, + Scalar mean, + bool swapRB, + bool crop, + int ddepth, + CvCallback_1 callback, + ) { + return _Net_BlobFromImages_Async( + images, + scalefactor, + size, + mean, + swapRB, + crop, + ddepth, + callback, + ); + } + + late final _Net_BlobFromImages_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecMat, + ffi.Double, + Size, + Scalar, + ffi.Bool, + ffi.Bool, + ffi.Int, + CvCallback_1)>>('Net_BlobFromImages_Async'); + late final _Net_BlobFromImages_Async = + _Net_BlobFromImages_AsyncPtr.asFunction< + ffi.Pointer Function( + VecMat, double, Size, Scalar, bool, bool, int, CvCallback_1)>(); + void Net_Close( NetPtr net, ) { @@ -12334,6 +18393,22 @@ class CvNative { _lookup>('Net_Close'); late final _Net_Close = _Net_ClosePtr.asFunction(); + void Net_Close_Async( + NetPtr net, + CvCallback_0 callback, + ) { + return _Net_Close_Async( + net, + callback, + ); + } + + late final _Net_Close_AsyncPtr = + _lookup>( + 'Net_Close_Async'); + late final _Net_Close_Async = + _Net_Close_AsyncPtr.asFunction(); + ffi.Pointer Net_Create( ffi.Pointer rval, ) { @@ -12348,6 +18423,20 @@ class CvNative { late final _Net_Create = _Net_CreatePtr.asFunction< ffi.Pointer Function(ffi.Pointer)>(); + ffi.Pointer Net_Create_Async( + CvCallback_1 callback, + ) { + return _Net_Create_Async( + callback, + ); + } + + late final _Net_Create_AsyncPtr = + _lookup Function(CvCallback_1)>>( + 'Net_Create_Async'); + late final _Net_Create_Async = _Net_Create_AsyncPtr.asFunction< + ffi.Pointer Function(CvCallback_1)>(); + ffi.Pointer Net_Dump( Net net, ffi.Pointer> rval, @@ -12366,6 +18455,22 @@ class CvNative { ffi.Pointer Function( Net, ffi.Pointer>)>(); + ffi.Pointer Net_Dump_Async( + Net net, + CvCallback_1 callback, + ) { + return _Net_Dump_Async( + net, + callback, + ); + } + + late final _Net_Dump_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Net, CvCallback_1)>>('Net_Dump_Async'); + late final _Net_Dump_Async = _Net_Dump_AsyncPtr.asFunction< + ffi.Pointer Function(Net, CvCallback_1)>(); + ffi.Pointer Net_Empty( Net net, ffi.Pointer rval, @@ -12383,6 +18488,23 @@ class CvNative { late final _Net_Empty = _Net_EmptyPtr.asFunction< ffi.Pointer Function(Net, ffi.Pointer)>(); + ffi.Pointer Net_Empty_Async( + Net net, + CvCallback_1 callback, + ) { + return _Net_Empty_Async( + net, + callback, + ); + } + + late final _Net_Empty_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Net, CvCallback_1)>>( + 'Net_Empty_Async'); + late final _Net_Empty_Async = _Net_Empty_AsyncPtr.asFunction< + ffi.Pointer Function(Net, CvCallback_1)>(); + ffi.Pointer Net_Forward( Net net, ffi.Pointer outputName, @@ -12422,6 +18544,45 @@ class CvNative { late final _Net_ForwardLayers = _Net_ForwardLayersPtr.asFunction< ffi.Pointer Function(Net, ffi.Pointer, VecVecChar)>(); + ffi.Pointer Net_ForwardLayers_Async( + Net net, + VecVecChar outBlobNames, + CvCallback_1 callback, + ) { + return _Net_ForwardLayers_Async( + net, + outBlobNames, + callback, + ); + } + + late final _Net_ForwardLayers_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Net, VecVecChar, CvCallback_1)>>('Net_ForwardLayers_Async'); + late final _Net_ForwardLayers_Async = _Net_ForwardLayers_AsyncPtr.asFunction< + ffi.Pointer Function(Net, VecVecChar, CvCallback_1)>(); + + ffi.Pointer Net_Forward_Async( + Net net, + ffi.Pointer outputName, + CvCallback_1 callback, + ) { + return _Net_Forward_Async( + net, + outputName, + callback, + ); + } + + late final _Net_Forward_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Net, ffi.Pointer, CvCallback_1)>>('Net_Forward_Async'); + late final _Net_Forward_Async = _Net_Forward_AsyncPtr.asFunction< + ffi.Pointer Function( + Net, ffi.Pointer, CvCallback_1)>(); + ffi.Pointer Net_FromNet( Net net, ffi.Pointer rval, @@ -12439,6 +18600,23 @@ class CvNative { late final _Net_FromNet = _Net_FromNetPtr.asFunction< ffi.Pointer Function(Net, ffi.Pointer)>(); + ffi.Pointer Net_FromNet_Async( + Net net, + CvCallback_1 callback, + ) { + return _Net_FromNet_Async( + net, + callback, + ); + } + + late final _Net_FromNet_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Net, CvCallback_1)>>( + 'Net_FromNet_Async'); + late final _Net_FromNet_Async = _Net_FromNet_AsyncPtr.asFunction< + ffi.Pointer Function(Net, CvCallback_1)>(); + ffi.Pointer Net_GetBlobChannel( Mat blob, int imgidx, @@ -12460,13 +18638,35 @@ class CvNative { late final _Net_GetBlobChannel = _Net_GetBlobChannelPtr.asFunction< ffi.Pointer Function(Mat, int, int, ffi.Pointer)>(); - ffi.Pointer Net_GetBlobSize( + ffi.Pointer Net_GetBlobChannel_Async( Mat blob, - ffi.Pointer rval, + int imgidx, + int chnidx, + CvCallback_1 callback, ) { - return _Net_GetBlobSize( + return _Net_GetBlobChannel_Async( blob, - rval, + imgidx, + chnidx, + callback, + ); + } + + late final _Net_GetBlobChannel_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, ffi.Int, ffi.Int, + CvCallback_1)>>('Net_GetBlobChannel_Async'); + late final _Net_GetBlobChannel_Async = + _Net_GetBlobChannel_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, int, CvCallback_1)>(); + + ffi.Pointer Net_GetBlobSize( + Mat blob, + ffi.Pointer rval, + ) { + return _Net_GetBlobSize( + blob, + rval, ); } @@ -12477,6 +18677,23 @@ class CvNative { late final _Net_GetBlobSize = _Net_GetBlobSizePtr.asFunction< ffi.Pointer Function(Mat, ffi.Pointer)>(); + ffi.Pointer Net_GetBlobSize_Async( + Mat blob, + CvCallback_1 callback, + ) { + return _Net_GetBlobSize_Async( + blob, + callback, + ); + } + + late final _Net_GetBlobSize_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Mat, CvCallback_1)>>( + 'Net_GetBlobSize_Async'); + late final _Net_GetBlobSize_Async = _Net_GetBlobSize_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, CvCallback_1)>(); + ffi.Pointer Net_GetInputDetails( Net net, ffi.Pointer scales, @@ -12497,6 +18714,23 @@ class CvNative { ffi.Pointer Function( Net, ffi.Pointer, ffi.Pointer)>(); + ffi.Pointer Net_GetInputDetails_Async( + Net net, + CvCallback_2 callback, + ) { + return _Net_GetInputDetails_Async( + net, + callback, + ); + } + + late final _Net_GetInputDetails_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Net, CvCallback_2)>>( + 'Net_GetInputDetails_Async'); + late final _Net_GetInputDetails_Async = _Net_GetInputDetails_AsyncPtr + .asFunction Function(Net, CvCallback_2)>(); + ffi.Pointer Net_GetLayer( Net net, int layerid, @@ -12533,6 +18767,42 @@ class CvNative { late final _Net_GetLayerNames = _Net_GetLayerNamesPtr.asFunction< ffi.Pointer Function(Net, ffi.Pointer)>(); + ffi.Pointer Net_GetLayerNames_Async( + Net net, + CvCallback_1 callback, + ) { + return _Net_GetLayerNames_Async( + net, + callback, + ); + } + + late final _Net_GetLayerNames_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Net, CvCallback_1)>>( + 'Net_GetLayerNames_Async'); + late final _Net_GetLayerNames_Async = _Net_GetLayerNames_AsyncPtr.asFunction< + ffi.Pointer Function(Net, CvCallback_1)>(); + + ffi.Pointer Net_GetLayer_Async( + Net net, + int layerid, + CvCallback_1 callback, + ) { + return _Net_GetLayer_Async( + net, + layerid, + callback, + ); + } + + late final _Net_GetLayer_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Net, ffi.Int, CvCallback_1)>>('Net_GetLayer_Async'); + late final _Net_GetLayer_Async = _Net_GetLayer_AsyncPtr.asFunction< + ffi.Pointer Function(Net, int, CvCallback_1)>(); + ffi.Pointer Net_GetPerfProfile( Net net, ffi.Pointer rval, @@ -12550,6 +18820,23 @@ class CvNative { late final _Net_GetPerfProfile = _Net_GetPerfProfilePtr.asFunction< ffi.Pointer Function(Net, ffi.Pointer)>(); + ffi.Pointer Net_GetPerfProfile_Async( + Net net, + CvCallback_1 callback, + ) { + return _Net_GetPerfProfile_Async( + net, + callback, + ); + } + + late final _Net_GetPerfProfile_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Net, CvCallback_1)>>( + 'Net_GetPerfProfile_Async'); + late final _Net_GetPerfProfile_Async = _Net_GetPerfProfile_AsyncPtr + .asFunction Function(Net, CvCallback_1)>(); + ffi.Pointer Net_GetUnconnectedOutLayers( Net net, ffi.Pointer rval, @@ -12567,6 +18854,24 @@ class CvNative { late final _Net_GetUnconnectedOutLayers = _Net_GetUnconnectedOutLayersPtr .asFunction Function(Net, ffi.Pointer)>(); + ffi.Pointer Net_GetUnconnectedOutLayers_Async( + Net net, + CvCallback_1 callback, + ) { + return _Net_GetUnconnectedOutLayers_Async( + net, + callback, + ); + } + + late final _Net_GetUnconnectedOutLayers_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Net, CvCallback_1)>>( + 'Net_GetUnconnectedOutLayers_Async'); + late final _Net_GetUnconnectedOutLayers_Async = + _Net_GetUnconnectedOutLayers_AsyncPtr.asFunction< + ffi.Pointer Function(Net, CvCallback_1)>(); + ffi.Pointer Net_ImagesFromBlob( Mat blob, ffi.Pointer rval, @@ -12584,6 +18889,23 @@ class CvNative { late final _Net_ImagesFromBlob = _Net_ImagesFromBlobPtr.asFunction< ffi.Pointer Function(Mat, ffi.Pointer)>(); + ffi.Pointer Net_ImagesFromBlob_Async( + Mat blob, + CvCallback_1 callback, + ) { + return _Net_ImagesFromBlob_Async( + blob, + callback, + ); + } + + late final _Net_ImagesFromBlob_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Mat, CvCallback_1)>>( + 'Net_ImagesFromBlob_Async'); + late final _Net_ImagesFromBlob_Async = _Net_ImagesFromBlob_AsyncPtr + .asFunction Function(Mat, CvCallback_1)>(); + ffi.Pointer Net_ReadNet( ffi.Pointer model, ffi.Pointer config, @@ -12631,6 +18953,28 @@ class CvNative { ffi.Pointer Function( ffi.Pointer, VecUChar, VecUChar, ffi.Pointer)>(); + ffi.Pointer Net_ReadNetBytes_Async( + ffi.Pointer framework, + VecUChar model, + VecUChar config, + CvCallback_1 callback, + ) { + return _Net_ReadNetBytes_Async( + framework, + model, + config, + callback, + ); + } + + late final _Net_ReadNetBytes_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, VecUChar, + VecUChar, CvCallback_1)>>('Net_ReadNetBytes_Async'); + late final _Net_ReadNetBytes_Async = _Net_ReadNetBytes_AsyncPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, VecUChar, VecUChar, CvCallback_1)>(); + ffi.Pointer Net_ReadNetFromCaffe( ffi.Pointer prototxt, ffi.Pointer caffeModel, @@ -12674,6 +19018,49 @@ class CvNative { ffi.Pointer Function( VecUChar, VecUChar, ffi.Pointer)>(); + ffi.Pointer Net_ReadNetFromCaffeBytes_Async( + VecUChar prototxt, + VecUChar caffeModel, + CvCallback_1 callback, + ) { + return _Net_ReadNetFromCaffeBytes_Async( + prototxt, + caffeModel, + callback, + ); + } + + late final _Net_ReadNetFromCaffeBytes_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecUChar, VecUChar, + CvCallback_1)>>('Net_ReadNetFromCaffeBytes_Async'); + late final _Net_ReadNetFromCaffeBytes_Async = + _Net_ReadNetFromCaffeBytes_AsyncPtr.asFunction< + ffi.Pointer Function(VecUChar, VecUChar, CvCallback_1)>(); + + ffi.Pointer Net_ReadNetFromCaffe_Async( + ffi.Pointer prototxt, + ffi.Pointer caffeModel, + CvCallback_1 callback, + ) { + return _Net_ReadNetFromCaffe_Async( + prototxt, + caffeModel, + callback, + ); + } + + late final _Net_ReadNetFromCaffe_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + CvCallback_1)>>('Net_ReadNetFromCaffe_Async'); + late final _Net_ReadNetFromCaffe_Async = + _Net_ReadNetFromCaffe_AsyncPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer, CvCallback_1)>(); + ffi.Pointer Net_ReadNetFromONNX( ffi.Pointer model, ffi.Pointer rval, @@ -12709,6 +19096,43 @@ class CvNative { late final _Net_ReadNetFromONNXBytes = _Net_ReadNetFromONNXBytesPtr .asFunction Function(VecUChar, ffi.Pointer)>(); + ffi.Pointer Net_ReadNetFromONNXBytes_Async( + VecUChar model, + CvCallback_1 callback, + ) { + return _Net_ReadNetFromONNXBytes_Async( + model, + callback, + ); + } + + late final _Net_ReadNetFromONNXBytes_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecUChar, CvCallback_1)>>('Net_ReadNetFromONNXBytes_Async'); + late final _Net_ReadNetFromONNXBytes_Async = + _Net_ReadNetFromONNXBytes_AsyncPtr.asFunction< + ffi.Pointer Function(VecUChar, CvCallback_1)>(); + + ffi.Pointer Net_ReadNetFromONNX_Async( + ffi.Pointer model, + CvCallback_1 callback, + ) { + return _Net_ReadNetFromONNX_Async( + model, + callback, + ); + } + + late final _Net_ReadNetFromONNX_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + CvCallback_1)>>('Net_ReadNetFromONNX_Async'); + late final _Net_ReadNetFromONNX_Async = + _Net_ReadNetFromONNX_AsyncPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, CvCallback_1)>(); + ffi.Pointer Net_ReadNetFromTFLite( ffi.Pointer model, ffi.Pointer rval, @@ -12744,6 +19168,43 @@ class CvNative { late final _Net_ReadNetFromTFLiteBytes = _Net_ReadNetFromTFLiteBytesPtr .asFunction Function(VecUChar, ffi.Pointer)>(); + ffi.Pointer Net_ReadNetFromTFLiteBytes_Async( + VecUChar bufferModel, + CvCallback_1 callback, + ) { + return _Net_ReadNetFromTFLiteBytes_Async( + bufferModel, + callback, + ); + } + + late final _Net_ReadNetFromTFLiteBytes_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecUChar, CvCallback_1)>>('Net_ReadNetFromTFLiteBytes_Async'); + late final _Net_ReadNetFromTFLiteBytes_Async = + _Net_ReadNetFromTFLiteBytes_AsyncPtr.asFunction< + ffi.Pointer Function(VecUChar, CvCallback_1)>(); + + ffi.Pointer Net_ReadNetFromTFLite_Async( + ffi.Pointer model, + CvCallback_1 callback, + ) { + return _Net_ReadNetFromTFLite_Async( + model, + callback, + ); + } + + late final _Net_ReadNetFromTFLite_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + CvCallback_1)>>('Net_ReadNetFromTFLite_Async'); + late final _Net_ReadNetFromTFLite_Async = + _Net_ReadNetFromTFLite_AsyncPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, CvCallback_1)>(); + ffi.Pointer Net_ReadNetFromTensorflow( ffi.Pointer model, ffi.Pointer config, @@ -12788,6 +19249,49 @@ class CvNative { ffi.Pointer Function( VecUChar, VecUChar, ffi.Pointer)>(); + ffi.Pointer Net_ReadNetFromTensorflowBytes_Async( + VecUChar model, + VecUChar config, + CvCallback_1 callback, + ) { + return _Net_ReadNetFromTensorflowBytes_Async( + model, + config, + callback, + ); + } + + late final _Net_ReadNetFromTensorflowBytes_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecUChar, VecUChar, + CvCallback_1)>>('Net_ReadNetFromTensorflowBytes_Async'); + late final _Net_ReadNetFromTensorflowBytes_Async = + _Net_ReadNetFromTensorflowBytes_AsyncPtr.asFunction< + ffi.Pointer Function(VecUChar, VecUChar, CvCallback_1)>(); + + ffi.Pointer Net_ReadNetFromTensorflow_Async( + ffi.Pointer model, + ffi.Pointer config, + CvCallback_1 callback, + ) { + return _Net_ReadNetFromTensorflow_Async( + model, + config, + callback, + ); + } + + late final _Net_ReadNetFromTensorflow_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + CvCallback_1)>>('Net_ReadNetFromTensorflow_Async'); + late final _Net_ReadNetFromTensorflow_Async = + _Net_ReadNetFromTensorflow_AsyncPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer, CvCallback_1)>(); + ffi.Pointer Net_ReadNetFromTorch( ffi.Pointer model, bool isBinary, @@ -12810,6 +19314,54 @@ class CvNative { ffi.Pointer Function( ffi.Pointer, bool, bool, ffi.Pointer)>(); + ffi.Pointer Net_ReadNetFromTorch_Async( + ffi.Pointer model, + bool isBinary, + bool evaluate, + CvCallback_1 callback, + ) { + return _Net_ReadNetFromTorch_Async( + model, + isBinary, + evaluate, + callback, + ); + } + + late final _Net_ReadNetFromTorch_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Bool, + ffi.Bool, CvCallback_1)>>('Net_ReadNetFromTorch_Async'); + late final _Net_ReadNetFromTorch_Async = + _Net_ReadNetFromTorch_AsyncPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, bool, bool, CvCallback_1)>(); + + ffi.Pointer Net_ReadNet_Async( + ffi.Pointer model, + ffi.Pointer config, + ffi.Pointer framework, + CvCallback_1 callback, + ) { + return _Net_ReadNet_Async( + model, + config, + framework, + callback, + ); + } + + late final _Net_ReadNet_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + CvCallback_1)>>('Net_ReadNet_Async'); + late final _Net_ReadNet_Async = _Net_ReadNet_AsyncPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer, CvCallback_1)>(); + ffi.Pointer Net_SetInput( Net net, Mat blob, @@ -12829,6 +19381,28 @@ class CvNative { late final _Net_SetInput = _Net_SetInputPtr.asFunction< ffi.Pointer Function(Net, Mat, ffi.Pointer)>(); + ffi.Pointer Net_SetInput_Async( + Net net, + Mat blob, + ffi.Pointer name, + CvCallback_0 callback, + ) { + return _Net_SetInput_Async( + net, + blob, + name, + callback, + ); + } + + late final _Net_SetInput_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Net, Mat, ffi.Pointer, + CvCallback_0)>>('Net_SetInput_Async'); + late final _Net_SetInput_Async = _Net_SetInput_AsyncPtr.asFunction< + ffi.Pointer Function( + Net, Mat, ffi.Pointer, CvCallback_0)>(); + ffi.Pointer Net_SetPreferableBackend( Net net, int backend, @@ -12845,6 +19419,26 @@ class CvNative { late final _Net_SetPreferableBackend = _Net_SetPreferableBackendPtr .asFunction Function(Net, int)>(); + ffi.Pointer Net_SetPreferableBackend_Async( + Net net, + int backend, + CvCallback_0 callback, + ) { + return _Net_SetPreferableBackend_Async( + net, + backend, + callback, + ); + } + + late final _Net_SetPreferableBackend_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Net, ffi.Int, CvCallback_0)>>('Net_SetPreferableBackend_Async'); + late final _Net_SetPreferableBackend_Async = + _Net_SetPreferableBackend_AsyncPtr.asFunction< + ffi.Pointer Function(Net, int, CvCallback_0)>(); + ffi.Pointer Net_SetPreferableTarget( Net net, int target, @@ -12861,15 +19455,34 @@ class CvNative { late final _Net_SetPreferableTarget = _Net_SetPreferableTargetPtr.asFunction< ffi.Pointer Function(Net, int)>(); - ffi.Pointer Net_forwardAsync( + ffi.Pointer Net_SetPreferableTarget_Async( Net net, - ffi.Pointer outputName, - ffi.Pointer rval, + int target, + CvCallback_0 callback, ) { - return _Net_forwardAsync( + return _Net_SetPreferableTarget_Async( net, - outputName, - rval, + target, + callback, + ); + } + + late final _Net_SetPreferableTarget_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Net, ffi.Int, CvCallback_0)>>('Net_SetPreferableTarget_Async'); + late final _Net_SetPreferableTarget_Async = _Net_SetPreferableTarget_AsyncPtr + .asFunction Function(Net, int, CvCallback_0)>(); + + ffi.Pointer Net_forwardAsync( + Net net, + ffi.Pointer outputName, + ffi.Pointer rval, + ) { + return _Net_forwardAsync( + net, + outputName, + rval, ); } @@ -12933,6 +19546,23 @@ 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, ) { @@ -12990,6 +19620,64 @@ 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, @@ -13033,6 +19721,47 @@ 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, @@ -13079,6 +19808,30 @@ class CvNative { late final _PencilSketch = _PencilSketchPtr.asFunction< ffi.Pointer Function(Mat, Mat, Mat, double, double, double)>(); + ffi.Pointer PencilSketch_Async( + Mat src, + double sigma_s, + double sigma_r, + double shade_factor, + CvCallback_2 callback, + ) { + return _PencilSketch_Async( + src, + sigma_s, + sigma_r, + shade_factor, + callback, + ); + } + + late final _PencilSketch_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, ffi.Float, ffi.Float, ffi.Float, + CvCallback_2)>>('PencilSketch_Async'); + late final _PencilSketch_Async = _PencilSketch_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, double, double, double, CvCallback_2)>(); + ffi.Pointer PhaseCorrelate( Mat src1, Mat src2, @@ -13103,6 +19856,27 @@ class CvNative { ffi.Pointer Function( Mat, Mat, Mat, ffi.Pointer, ffi.Pointer)>(); + ffi.Pointer PhaseCorrelate_Async( + Mat src1, + Mat src2, + Mat window, + CvCallback_2 callback, + ) { + return _PhaseCorrelate_Async( + src1, + src2, + window, + callback, + ); + } + + late final _PhaseCorrelate_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, Mat, CvCallback_2)>>('PhaseCorrelate_Async'); + late final _PhaseCorrelate_Async = _PhaseCorrelate_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, CvCallback_2)>(); + ffi.Pointer PhotoInpaint( Mat src, Mat mask, @@ -13126,6 +19900,29 @@ class CvNative { late final _PhotoInpaint = _PhotoInpaintPtr.asFunction< ffi.Pointer Function(Mat, Mat, Mat, double, int)>(); + ffi.Pointer PhotoInpaint_Async( + Mat src, + Mat mask, + double inpaint_radius, + int algorithm_type, + CvCallback_1 callback, + ) { + return _PhotoInpaint_Async( + src, + mask, + inpaint_radius, + algorithm_type, + callback, + ); + } + + late final _PhotoInpaint_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, ffi.Float, ffi.Int, + CvCallback_1)>>('PhotoInpaint_Async'); + late final _PhotoInpaint_Async = _PhotoInpaint_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, double, int, CvCallback_1)>(); + ffi.Pointer PointPolygonTest( VecPoint pts, Point2f pt, @@ -13148,6 +19945,27 @@ class CvNative { ffi.Pointer Function( VecPoint, Point2f, bool, ffi.Pointer)>(); + ffi.Pointer PointPolygonTest_Async( + VecPoint pts, + Point2f pt, + bool measureDist, + CvCallback_1 callback, + ) { + return _PointPolygonTest_Async( + pts, + pt, + measureDist, + callback, + ); + } + + late final _PointPolygonTest_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecPoint, Point2f, ffi.Bool, + CvCallback_1)>>('PointPolygonTest_Async'); + late final _PointPolygonTest_Async = _PointPolygonTest_AsyncPtr.asFunction< + ffi.Pointer Function(VecPoint, Point2f, bool, CvCallback_1)>(); + ffi.Pointer Polylines( Mat img, VecVecPoint points, @@ -13171,5561 +19989,13448 @@ class CvNative { late final _Polylines = _PolylinesPtr.asFunction< ffi.Pointer Function(Mat, VecVecPoint, bool, Scalar, int)>(); - ffi.Pointer PutText( + ffi.Pointer Polylines_Async( Mat img, - ffi.Pointer text, - Point org, - int fontFace, - double fontScale, + VecVecPoint points, + bool isClosed, Scalar color, int thickness, + CvCallback_0 callback, ) { - return _PutText( + return _Polylines_Async( img, - text, - org, - fontFace, - fontScale, + points, + isClosed, color, thickness, + callback, ); } - late final _PutTextPtr = _lookup< + late final _Polylines_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Mat, ffi.Pointer, Point, - ffi.Int, ffi.Double, Scalar, ffi.Int)>>('PutText'); - late final _PutText = _PutTextPtr.asFunction< + ffi.Pointer Function(Mat, VecVecPoint, ffi.Bool, Scalar, + ffi.Int, CvCallback_0)>>('Polylines_Async'); + late final _Polylines_Async = _Polylines_AsyncPtr.asFunction< ffi.Pointer Function( - Mat, ffi.Pointer, Point, int, double, Scalar, int)>(); + Mat, VecVecPoint, bool, Scalar, int, CvCallback_0)>(); - ffi.Pointer PutTextWithParams( - Mat img, - ffi.Pointer text, - Point org, - int fontFace, - double fontScale, + ffi.Pointer Prim_from_Circle( + Point center, Scalar color, - int thickness, - int lineType, - bool bottomLeftOrigin, + int lt, + int radius, + int shift, + int thick, + ffi.Pointer rval, ) { - return _PutTextWithParams( - img, - text, - org, - fontFace, - fontScale, + return _Prim_from_Circle( + center, color, - thickness, - lineType, - bottomLeftOrigin, + lt, + radius, + shift, + thick, + rval, ); } - late final _PutTextWithParamsPtr = _lookup< + late final _Prim_from_CirclePtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - Mat, - ffi.Pointer, - Point, - ffi.Int, - ffi.Double, - Scalar, - ffi.Int, - ffi.Int, - ffi.Bool)>>('PutTextWithParams'); - late final _PutTextWithParams = _PutTextWithParamsPtr.asFunction< - ffi.Pointer Function(Mat, ffi.Pointer, Point, int, - double, Scalar, int, int, bool)>(); + ffi.Pointer Function(Point, Scalar, ffi.Int, ffi.Int, + ffi.Int, ffi.Int, ffi.Pointer)>>('Prim_from_Circle'); + late final _Prim_from_Circle = _Prim_from_CirclePtr.asFunction< + ffi.Pointer Function( + Point, Scalar, int, int, int, int, ffi.Pointer)>(); - ffi.Pointer PyrDown( - Mat src, - Mat dst, - Size dstsize, - int borderType, + ffi.Pointer Prim_from_FText( + ffi.Pointer text, + int text_len, + Point org, + int fh, + Scalar color, + ffi.Pointer rval, ) { - return _PyrDown( - src, - dst, - dstsize, - borderType, + return _Prim_from_FText( + text, + text_len, + org, + fh, + color, + rval, ); } - late final _PyrDownPtr = _lookup< + late final _Prim_from_FTextPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Mat, Mat, Size, ffi.Int)>>('PyrDown'); - late final _PyrDown = _PyrDownPtr.asFunction< - ffi.Pointer Function(Mat, Mat, Size, int)>(); + ffi.Pointer Function(ffi.Pointer, ffi.Int, Point, + ffi.Int, Scalar, ffi.Pointer)>>('Prim_from_FText'); + late final _Prim_from_FText = _Prim_from_FTextPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, Point, int, Scalar, ffi.Pointer)>(); - ffi.Pointer PyrUp( - Mat src, - Mat dst, - Size dstsize, - int borderType, + ffi.Pointer Prim_from_Image( + Point org, + Mat img, + Mat alpha, + ffi.Pointer rval, ) { - return _PyrUp( - src, - dst, - dstsize, - borderType, + return _Prim_from_Image( + org, + img, + alpha, + rval, ); } - late final _PyrUpPtr = _lookup< + late final _Prim_from_ImagePtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Mat, Mat, Size, ffi.Int)>>('PyrUp'); - late final _PyrUp = _PyrUpPtr.asFunction< - ffi.Pointer Function(Mat, Mat, Size, int)>(); + ffi.Pointer Function( + Point, Mat, Mat, ffi.Pointer)>>('Prim_from_Image'); + late final _Prim_from_Image = _Prim_from_ImagePtr.asFunction< + ffi.Pointer Function(Point, Mat, Mat, ffi.Pointer)>(); - void QRCodeDetector_Close( - QRCodeDetectorPtr self, + ffi.Pointer Prim_from_Line( + Scalar color, + int lt, + Point pt1, + Point pt2, + int shift, + int thick, + ffi.Pointer rval, ) { - return _QRCodeDetector_Close( - self, + return _Prim_from_Line( + color, + lt, + pt1, + pt2, + shift, + thick, + rval, ); } - late final _QRCodeDetector_ClosePtr = - _lookup>( - 'QRCodeDetector_Close'); - late final _QRCodeDetector_Close = - _QRCodeDetector_ClosePtr.asFunction(); + late final _Prim_from_LinePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Scalar, ffi.Int, Point, Point, ffi.Int, + ffi.Int, ffi.Pointer)>>('Prim_from_Line'); + late final _Prim_from_Line = _Prim_from_LinePtr.asFunction< + ffi.Pointer Function( + Scalar, int, Point, Point, int, int, ffi.Pointer)>(); - ffi.Pointer QRCodeDetector_Decode( - QRCodeDetector self, - Mat input, - ffi.Pointer points, - Mat straight_qrcode, - ffi.Pointer> rval, + ffi.Pointer Prim_from_Mosaic( + int cellSz, + int decim, + Rect mos, + ffi.Pointer rval, ) { - return _QRCodeDetector_Decode( - self, - input, - points, - straight_qrcode, + return _Prim_from_Mosaic( + cellSz, + decim, + mos, rval, ); } - late final _QRCodeDetector_DecodePtr = _lookup< + late final _Prim_from_MosaicPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - QRCodeDetector, - Mat, - ffi.Pointer, - Mat, - ffi.Pointer>)>>('QRCodeDetector_Decode'); - late final _QRCodeDetector_Decode = _QRCodeDetector_DecodePtr.asFunction< - ffi.Pointer Function(QRCodeDetector, Mat, ffi.Pointer, - Mat, ffi.Pointer>)>(); + ffi.Int, ffi.Int, Rect, ffi.Pointer)>>('Prim_from_Mosaic'); + late final _Prim_from_Mosaic = _Prim_from_MosaicPtr.asFunction< + ffi.Pointer Function(int, int, Rect, ffi.Pointer)>(); - ffi.Pointer QRCodeDetector_Detect( - QRCodeDetector self, - Mat input, - ffi.Pointer points, - ffi.Pointer rval, + ffi.Pointer Prim_from_Poly( + VecPoint points, + Scalar color, + int thick, + int lt, + int shift, + ffi.Pointer rval, ) { - return _QRCodeDetector_Detect( - self, - input, + return _Prim_from_Poly( points, + color, + thick, + lt, + shift, rval, ); } - late final _QRCodeDetector_DetectPtr = _lookup< + late final _Prim_from_PolyPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - QRCodeDetector, - Mat, - ffi.Pointer, - ffi.Pointer)>>('QRCodeDetector_Detect'); - late final _QRCodeDetector_Detect = _QRCodeDetector_DetectPtr.asFunction< + ffi.Pointer Function(VecPoint, Scalar, ffi.Int, ffi.Int, + ffi.Int, ffi.Pointer)>>('Prim_from_Poly'); + late final _Prim_from_Poly = _Prim_from_PolyPtr.asFunction< ffi.Pointer Function( - QRCodeDetector, Mat, ffi.Pointer, ffi.Pointer)>(); + VecPoint, Scalar, int, int, int, ffi.Pointer)>(); - ffi.Pointer QRCodeDetector_DetectAndDecode( - QRCodeDetector self, - Mat input, - ffi.Pointer points, - ffi.Pointer straight_qrcode, - ffi.Pointer> rval, + ffi.Pointer Prim_from_Rect( + Scalar color, + int lt, + Rect rect, + int shift, + int thick, + ffi.Pointer rval, ) { - return _QRCodeDetector_DetectAndDecode( - self, - input, - points, - straight_qrcode, + return _Prim_from_Rect( + color, + lt, + rect, + shift, + thick, rval, ); } - late final _QRCodeDetector_DetectAndDecodePtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - QRCodeDetector, - Mat, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>( - 'QRCodeDetector_DetectAndDecode'); - late final _QRCodeDetector_DetectAndDecode = - _QRCodeDetector_DetectAndDecodePtr.asFunction< - ffi.Pointer Function( - QRCodeDetector, - Mat, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); + late final _Prim_from_RectPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Scalar, ffi.Int, Rect, ffi.Int, + ffi.Int, ffi.Pointer)>>('Prim_from_Rect'); + late final _Prim_from_Rect = _Prim_from_RectPtr.asFunction< + ffi.Pointer Function( + Scalar, int, Rect, int, int, ffi.Pointer)>(); - ffi.Pointer QRCodeDetector_DetectAndDecodeMulti( - QRCodeDetector self, - Mat input, - ffi.Pointer decoded, - ffi.Pointer points, - ffi.Pointer straight_code, - ffi.Pointer rval, + ffi.Pointer Prim_from_Text( + bool bottom_left_origin, + Scalar color, + int ff, + double fs, + int lt, + Point org, + ffi.Pointer text, + int text_len, + int thick, + ffi.Pointer rval, ) { - return _QRCodeDetector_DetectAndDecodeMulti( - self, - input, - decoded, - points, - straight_code, + return _Prim_from_Text( + bottom_left_origin, + color, + ff, + fs, + lt, + org, + text, + text_len, + thick, rval, ); } - late final _QRCodeDetector_DetectAndDecodeMultiPtr = _lookup< + late final _Prim_from_TextPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - QRCodeDetector, - Mat, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>('QRCodeDetector_DetectAndDecodeMulti'); - late final _QRCodeDetector_DetectAndDecodeMulti = - _QRCodeDetector_DetectAndDecodeMultiPtr.asFunction< - ffi.Pointer Function( - QRCodeDetector, - Mat, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); + ffi.Bool, + Scalar, + ffi.Int, + ffi.Double, + ffi.Int, + Point, + ffi.Pointer, + ffi.Int, + ffi.Int, + ffi.Pointer)>>('Prim_from_Text'); + late final _Prim_from_Text = _Prim_from_TextPtr.asFunction< + ffi.Pointer Function(bool, Scalar, int, double, int, Point, + ffi.Pointer, int, int, ffi.Pointer)>(); - ffi.Pointer QRCodeDetector_DetectMulti( - QRCodeDetector self, - Mat input, - ffi.Pointer points, - ffi.Pointer rval, + ffi.Pointer PutText( + Mat img, + ffi.Pointer text, + Point org, + int fontFace, + double fontScale, + Scalar color, + int thickness, ) { - return _QRCodeDetector_DetectMulti( - self, - input, - points, - rval, + return _PutText( + img, + text, + org, + fontFace, + fontScale, + color, + thickness, ); } - late final _QRCodeDetector_DetectMultiPtr = _lookup< + late final _PutTextPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - QRCodeDetector, - Mat, - ffi.Pointer, - ffi.Pointer)>>('QRCodeDetector_DetectMulti'); - late final _QRCodeDetector_DetectMulti = - _QRCodeDetector_DetectMultiPtr.asFunction< - ffi.Pointer Function(QRCodeDetector, Mat, - ffi.Pointer, ffi.Pointer)>(); + ffi.Pointer Function(Mat, ffi.Pointer, Point, + ffi.Int, ffi.Double, Scalar, ffi.Int)>>('PutText'); + late final _PutText = _PutTextPtr.asFunction< + ffi.Pointer Function( + Mat, ffi.Pointer, Point, int, double, Scalar, int)>(); - ffi.Pointer QRCodeDetector_New( - ffi.Pointer rval, + ffi.Pointer PutTextWithParams( + Mat img, + ffi.Pointer text, + Point org, + int fontFace, + double fontScale, + Scalar color, + int thickness, + int lineType, + bool bottomLeftOrigin, ) { - return _QRCodeDetector_New( - rval, + return _PutTextWithParams( + img, + text, + org, + fontFace, + fontScale, + color, + thickness, + lineType, + bottomLeftOrigin, ); } - late final _QRCodeDetector_NewPtr = _lookup< + late final _PutTextWithParamsPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer)>>('QRCodeDetector_New'); - late final _QRCodeDetector_New = _QRCodeDetector_NewPtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + Mat, + ffi.Pointer, + Point, + ffi.Int, + ffi.Double, + Scalar, + ffi.Int, + ffi.Int, + ffi.Bool)>>('PutTextWithParams'); + late final _PutTextWithParams = _PutTextWithParamsPtr.asFunction< + ffi.Pointer Function(Mat, ffi.Pointer, Point, int, + double, Scalar, int, int, bool)>(); - ffi.Pointer QRCodeDetector_decodeCurved( - QRCodeDetector self, + ffi.Pointer PutTextWithParams_Async( Mat img, - VecPoint points, - ffi.Pointer straight_qrcode, - ffi.Pointer> rval, + ffi.Pointer text, + Point org, + int fontFace, + double fontScale, + Scalar color, + int thickness, + int lineType, + bool bottomLeftOrigin, + CvCallback_0 callback, ) { - return _QRCodeDetector_decodeCurved( - self, + return _PutTextWithParams_Async( img, - points, - straight_qrcode, - rval, + text, + org, + fontFace, + fontScale, + color, + thickness, + lineType, + bottomLeftOrigin, + callback, ); } - late final _QRCodeDetector_decodeCurvedPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(QRCodeDetector, Mat, VecPoint, - ffi.Pointer, ffi.Pointer>)>>( - 'QRCodeDetector_decodeCurved'); - late final _QRCodeDetector_decodeCurved = - _QRCodeDetector_decodeCurvedPtr.asFunction< - ffi.Pointer Function(QRCodeDetector, Mat, VecPoint, - ffi.Pointer, ffi.Pointer>)>(); + late final _PutTextWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, + ffi.Pointer, + Point, + ffi.Int, + ffi.Double, + Scalar, + ffi.Int, + ffi.Int, + ffi.Bool, + CvCallback_0)>>('PutTextWithParams_Async'); + late final _PutTextWithParams_Async = _PutTextWithParams_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, ffi.Pointer, Point, int, + double, Scalar, int, int, bool, CvCallback_0)>(); - ffi.Pointer QRCodeDetector_detectAndDecodeCurved( - QRCodeDetector self, + ffi.Pointer PutText_Async( Mat img, - ffi.Pointer points, - ffi.Pointer straight_qrcode, - ffi.Pointer> rval, + ffi.Pointer text, + Point org, + int fontFace, + double fontScale, + Scalar color, + int thickness, + CvCallback_0 callback, ) { - return _QRCodeDetector_detectAndDecodeCurved( - self, + return _PutText_Async( img, - points, - straight_qrcode, - rval, + text, + org, + fontFace, + fontScale, + color, + thickness, + callback, ); } - late final _QRCodeDetector_detectAndDecodeCurvedPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - QRCodeDetector, - Mat, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>>( - 'QRCodeDetector_detectAndDecodeCurved'); - late final _QRCodeDetector_detectAndDecodeCurved = - _QRCodeDetector_detectAndDecodeCurvedPtr.asFunction< + late final _PutText_AsyncPtr = _lookup< + ffi.NativeFunction< ffi.Pointer Function( - QRCodeDetector, Mat, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer>)>(); + ffi.Pointer, + Point, + ffi.Int, + ffi.Double, + Scalar, + ffi.Int, + CvCallback_0)>>('PutText_Async'); + late final _PutText_Async = _PutText_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, ffi.Pointer, Point, int, + double, Scalar, int, CvCallback_0)>(); - ffi.Pointer QRCodeDetector_setEpsX( - QRCodeDetector self, - double epsX, + ffi.Pointer PyrDown( + Mat src, + Mat dst, + Size dstsize, + int borderType, ) { - return _QRCodeDetector_setEpsX( - self, - epsX, + return _PyrDown( + src, + dst, + dstsize, + borderType, ); } - late final _QRCodeDetector_setEpsXPtr = _lookup< + late final _PyrDownPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - QRCodeDetector, ffi.Double)>>('QRCodeDetector_setEpsX'); - late final _QRCodeDetector_setEpsX = _QRCodeDetector_setEpsXPtr.asFunction< - ffi.Pointer Function(QRCodeDetector, double)>(); + ffi.Pointer Function(Mat, Mat, Size, ffi.Int)>>('PyrDown'); + late final _PyrDown = _PyrDownPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Size, int)>(); - ffi.Pointer QRCodeDetector_setEpsY( - QRCodeDetector self, - double epsY, + ffi.Pointer PyrDown_Async( + Mat src, + Size dstsize, + int borderType, + CvCallback_1 callback, ) { - return _QRCodeDetector_setEpsY( - self, - epsY, + return _PyrDown_Async( + src, + dstsize, + borderType, + callback, ); } - late final _QRCodeDetector_setEpsYPtr = _lookup< + late final _PyrDown_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - QRCodeDetector, ffi.Double)>>('QRCodeDetector_setEpsY'); - late final _QRCodeDetector_setEpsY = _QRCodeDetector_setEpsYPtr.asFunction< - ffi.Pointer Function(QRCodeDetector, double)>(); + Mat, Size, ffi.Int, CvCallback_1)>>('PyrDown_Async'); + late final _PyrDown_Async = _PyrDown_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Size, int, CvCallback_1)>(); - ffi.Pointer QRCodeDetector_setUseAlignmentMarkers( - QRCodeDetector self, - bool useAlignmentMarkers, + ffi.Pointer PyrUp( + Mat src, + Mat dst, + Size dstsize, + int borderType, ) { - return _QRCodeDetector_setUseAlignmentMarkers( - self, - useAlignmentMarkers, + return _PyrUp( + src, + dst, + dstsize, + borderType, ); } - late final _QRCodeDetector_setUseAlignmentMarkersPtr = _lookup< + late final _PyrUpPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(QRCodeDetector, - ffi.Bool)>>('QRCodeDetector_setUseAlignmentMarkers'); - late final _QRCodeDetector_setUseAlignmentMarkers = - _QRCodeDetector_setUseAlignmentMarkersPtr.asFunction< - ffi.Pointer Function(QRCodeDetector, bool)>(); + ffi.Pointer Function(Mat, Mat, Size, ffi.Int)>>('PyrUp'); + late final _PyrUp = _PyrUpPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Size, int)>(); - ffi.Pointer RNG_Fill( - RNG rng, - Mat mat, - int distType, - double a, - double b, - bool saturateRange, + ffi.Pointer PyrUp_Async( + Mat src, + Size dstsize, + int borderType, + CvCallback_1 callback, ) { - return _RNG_Fill( - rng, - mat, - distType, - a, - b, - saturateRange, + return _PyrUp_Async( + src, + dstsize, + borderType, + callback, ); } - late final _RNG_FillPtr = _lookup< + late final _PyrUp_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(RNG, Mat, ffi.Int, ffi.Double, - ffi.Double, ffi.Bool)>>('RNG_Fill'); - late final _RNG_Fill = _RNG_FillPtr.asFunction< - ffi.Pointer Function(RNG, Mat, int, double, double, bool)>(); + ffi.Pointer Function( + Mat, Size, ffi.Int, CvCallback_1)>>('PyrUp_Async'); + late final _PyrUp_Async = _PyrUp_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Size, int, CvCallback_1)>(); - ffi.Pointer RNG_Gaussian( - RNG rng, - double sigma, - ffi.Pointer rval, + void QRCodeDetector_Close( + QRCodeDetectorPtr self, ) { - return _RNG_Gaussian( - rng, - sigma, - rval, + return _QRCodeDetector_Close( + self, ); } - late final _RNG_GaussianPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - RNG, ffi.Double, ffi.Pointer)>>('RNG_Gaussian'); - late final _RNG_Gaussian = _RNG_GaussianPtr.asFunction< - ffi.Pointer Function(RNG, double, ffi.Pointer)>(); + late final _QRCodeDetector_ClosePtr = + _lookup>( + 'QRCodeDetector_Close'); + late final _QRCodeDetector_Close = + _QRCodeDetector_ClosePtr.asFunction(); - ffi.Pointer RNG_Next( - RNG rng, - ffi.Pointer rval, + ffi.Pointer QRCodeDetector_Decode( + QRCodeDetector self, + Mat input, + ffi.Pointer points, + Mat straight_qrcode, + ffi.Pointer> rval, ) { - return _RNG_Next( - rng, + return _QRCodeDetector_Decode( + self, + input, + points, + straight_qrcode, rval, ); } - late final _RNG_NextPtr = _lookup< + late final _QRCodeDetector_DecodePtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - RNG, ffi.Pointer)>>('RNG_Next'); - late final _RNG_Next = _RNG_NextPtr.asFunction< - ffi.Pointer Function(RNG, ffi.Pointer)>(); + QRCodeDetector, + Mat, + ffi.Pointer, + Mat, + ffi.Pointer>)>>('QRCodeDetector_Decode'); + late final _QRCodeDetector_Decode = _QRCodeDetector_DecodePtr.asFunction< + ffi.Pointer Function(QRCodeDetector, Mat, ffi.Pointer, + Mat, ffi.Pointer>)>(); - ffi.Pointer RNG_Uniform( - RNG rng, - int a, - int b, - ffi.Pointer rval, + ffi.Pointer QRCodeDetector_Decode_Async( + QRCodeDetector self, + Mat input, + CvCallback_3 callback, ) { - return _RNG_Uniform( - rng, - a, - b, - rval, + return _QRCodeDetector_Decode_Async( + self, + input, + callback, ); } - late final _RNG_UniformPtr = _lookup< + late final _QRCodeDetector_Decode_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - RNG, ffi.Int, ffi.Int, ffi.Pointer)>>('RNG_Uniform'); - late final _RNG_Uniform = _RNG_UniformPtr.asFunction< - ffi.Pointer Function(RNG, int, int, ffi.Pointer)>(); + ffi.Pointer Function(QRCodeDetector, Mat, + CvCallback_3)>>('QRCodeDetector_Decode_Async'); + late final _QRCodeDetector_Decode_Async = + _QRCodeDetector_Decode_AsyncPtr.asFunction< + ffi.Pointer Function(QRCodeDetector, Mat, CvCallback_3)>(); - ffi.Pointer RNG_UniformDouble( - RNG rng, - double a, - double b, - ffi.Pointer rval, + ffi.Pointer QRCodeDetector_Detect( + QRCodeDetector self, + Mat input, + ffi.Pointer points, + ffi.Pointer rval, ) { - return _RNG_UniformDouble( - rng, - a, - b, + return _QRCodeDetector_Detect( + self, + input, + points, rval, ); } - late final _RNG_UniformDoublePtr = _lookup< + late final _QRCodeDetector_DetectPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(RNG, ffi.Double, ffi.Double, - ffi.Pointer)>>('RNG_UniformDouble'); - late final _RNG_UniformDouble = _RNG_UniformDoublePtr.asFunction< - ffi.Pointer Function( - RNG, double, double, ffi.Pointer)>(); - - ffi.Pointer RandN( - Mat mat, - Scalar mean, - Scalar stddev, + ffi.Pointer Function( + QRCodeDetector, + Mat, + ffi.Pointer, + ffi.Pointer)>>('QRCodeDetector_Detect'); + late final _QRCodeDetector_Detect = _QRCodeDetector_DetectPtr.asFunction< + ffi.Pointer Function( + QRCodeDetector, Mat, ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer QRCodeDetector_DetectAndDecode( + QRCodeDetector self, + Mat input, + ffi.Pointer points, + ffi.Pointer straight_qrcode, + ffi.Pointer> rval, ) { - return _RandN( - mat, - mean, - stddev, + return _QRCodeDetector_DetectAndDecode( + self, + input, + points, + straight_qrcode, + rval, ); } - late final _RandNPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(Mat, Scalar, Scalar)>>('RandN'); - late final _RandN = _RandNPtr.asFunction< - ffi.Pointer Function(Mat, Scalar, Scalar)>(); + late final _QRCodeDetector_DetectAndDecodePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + QRCodeDetector, + Mat, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>>( + 'QRCodeDetector_DetectAndDecode'); + late final _QRCodeDetector_DetectAndDecode = + _QRCodeDetector_DetectAndDecodePtr.asFunction< + ffi.Pointer Function( + QRCodeDetector, + Mat, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>(); - ffi.Pointer RandShuffle( - Mat mat, + ffi.Pointer QRCodeDetector_DetectAndDecodeMulti( + QRCodeDetector self, + Mat input, + ffi.Pointer decoded, + ffi.Pointer points, + ffi.Pointer straight_code, + ffi.Pointer rval, ) { - return _RandShuffle( - mat, + return _QRCodeDetector_DetectAndDecodeMulti( + self, + input, + decoded, + points, + straight_code, + rval, ); } - late final _RandShufflePtr = - _lookup Function(Mat)>>( - 'RandShuffle'); - late final _RandShuffle = - _RandShufflePtr.asFunction Function(Mat)>(); + late final _QRCodeDetector_DetectAndDecodeMultiPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + QRCodeDetector, + Mat, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>('QRCodeDetector_DetectAndDecodeMulti'); + late final _QRCodeDetector_DetectAndDecodeMulti = + _QRCodeDetector_DetectAndDecodeMultiPtr.asFunction< + ffi.Pointer Function( + QRCodeDetector, + Mat, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(); - ffi.Pointer RandShuffleWithParams( - Mat mat, - double iterFactor, - RNG rng, + ffi.Pointer QRCodeDetector_DetectAndDecodeMulti_Async( + QRCodeDetector self, + Mat input, + CvCallback_4 callback, ) { - return _RandShuffleWithParams( - mat, - iterFactor, - rng, + return _QRCodeDetector_DetectAndDecodeMulti_Async( + self, + input, + callback, ); } - late final _RandShuffleWithParamsPtr = _lookup< + late final _QRCodeDetector_DetectAndDecodeMulti_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - Mat, ffi.Double, RNG)>>('RandShuffleWithParams'); - late final _RandShuffleWithParams = _RandShuffleWithParamsPtr.asFunction< - ffi.Pointer Function(Mat, double, RNG)>(); + ffi.Pointer Function(QRCodeDetector, Mat, + CvCallback_4)>>('QRCodeDetector_DetectAndDecodeMulti_Async'); + late final _QRCodeDetector_DetectAndDecodeMulti_Async = + _QRCodeDetector_DetectAndDecodeMulti_AsyncPtr.asFunction< + ffi.Pointer Function(QRCodeDetector, Mat, CvCallback_4)>(); - ffi.Pointer RandU( - Mat mat, - Scalar low, - Scalar high, + ffi.Pointer QRCodeDetector_DetectAndDecode_Async( + QRCodeDetector self, + Mat input, + CvCallback_3 callback, ) { - return _RandU( - mat, - low, - high, + return _QRCodeDetector_DetectAndDecode_Async( + self, + input, + callback, ); } - late final _RandUPtr = _lookup< + late final _QRCodeDetector_DetectAndDecode_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Mat, Scalar, Scalar)>>('RandU'); - late final _RandU = _RandUPtr.asFunction< - ffi.Pointer Function(Mat, Scalar, Scalar)>(); + ffi.Pointer Function(QRCodeDetector, Mat, + CvCallback_3)>>('QRCodeDetector_DetectAndDecode_Async'); + late final _QRCodeDetector_DetectAndDecode_Async = + _QRCodeDetector_DetectAndDecode_AsyncPtr.asFunction< + ffi.Pointer Function(QRCodeDetector, Mat, CvCallback_3)>(); - ffi.Pointer Rectangle( - Mat img, - Rect rect, - Scalar color, - int thickness, + ffi.Pointer QRCodeDetector_DetectMulti( + QRCodeDetector self, + Mat input, + ffi.Pointer points, + ffi.Pointer rval, ) { - return _Rectangle( - img, - rect, - color, - thickness, + return _QRCodeDetector_DetectMulti( + self, + input, + points, + rval, ); } - late final _RectanglePtr = _lookup< + late final _QRCodeDetector_DetectMultiPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - Mat, Rect, Scalar, ffi.Int)>>('Rectangle'); - late final _Rectangle = _RectanglePtr.asFunction< - ffi.Pointer Function(Mat, Rect, Scalar, int)>(); + QRCodeDetector, + Mat, + ffi.Pointer, + ffi.Pointer)>>('QRCodeDetector_DetectMulti'); + late final _QRCodeDetector_DetectMulti = + _QRCodeDetector_DetectMultiPtr.asFunction< + ffi.Pointer Function(QRCodeDetector, Mat, + ffi.Pointer, ffi.Pointer)>(); - ffi.Pointer RectangleWithParams( - Mat img, - Rect rect, - Scalar color, - int thickness, - int lineType, - int shift, + ffi.Pointer QRCodeDetector_DetectMulti_Async( + QRCodeDetector self, + Mat input, + CvCallback_2 callback, ) { - return _RectangleWithParams( - img, - rect, - color, - thickness, - lineType, - shift, + return _QRCodeDetector_DetectMulti_Async( + self, + input, + callback, ); } - late final _RectangleWithParamsPtr = _lookup< + late final _QRCodeDetector_DetectMulti_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Mat, Rect, Scalar, ffi.Int, ffi.Int, - ffi.Int)>>('RectangleWithParams'); - late final _RectangleWithParams = _RectangleWithParamsPtr.asFunction< - ffi.Pointer Function(Mat, Rect, Scalar, int, int, int)>(); + ffi.Pointer Function(QRCodeDetector, Mat, + CvCallback_2)>>('QRCodeDetector_DetectMulti_Async'); + late final _QRCodeDetector_DetectMulti_Async = + _QRCodeDetector_DetectMulti_AsyncPtr.asFunction< + ffi.Pointer Function(QRCodeDetector, Mat, CvCallback_2)>(); - ffi.Pointer Remap( - Mat src, - Mat dst, - Mat map1, - Mat map2, - int interpolation, - int borderMode, - Scalar borderValue, + ffi.Pointer QRCodeDetector_Detect_Async( + QRCodeDetector self, + Mat input, + CvCallback_2 callback, ) { - return _Remap( - src, - dst, - map1, - map2, - interpolation, - borderMode, - borderValue, + return _QRCodeDetector_Detect_Async( + self, + input, + callback, ); } - late final _RemapPtr = _lookup< + late final _QRCodeDetector_Detect_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - Mat, Mat, Mat, Mat, ffi.Int, ffi.Int, Scalar)>>('Remap'); - late final _Remap = _RemapPtr.asFunction< - ffi.Pointer Function(Mat, Mat, Mat, Mat, int, int, Scalar)>(); + ffi.Pointer Function(QRCodeDetector, Mat, + CvCallback_2)>>('QRCodeDetector_Detect_Async'); + late final _QRCodeDetector_Detect_Async = + _QRCodeDetector_Detect_AsyncPtr.asFunction< + ffi.Pointer Function(QRCodeDetector, Mat, CvCallback_2)>(); - ffi.Pointer Resize( - Mat src, - Mat dst, - Size sz, - double fx, - double fy, - int interp, + ffi.Pointer QRCodeDetector_New( + ffi.Pointer rval, ) { - return _Resize( - src, - dst, - sz, - fx, - fy, - interp, + return _QRCodeDetector_New( + rval, ); } - late final _ResizePtr = _lookup< + late final _QRCodeDetector_NewPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - Mat, Mat, Size, ffi.Double, ffi.Double, ffi.Int)>>('Resize'); - late final _Resize = _ResizePtr.asFunction< - ffi.Pointer Function(Mat, Mat, Size, double, double, int)>(); + ffi.Pointer)>>('QRCodeDetector_New'); + late final _QRCodeDetector_New = _QRCodeDetector_NewPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); - void Rng_Close( - RNGPtr rng, + ffi.Pointer QRCodeDetector_New_Async( + CvCallback_1 callback, ) { - return _Rng_Close( - rng, + return _QRCodeDetector_New_Async( + callback, ); } - late final _Rng_ClosePtr = - _lookup>('Rng_Close'); - late final _Rng_Close = _Rng_ClosePtr.asFunction(); + late final _QRCodeDetector_New_AsyncPtr = + _lookup Function(CvCallback_1)>>( + 'QRCodeDetector_New_Async'); + late final _QRCodeDetector_New_Async = _QRCodeDetector_New_AsyncPtr + .asFunction Function(CvCallback_1)>(); - ffi.Pointer Rng_New( - ffi.Pointer rval, + ffi.Pointer QRCodeDetector_decodeCurved( + QRCodeDetector self, + Mat img, + VecPoint points, + ffi.Pointer straight_qrcode, + ffi.Pointer> rval, ) { - return _Rng_New( + return _QRCodeDetector_decodeCurved( + self, + img, + points, + straight_qrcode, rval, ); } - late final _Rng_NewPtr = _lookup< - ffi.NativeFunction Function(ffi.Pointer)>>( - 'Rng_New'); - late final _Rng_New = _Rng_NewPtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + late final _QRCodeDetector_decodeCurvedPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(QRCodeDetector, Mat, VecPoint, + ffi.Pointer, ffi.Pointer>)>>( + 'QRCodeDetector_decodeCurved'); + late final _QRCodeDetector_decodeCurved = + _QRCodeDetector_decodeCurvedPtr.asFunction< + ffi.Pointer Function(QRCodeDetector, Mat, VecPoint, + ffi.Pointer, ffi.Pointer>)>(); - ffi.Pointer Rng_NewWithState( - int state, - ffi.Pointer rval, + ffi.Pointer QRCodeDetector_decodeCurved_Async( + QRCodeDetector self, + Mat img, + VecPoint points, + CvCallback_2 callback, ) { - return _Rng_NewWithState( - state, - rval, + return _QRCodeDetector_decodeCurved_Async( + self, + img, + points, + callback, ); } - late final _Rng_NewWithStatePtr = _lookup< + late final _QRCodeDetector_decodeCurved_AsyncPtr = _lookup< ffi.NativeFunction< + ffi.Pointer Function(QRCodeDetector, Mat, VecPoint, + CvCallback_2)>>('QRCodeDetector_decodeCurved_Async'); + late final _QRCodeDetector_decodeCurved_Async = + _QRCodeDetector_decodeCurved_AsyncPtr.asFunction< ffi.Pointer Function( - ffi.Uint64, ffi.Pointer)>>('Rng_NewWithState'); - late final _Rng_NewWithState = _Rng_NewWithStatePtr.asFunction< - ffi.Pointer Function(int, ffi.Pointer)>(); + QRCodeDetector, Mat, VecPoint, CvCallback_2)>(); - ffi.Pointer Rotate( - Mat src, - Mat dst, - int rotateCode, + ffi.Pointer QRCodeDetector_detectAndDecodeCurved( + QRCodeDetector self, + Mat img, + ffi.Pointer points, + ffi.Pointer straight_qrcode, + ffi.Pointer> rval, ) { - return _Rotate( - src, - dst, - rotateCode, + return _QRCodeDetector_detectAndDecodeCurved( + self, + img, + points, + straight_qrcode, + rval, ); } - late final _RotatePtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(Mat, Mat, ffi.Int)>>('Rotate'); - late final _Rotate = - _RotatePtr.asFunction Function(Mat, Mat, int)>(); + late final _QRCodeDetector_detectAndDecodeCurvedPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + QRCodeDetector, + Mat, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>>( + 'QRCodeDetector_detectAndDecodeCurved'); + late final _QRCodeDetector_detectAndDecodeCurved = + _QRCodeDetector_detectAndDecodeCurvedPtr.asFunction< + ffi.Pointer Function( + QRCodeDetector, + Mat, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>)>(); - ffi.Pointer RotatedRect_BoundingRect( - RotatedRect rect, - ffi.Pointer rval, + ffi.Pointer QRCodeDetector_detectAndDecodeCurved_Async( + QRCodeDetector self, + Mat img, + CvCallback_3 callback, ) { - return _RotatedRect_BoundingRect( - rect, - rval, + return _QRCodeDetector_detectAndDecodeCurved_Async( + self, + img, + callback, ); } - late final _RotatedRect_BoundingRectPtr = _lookup< + late final _QRCodeDetector_detectAndDecodeCurved_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - RotatedRect, ffi.Pointer)>>('RotatedRect_BoundingRect'); - late final _RotatedRect_BoundingRect = - _RotatedRect_BoundingRectPtr.asFunction< - ffi.Pointer Function(RotatedRect, ffi.Pointer)>(); + ffi.Pointer Function(QRCodeDetector, Mat, + CvCallback_3)>>('QRCodeDetector_detectAndDecodeCurved_Async'); + late final _QRCodeDetector_detectAndDecodeCurved_Async = + _QRCodeDetector_detectAndDecodeCurved_AsyncPtr.asFunction< + ffi.Pointer Function(QRCodeDetector, Mat, CvCallback_3)>(); - ffi.Pointer RotatedRect_BoundingRect2f( - RotatedRect rect, - ffi.Pointer rval, + ffi.Pointer QRCodeDetector_setEpsX( + QRCodeDetector self, + double epsX, ) { - return _RotatedRect_BoundingRect2f( - rect, - rval, + return _QRCodeDetector_setEpsX( + self, + epsX, ); } - late final _RotatedRect_BoundingRect2fPtr = _lookup< + late final _QRCodeDetector_setEpsXPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - RotatedRect, ffi.Pointer)>>('RotatedRect_BoundingRect2f'); - late final _RotatedRect_BoundingRect2f = - _RotatedRect_BoundingRect2fPtr.asFunction< - ffi.Pointer Function(RotatedRect, ffi.Pointer)>(); + QRCodeDetector, ffi.Double)>>('QRCodeDetector_setEpsX'); + late final _QRCodeDetector_setEpsX = _QRCodeDetector_setEpsXPtr.asFunction< + ffi.Pointer Function(QRCodeDetector, double)>(); - ffi.Pointer RotatedRect_Points( - RotatedRect rect, - ffi.Pointer pts, + ffi.Pointer QRCodeDetector_setEpsX_Async( + QRCodeDetector self, + double epsX, + CvCallback_0 callback, ) { - return _RotatedRect_Points( - rect, - pts, + return _QRCodeDetector_setEpsX_Async( + self, + epsX, + callback, ); } - late final _RotatedRect_PointsPtr = _lookup< + late final _QRCodeDetector_setEpsX_AsyncPtr = _lookup< ffi.NativeFunction< + ffi.Pointer Function(QRCodeDetector, ffi.Double, + CvCallback_0)>>('QRCodeDetector_setEpsX_Async'); + late final _QRCodeDetector_setEpsX_Async = + _QRCodeDetector_setEpsX_AsyncPtr.asFunction< ffi.Pointer Function( - RotatedRect, ffi.Pointer)>>('RotatedRect_Points'); - late final _RotatedRect_Points = _RotatedRect_PointsPtr.asFunction< - ffi.Pointer Function(RotatedRect, ffi.Pointer)>(); + QRCodeDetector, double, CvCallback_0)>(); - void SIFT_Close( - SIFTPtr f, + ffi.Pointer QRCodeDetector_setEpsY( + QRCodeDetector self, + double epsY, ) { - return _SIFT_Close( - f, + return _QRCodeDetector_setEpsY( + self, + epsY, ); } - late final _SIFT_ClosePtr = - _lookup>('SIFT_Close'); - late final _SIFT_Close = _SIFT_ClosePtr.asFunction(); + late final _QRCodeDetector_setEpsYPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + QRCodeDetector, ffi.Double)>>('QRCodeDetector_setEpsY'); + late final _QRCodeDetector_setEpsY = _QRCodeDetector_setEpsYPtr.asFunction< + ffi.Pointer Function(QRCodeDetector, double)>(); - ffi.Pointer SIFT_Create( - ffi.Pointer rval, + ffi.Pointer QRCodeDetector_setEpsY_Async( + QRCodeDetector self, + double epsY, + CvCallback_0 callback, ) { - return _SIFT_Create( - rval, + return _QRCodeDetector_setEpsY_Async( + self, + epsY, + callback, ); } - late final _SIFT_CreatePtr = _lookup< + late final _QRCodeDetector_setEpsY_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer)>>('SIFT_Create'); - late final _SIFT_Create = _SIFT_CreatePtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + ffi.Pointer Function(QRCodeDetector, ffi.Double, + CvCallback_0)>>('QRCodeDetector_setEpsY_Async'); + late final _QRCodeDetector_setEpsY_Async = + _QRCodeDetector_setEpsY_AsyncPtr.asFunction< + ffi.Pointer Function( + QRCodeDetector, double, CvCallback_0)>(); - ffi.Pointer SIFT_Detect( - SIFT f, - Mat src, - ffi.Pointer rval, + ffi.Pointer QRCodeDetector_setUseAlignmentMarkers( + QRCodeDetector self, + bool useAlignmentMarkers, ) { - return _SIFT_Detect( - f, - src, - rval, + return _QRCodeDetector_setUseAlignmentMarkers( + self, + useAlignmentMarkers, ); } - late final _SIFT_DetectPtr = _lookup< + late final _QRCodeDetector_setUseAlignmentMarkersPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - SIFT, Mat, ffi.Pointer)>>('SIFT_Detect'); - late final _SIFT_Detect = _SIFT_DetectPtr.asFunction< - ffi.Pointer Function(SIFT, Mat, ffi.Pointer)>(); + ffi.Pointer Function(QRCodeDetector, + ffi.Bool)>>('QRCodeDetector_setUseAlignmentMarkers'); + late final _QRCodeDetector_setUseAlignmentMarkers = + _QRCodeDetector_setUseAlignmentMarkersPtr.asFunction< + ffi.Pointer Function(QRCodeDetector, bool)>(); - ffi.Pointer SIFT_DetectAndCompute( - SIFT f, - Mat src, - Mat mask, - Mat desc, - ffi.Pointer rval, + ffi.Pointer QRCodeDetector_setUseAlignmentMarkers_Async( + QRCodeDetector self, + bool useAlignmentMarkers, + CvCallback_0 callback, ) { - return _SIFT_DetectAndCompute( - f, - src, - mask, - desc, - rval, + return _QRCodeDetector_setUseAlignmentMarkers_Async( + self, + useAlignmentMarkers, + callback, ); } - late final _SIFT_DetectAndComputePtr = _lookup< + late final _QRCodeDetector_setUseAlignmentMarkers_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(SIFT, Mat, Mat, Mat, - ffi.Pointer)>>('SIFT_DetectAndCompute'); - late final _SIFT_DetectAndCompute = _SIFT_DetectAndComputePtr.asFunction< - ffi.Pointer Function( - SIFT, Mat, Mat, Mat, ffi.Pointer)>(); + ffi.Pointer Function(QRCodeDetector, ffi.Bool, + CvCallback_0)>>('QRCodeDetector_setUseAlignmentMarkers_Async'); + late final _QRCodeDetector_setUseAlignmentMarkers_Async = + _QRCodeDetector_setUseAlignmentMarkers_AsyncPtr.asFunction< + ffi.Pointer Function(QRCodeDetector, bool, CvCallback_0)>(); - ffi.Pointer SVD_Compute( - Mat src, - Mat w, - Mat u, - Mat vt, - int flags, + ffi.Pointer RNG_Fill( + RNG rng, + Mat mat, + int distType, + double a, + double b, + bool saturateRange, ) { - return _SVD_Compute( - src, - w, - u, - vt, - flags, + return _RNG_Fill( + rng, + mat, + distType, + a, + b, + saturateRange, ); } - late final _SVD_ComputePtr = _lookup< + late final _RNG_FillPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - Mat, Mat, Mat, Mat, ffi.Int)>>('SVD_Compute'); - late final _SVD_Compute = _SVD_ComputePtr.asFunction< - ffi.Pointer Function(Mat, Mat, Mat, Mat, int)>(); + ffi.Pointer Function(RNG, Mat, ffi.Int, ffi.Double, + ffi.Double, ffi.Bool)>>('RNG_Fill'); + late final _RNG_Fill = _RNG_FillPtr.asFunction< + ffi.Pointer Function(RNG, Mat, int, double, double, bool)>(); - ffi.Pointer Scharr( - Mat src, - Mat dst, - int dDepth, - int dx, - int dy, - double scale, - double delta, - int borderType, + ffi.Pointer RNG_Fill_Async( + RNG rng, + Mat mat, + int distType, + double a, + double b, + bool saturateRange, + CvCallback_0 callback, ) { - return _Scharr( - src, - dst, - dDepth, - dx, - dy, - scale, - delta, - borderType, + return _RNG_Fill_Async( + rng, + mat, + distType, + a, + b, + saturateRange, + callback, ); } - late final _ScharrPtr = _lookup< + late final _RNG_Fill_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Mat, Mat, ffi.Int, ffi.Int, ffi.Int, - ffi.Double, ffi.Double, ffi.Int)>>('Scharr'); - late final _Scharr = _ScharrPtr.asFunction< + ffi.Pointer Function(RNG, Mat, ffi.Int, ffi.Double, + ffi.Double, ffi.Bool, CvCallback_0)>>('RNG_Fill_Async'); + late final _RNG_Fill_Async = _RNG_Fill_AsyncPtr.asFunction< ffi.Pointer Function( - Mat, Mat, int, int, int, double, double, int)>(); + RNG, Mat, int, double, double, bool, CvCallback_0)>(); - ffi.Pointer SeamlessClone( - Mat src, - Mat dst, - Mat mask, - Point p, - Mat blend, - int flags, + ffi.Pointer RNG_Gaussian( + RNG rng, + double sigma, + ffi.Pointer rval, ) { - return _SeamlessClone( - src, - dst, - mask, - p, - blend, - flags, + return _RNG_Gaussian( + rng, + sigma, + rval, ); } - late final _SeamlessClonePtr = _lookup< + late final _RNG_GaussianPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - Mat, Mat, Mat, Point, Mat, ffi.Int)>>('SeamlessClone'); - late final _SeamlessClone = _SeamlessClonePtr.asFunction< - ffi.Pointer Function(Mat, Mat, Mat, Point, Mat, int)>(); + RNG, ffi.Double, ffi.Pointer)>>('RNG_Gaussian'); + late final _RNG_Gaussian = _RNG_GaussianPtr.asFunction< + ffi.Pointer Function(RNG, double, ffi.Pointer)>(); - ffi.Pointer SepFilter2D( - Mat src, - Mat dst, - int ddepth, - Mat kernelX, - Mat kernelY, - Point anchor, - double delta, - int borderType, + ffi.Pointer RNG_Gaussian_Async( + RNG rng, + double sigma, + CvCallback_1 callback, ) { - return _SepFilter2D( - src, - dst, - ddepth, - kernelX, - kernelY, - anchor, - delta, - borderType, + return _RNG_Gaussian_Async( + rng, + sigma, + callback, ); } - late final _SepFilter2DPtr = _lookup< + late final _RNG_Gaussian_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Mat, Mat, ffi.Int, Mat, Mat, Point, - ffi.Double, ffi.Int)>>('SepFilter2D'); - late final _SepFilter2D = _SepFilter2DPtr.asFunction< - ffi.Pointer Function( - Mat, Mat, int, Mat, Mat, Point, double, int)>(); + ffi.Pointer Function( + RNG, ffi.Double, CvCallback_1)>>('RNG_Gaussian_Async'); + late final _RNG_Gaussian_Async = _RNG_Gaussian_AsyncPtr.asFunction< + ffi.Pointer Function(RNG, double, CvCallback_1)>(); - ffi.Pointer SetNumThreads( - int n, + ffi.Pointer RNG_Next( + RNG rng, + ffi.Pointer rval, ) { - return _SetNumThreads( - n, + return _RNG_Next( + rng, + rval, ); } - late final _SetNumThreadsPtr = - _lookup Function(ffi.Int)>>( - 'SetNumThreads'); - late final _SetNumThreads = - _SetNumThreadsPtr.asFunction Function(int)>(); + late final _RNG_NextPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + RNG, ffi.Pointer)>>('RNG_Next'); + late final _RNG_Next = _RNG_NextPtr.asFunction< + ffi.Pointer Function(RNG, ffi.Pointer)>(); - ffi.Pointer SetRNGSeed( - int seed, + ffi.Pointer RNG_Next_Async( + RNG rng, + CvCallback_1 callback, ) { - return _SetRNGSeed( - seed, + return _RNG_Next_Async( + rng, + callback, ); } - late final _SetRNGSeedPtr = - _lookup Function(ffi.Int)>>( - 'SetRNGSeed'); - late final _SetRNGSeed = - _SetRNGSeedPtr.asFunction Function(int)>(); + late final _RNG_Next_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(RNG, CvCallback_1)>>('RNG_Next_Async'); + late final _RNG_Next_Async = _RNG_Next_AsyncPtr.asFunction< + ffi.Pointer Function(RNG, CvCallback_1)>(); - ffi.Pointer SimpleBlobDetectorParams_Create( - ffi.Pointer rval, + ffi.Pointer RNG_Uniform( + RNG rng, + int a, + int b, + ffi.Pointer rval, ) { - return _SimpleBlobDetectorParams_Create( + return _RNG_Uniform( + rng, + a, + b, rval, ); } - late final _SimpleBlobDetectorParams_CreatePtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>>( - 'SimpleBlobDetectorParams_Create'); - late final _SimpleBlobDetectorParams_Create = - _SimpleBlobDetectorParams_CreatePtr.asFunction< + late final _RNG_UniformPtr = _lookup< + ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer)>(); + RNG, ffi.Int, ffi.Int, ffi.Pointer)>>('RNG_Uniform'); + late final _RNG_Uniform = _RNG_UniformPtr.asFunction< + ffi.Pointer Function(RNG, int, int, ffi.Pointer)>(); - void SimpleBlobDetector_Close( - SimpleBlobDetectorPtr b, + ffi.Pointer RNG_UniformDouble( + RNG rng, + double a, + double b, + ffi.Pointer rval, ) { - return _SimpleBlobDetector_Close( + return _RNG_UniformDouble( + rng, + a, b, - ); - } - - late final _SimpleBlobDetector_ClosePtr = - _lookup>( - 'SimpleBlobDetector_Close'); - late final _SimpleBlobDetector_Close = _SimpleBlobDetector_ClosePtr - .asFunction(); - - ffi.Pointer SimpleBlobDetector_Create( - ffi.Pointer rval, - ) { - return _SimpleBlobDetector_Create( rval, ); } - late final _SimpleBlobDetector_CreatePtr = _lookup< + late final _RNG_UniformDoublePtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>>('SimpleBlobDetector_Create'); - late final _SimpleBlobDetector_Create = - _SimpleBlobDetector_CreatePtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + ffi.Pointer Function(RNG, ffi.Double, ffi.Double, + ffi.Pointer)>>('RNG_UniformDouble'); + late final _RNG_UniformDouble = _RNG_UniformDoublePtr.asFunction< + ffi.Pointer Function( + RNG, double, double, ffi.Pointer)>(); - ffi.Pointer SimpleBlobDetector_Create_WithParams( - SimpleBlobDetectorParams params, - ffi.Pointer rval, + ffi.Pointer RNG_UniformDouble_Async( + RNG rng, + double a, + double b, + CvCallback_1 callback, ) { - return _SimpleBlobDetector_Create_WithParams( - params, - rval, + return _RNG_UniformDouble_Async( + rng, + a, + b, + callback, ); } - late final _SimpleBlobDetector_Create_WithParamsPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - SimpleBlobDetectorParams, ffi.Pointer)>>( - 'SimpleBlobDetector_Create_WithParams'); - late final _SimpleBlobDetector_Create_WithParams = - _SimpleBlobDetector_Create_WithParamsPtr.asFunction< - ffi.Pointer Function( - SimpleBlobDetectorParams, ffi.Pointer)>(); + late final _RNG_UniformDouble_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(RNG, ffi.Double, ffi.Double, + CvCallback_1)>>('RNG_UniformDouble_Async'); + late final _RNG_UniformDouble_Async = _RNG_UniformDouble_AsyncPtr.asFunction< + ffi.Pointer Function(RNG, double, double, CvCallback_1)>(); - ffi.Pointer SimpleBlobDetector_Detect( - SimpleBlobDetector b, - Mat src, - ffi.Pointer rval, + ffi.Pointer RNG_Uniform_Async( + RNG rng, + int a, + int b, + CvCallback_1 callback, ) { - return _SimpleBlobDetector_Detect( + return _RNG_Uniform_Async( + rng, + a, b, - src, - rval, + callback, ); } - late final _SimpleBlobDetector_DetectPtr = _lookup< + late final _RNG_Uniform_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(SimpleBlobDetector, Mat, - ffi.Pointer)>>('SimpleBlobDetector_Detect'); - late final _SimpleBlobDetector_Detect = - _SimpleBlobDetector_DetectPtr.asFunction< ffi.Pointer Function( - SimpleBlobDetector, Mat, ffi.Pointer)>(); + RNG, ffi.Int, ffi.Int, CvCallback_1)>>('RNG_Uniform_Async'); + late final _RNG_Uniform_Async = _RNG_Uniform_AsyncPtr.asFunction< + ffi.Pointer Function(RNG, int, int, CvCallback_1)>(); - ffi.Pointer Sobel( - Mat src, - Mat dst, - int ddepth, - int dx, - int dy, - int ksize, - double scale, - double delta, - int borderType, + ffi.Pointer RandN( + Mat mat, + Scalar mean, + Scalar stddev, ) { - return _Sobel( - src, - dst, - ddepth, - dx, - dy, - ksize, - scale, - delta, - borderType, + return _RandN( + mat, + mean, + stddev, ); } - late final _SobelPtr = _lookup< + late final _RandNPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Mat, Mat, ffi.Int, ffi.Int, ffi.Int, - ffi.Int, ffi.Double, ffi.Double, ffi.Int)>>('Sobel'); - late final _Sobel = _SobelPtr.asFunction< - ffi.Pointer Function( - Mat, Mat, int, int, int, int, double, double, int)>(); + ffi.Pointer Function(Mat, Scalar, Scalar)>>('RandN'); + late final _RandN = _RandNPtr.asFunction< + ffi.Pointer Function(Mat, Scalar, Scalar)>(); - ffi.Pointer SpatialGradient( - Mat src, - Mat dx, - Mat dy, - int ksize, - int borderType, + ffi.Pointer RandN_Async( + Mat mat, + Scalar mean, + Scalar stddev, + CvCallback_0 callback, ) { - return _SpatialGradient( - src, - dx, - dy, - ksize, - borderType, + return _RandN_Async( + mat, + mean, + stddev, + callback, ); } - late final _SpatialGradientPtr = _lookup< + late final _RandN_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - Mat, Mat, Mat, ffi.Int, ffi.Int)>>('SpatialGradient'); - late final _SpatialGradient = _SpatialGradientPtr.asFunction< - ffi.Pointer Function(Mat, Mat, Mat, int, int)>(); + Mat, Scalar, Scalar, CvCallback_0)>>('RandN_Async'); + late final _RandN_Async = _RandN_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Scalar, Scalar, CvCallback_0)>(); - ffi.Pointer SqBoxFilter( - Mat src, - Mat dst, - int ddepth, - Size ps, + ffi.Pointer RandShuffle( + Mat mat, ) { - return _SqBoxFilter( - src, - dst, - ddepth, - ps, + return _RandShuffle( + mat, ); } - late final _SqBoxFilterPtr = _lookup< + late final _RandShufflePtr = + _lookup Function(Mat)>>( + 'RandShuffle'); + late final _RandShuffle = + _RandShufflePtr.asFunction Function(Mat)>(); + + ffi.Pointer RandShuffleWithParams( + Mat mat, + double iterFactor, + RNG rng, + ) { + return _RandShuffleWithParams( + mat, + iterFactor, + rng, + ); + } + + late final _RandShuffleWithParamsPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - Mat, Mat, ffi.Int, Size)>>('SqBoxFilter'); - late final _SqBoxFilter = _SqBoxFilterPtr.asFunction< - ffi.Pointer Function(Mat, Mat, int, Size)>(); + Mat, ffi.Double, RNG)>>('RandShuffleWithParams'); + late final _RandShuffleWithParams = _RandShuffleWithParamsPtr.asFunction< + ffi.Pointer Function(Mat, double, RNG)>(); - void Stitcher_Close( - PtrStitcherPtr stitcher, + ffi.Pointer RandShuffleWithParams_Async( + Mat mat, + double iterFactor, + RNG rng, + CvCallback_0 callback, ) { - return _Stitcher_Close( - stitcher, + return _RandShuffleWithParams_Async( + mat, + iterFactor, + rng, + callback, ); } - late final _Stitcher_ClosePtr = - _lookup>( - 'Stitcher_Close'); - late final _Stitcher_Close = - _Stitcher_ClosePtr.asFunction(); + late final _RandShuffleWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, ffi.Double, RNG, + CvCallback_0)>>('RandShuffleWithParams_Async'); + late final _RandShuffleWithParams_Async = + _RandShuffleWithParams_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, double, RNG, CvCallback_0)>(); - ffi.Pointer Stitcher_Component( - Stitcher self, - ffi.Pointer rval, + ffi.Pointer RandShuffle_Async( + Mat mat, + CvCallback_0 callback, ) { - return _Stitcher_Component( - self, - rval, + return _RandShuffle_Async( + mat, + callback, ); } - late final _Stitcher_ComponentPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - Stitcher, ffi.Pointer)>>('Stitcher_Component'); - late final _Stitcher_Component = _Stitcher_ComponentPtr.asFunction< - ffi.Pointer Function(Stitcher, ffi.Pointer)>(); + late final _RandShuffle_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Mat, CvCallback_0)>>( + 'RandShuffle_Async'); + late final _RandShuffle_Async = _RandShuffle_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, CvCallback_0)>(); - ffi.Pointer Stitcher_ComposePanorama( - Stitcher self, - Mat rpano, - ffi.Pointer rval, + ffi.Pointer RandU( + Mat mat, + Scalar low, + Scalar high, ) { - return _Stitcher_ComposePanorama( - self, - rpano, - rval, + return _RandU( + mat, + low, + high, ); } - late final _Stitcher_ComposePanoramaPtr = _lookup< + late final _RandUPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Stitcher, Mat, - ffi.Pointer)>>('Stitcher_ComposePanorama'); - late final _Stitcher_ComposePanorama = - _Stitcher_ComposePanoramaPtr.asFunction< - ffi.Pointer Function( - Stitcher, Mat, ffi.Pointer)>(); + ffi.Pointer Function(Mat, Scalar, Scalar)>>('RandU'); + late final _RandU = _RandUPtr.asFunction< + ffi.Pointer Function(Mat, Scalar, Scalar)>(); - ffi.Pointer Stitcher_ComposePanorama_1( - Stitcher self, - VecMat mats, - Mat rpano, - ffi.Pointer rval, + ffi.Pointer RandU_Async( + Mat mat, + Scalar low, + Scalar high, + CvCallback_0 callback, ) { - return _Stitcher_ComposePanorama_1( - self, - mats, - rpano, - rval, + return _RandU_Async( + mat, + low, + high, + callback, ); } - late final _Stitcher_ComposePanorama_1Ptr = _lookup< + late final _RandU_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Stitcher, VecMat, Mat, - ffi.Pointer)>>('Stitcher_ComposePanorama_1'); - late final _Stitcher_ComposePanorama_1 = - _Stitcher_ComposePanorama_1Ptr.asFunction< ffi.Pointer Function( - Stitcher, VecMat, Mat, ffi.Pointer)>(); + Mat, Scalar, Scalar, CvCallback_0)>>('RandU_Async'); + late final _RandU_Async = _RandU_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Scalar, Scalar, CvCallback_0)>(); - ffi.Pointer Stitcher_Create( - int mode, - ffi.Pointer rval, + ffi.Pointer Rectangle( + Mat img, + Rect rect, + Scalar color, + int thickness, ) { - return _Stitcher_Create( - mode, - rval, + return _Rectangle( + img, + rect, + color, + thickness, ); } - late final _Stitcher_CreatePtr = _lookup< + late final _RectanglePtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - ffi.Int, ffi.Pointer)>>('Stitcher_Create'); - late final _Stitcher_Create = _Stitcher_CreatePtr.asFunction< - ffi.Pointer Function(int, ffi.Pointer)>(); + Mat, Rect, Scalar, ffi.Int)>>('Rectangle'); + late final _Rectangle = _RectanglePtr.asFunction< + ffi.Pointer Function(Mat, Rect, Scalar, int)>(); - ffi.Pointer Stitcher_EstimateTransform( - Stitcher self, - VecMat mats, - VecMat masks, - ffi.Pointer rval, + ffi.Pointer RectangleWithParams( + Mat img, + Rect rect, + Scalar color, + int thickness, + int lineType, + int shift, ) { - return _Stitcher_EstimateTransform( - self, - mats, - masks, - rval, + return _RectangleWithParams( + img, + rect, + color, + thickness, + lineType, + shift, ); } - late final _Stitcher_EstimateTransformPtr = _lookup< + late final _RectangleWithParamsPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Stitcher, VecMat, VecMat, - ffi.Pointer)>>('Stitcher_EstimateTransform'); - late final _Stitcher_EstimateTransform = - _Stitcher_EstimateTransformPtr.asFunction< - ffi.Pointer Function( - Stitcher, VecMat, VecMat, ffi.Pointer)>(); + ffi.Pointer Function(Mat, Rect, Scalar, ffi.Int, ffi.Int, + ffi.Int)>>('RectangleWithParams'); + late final _RectangleWithParams = _RectangleWithParamsPtr.asFunction< + ffi.Pointer Function(Mat, Rect, Scalar, int, int, int)>(); - ffi.Pointer Stitcher_Get( - PtrStitcher self, - ffi.Pointer rval, + ffi.Pointer RectangleWithParams_Async( + Mat img, + Rect rect, + Scalar color, + int thickness, + int lineType, + int shift, + CvCallback_0 callback, ) { - return _Stitcher_Get( - self, - rval, + return _RectangleWithParams_Async( + img, + rect, + color, + thickness, + lineType, + shift, + callback, ); } - late final _Stitcher_GetPtr = _lookup< + late final _RectangleWithParams_AsyncPtr = _lookup< ffi.NativeFunction< + ffi.Pointer Function(Mat, Rect, Scalar, ffi.Int, ffi.Int, + ffi.Int, CvCallback_0)>>('RectangleWithParams_Async'); + late final _RectangleWithParams_Async = + _RectangleWithParams_AsyncPtr.asFunction< ffi.Pointer Function( - PtrStitcher, ffi.Pointer)>>('Stitcher_Get'); - late final _Stitcher_Get = _Stitcher_GetPtr.asFunction< - ffi.Pointer Function(PtrStitcher, ffi.Pointer)>(); + Mat, Rect, Scalar, int, int, int, CvCallback_0)>(); - ffi.Pointer Stitcher_GetCompositingResol( - Stitcher self, - ffi.Pointer rval, + ffi.Pointer Rectangle_Async( + Mat img, + Rect rect, + Scalar color, + int thickness, + CvCallback_0 callback, ) { - return _Stitcher_GetCompositingResol( - self, - rval, + return _Rectangle_Async( + img, + rect, + color, + thickness, + callback, ); } - late final _Stitcher_GetCompositingResolPtr = _lookup< + late final _Rectangle_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Stitcher, - ffi.Pointer)>>('Stitcher_GetCompositingResol'); - late final _Stitcher_GetCompositingResol = - _Stitcher_GetCompositingResolPtr.asFunction< - ffi.Pointer Function(Stitcher, ffi.Pointer)>(); + ffi.Pointer Function( + Mat, Rect, Scalar, ffi.Int, CvCallback_0)>>('Rectangle_Async'); + late final _Rectangle_Async = _Rectangle_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Rect, Scalar, int, CvCallback_0)>(); - ffi.Pointer Stitcher_GetInterpolationFlags( - Stitcher self, - ffi.Pointer rval, + ffi.Pointer Remap( + Mat src, + Mat dst, + Mat map1, + Mat map2, + int interpolation, + int borderMode, + Scalar borderValue, ) { - return _Stitcher_GetInterpolationFlags( - self, - rval, + return _Remap( + src, + dst, + map1, + map2, + interpolation, + borderMode, + borderValue, ); } - late final _Stitcher_GetInterpolationFlagsPtr = _lookup< + late final _RemapPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Stitcher, - ffi.Pointer)>>('Stitcher_GetInterpolationFlags'); - late final _Stitcher_GetInterpolationFlags = - _Stitcher_GetInterpolationFlagsPtr.asFunction< - ffi.Pointer Function(Stitcher, ffi.Pointer)>(); + ffi.Pointer Function( + Mat, Mat, Mat, Mat, ffi.Int, ffi.Int, Scalar)>>('Remap'); + late final _Remap = _RemapPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, Mat, int, int, Scalar)>(); - ffi.Pointer Stitcher_GetPanoConfidenceThresh( - Stitcher self, - ffi.Pointer rval, + ffi.Pointer Remap_Async( + Mat src, + Mat map1, + Mat map2, + int interpolation, + int borderMode, + Scalar borderValue, + CvCallback_1 callback, ) { - return _Stitcher_GetPanoConfidenceThresh( - self, - rval, + return _Remap_Async( + src, + map1, + map2, + interpolation, + borderMode, + borderValue, + callback, ); } - late final _Stitcher_GetPanoConfidenceThreshPtr = _lookup< + late final _Remap_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Stitcher, - ffi.Pointer)>>('Stitcher_GetPanoConfidenceThresh'); - late final _Stitcher_GetPanoConfidenceThresh = - _Stitcher_GetPanoConfidenceThreshPtr.asFunction< - ffi.Pointer Function(Stitcher, ffi.Pointer)>(); + ffi.Pointer Function(Mat, Mat, Mat, ffi.Int, ffi.Int, + Scalar, CvCallback_1)>>('Remap_Async'); + late final _Remap_Async = _Remap_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, Mat, int, int, Scalar, CvCallback_1)>(); - ffi.Pointer Stitcher_GetRegistrationResol( - Stitcher self, - ffi.Pointer rval, + ffi.Pointer Resize( + Mat src, + Mat dst, + Size sz, + double fx, + double fy, + int interp, ) { - return _Stitcher_GetRegistrationResol( - self, - rval, + return _Resize( + src, + dst, + sz, + fx, + fy, + interp, ); } - late final _Stitcher_GetRegistrationResolPtr = _lookup< + late final _ResizePtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Stitcher, - ffi.Pointer)>>('Stitcher_GetRegistrationResol'); - late final _Stitcher_GetRegistrationResol = - _Stitcher_GetRegistrationResolPtr.asFunction< - ffi.Pointer Function(Stitcher, ffi.Pointer)>(); + ffi.Pointer Function( + Mat, Mat, Size, ffi.Double, ffi.Double, ffi.Int)>>('Resize'); + late final _Resize = _ResizePtr.asFunction< + ffi.Pointer Function(Mat, Mat, Size, double, double, int)>(); - ffi.Pointer Stitcher_GetSeamEstimationResol( - Stitcher self, - ffi.Pointer rval, + ffi.Pointer Resize_Async( + Mat src, + Size sz, + double fx, + double fy, + int interp, + CvCallback_1 callback, ) { - return _Stitcher_GetSeamEstimationResol( - self, - rval, + return _Resize_Async( + src, + sz, + fx, + fy, + interp, + callback, ); } - late final _Stitcher_GetSeamEstimationResolPtr = _lookup< + late final _Resize_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Stitcher, - ffi.Pointer)>>('Stitcher_GetSeamEstimationResol'); - late final _Stitcher_GetSeamEstimationResol = - _Stitcher_GetSeamEstimationResolPtr.asFunction< - ffi.Pointer Function(Stitcher, ffi.Pointer)>(); + ffi.Pointer Function(Mat, Size, ffi.Double, ffi.Double, + ffi.Int, CvCallback_1)>>('Resize_Async'); + late final _Resize_Async = _Resize_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Size, double, double, int, CvCallback_1)>(); - ffi.Pointer Stitcher_GetWaveCorrectKind( - Stitcher self, - ffi.Pointer rval, + void Rng_Close( + RNGPtr rng, ) { - return _Stitcher_GetWaveCorrectKind( - self, + return _Rng_Close( + rng, + ); + } + + late final _Rng_ClosePtr = + _lookup>('Rng_Close'); + late final _Rng_Close = _Rng_ClosePtr.asFunction(); + + ffi.Pointer Rng_New( + ffi.Pointer rval, + ) { + return _Rng_New( rval, ); } - late final _Stitcher_GetWaveCorrectKindPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - Stitcher, ffi.Pointer)>>('Stitcher_GetWaveCorrectKind'); - late final _Stitcher_GetWaveCorrectKind = - _Stitcher_GetWaveCorrectKindPtr.asFunction< - ffi.Pointer Function(Stitcher, ffi.Pointer)>(); + late final _Rng_NewPtr = _lookup< + ffi.NativeFunction Function(ffi.Pointer)>>( + 'Rng_New'); + late final _Rng_New = _Rng_NewPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); - ffi.Pointer Stitcher_GetWaveCorrection( - Stitcher self, - ffi.Pointer rval, + ffi.Pointer Rng_NewWithState( + int state, + ffi.Pointer rval, ) { - return _Stitcher_GetWaveCorrection( - self, + return _Rng_NewWithState( + state, rval, ); } - late final _Stitcher_GetWaveCorrectionPtr = _lookup< + late final _Rng_NewWithStatePtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - Stitcher, ffi.Pointer)>>('Stitcher_GetWaveCorrection'); - late final _Stitcher_GetWaveCorrection = - _Stitcher_GetWaveCorrectionPtr.asFunction< - ffi.Pointer Function(Stitcher, ffi.Pointer)>(); + ffi.Uint64, ffi.Pointer)>>('Rng_NewWithState'); + late final _Rng_NewWithState = _Rng_NewWithStatePtr.asFunction< + ffi.Pointer Function(int, ffi.Pointer)>(); - ffi.Pointer Stitcher_SetCompositingResol( - Stitcher self, - double inval, + ffi.Pointer Rng_NewWithState_Async( + int state, + CvCallback_1 callback, ) { - return _Stitcher_SetCompositingResol( - self, - inval, + return _Rng_NewWithState_Async( + state, + callback, ); } - late final _Stitcher_SetCompositingResolPtr = _lookup< + late final _Rng_NewWithState_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - Stitcher, ffi.Double)>>('Stitcher_SetCompositingResol'); - late final _Stitcher_SetCompositingResol = _Stitcher_SetCompositingResolPtr - .asFunction Function(Stitcher, double)>(); + ffi.Uint64, CvCallback_1)>>('Rng_NewWithState_Async'); + late final _Rng_NewWithState_Async = _Rng_NewWithState_AsyncPtr.asFunction< + ffi.Pointer Function(int, CvCallback_1)>(); - ffi.Pointer Stitcher_SetInterpolationFlags( - Stitcher self, - int inval, + ffi.Pointer Rng_New_Async( + CvCallback_1 callback, ) { - return _Stitcher_SetInterpolationFlags( - self, - inval, + return _Rng_New_Async( + callback, ); } - late final _Stitcher_SetInterpolationFlagsPtr = _lookup< - ffi - .NativeFunction Function(Stitcher, ffi.Int)>>( - 'Stitcher_SetInterpolationFlags'); - late final _Stitcher_SetInterpolationFlags = - _Stitcher_SetInterpolationFlagsPtr.asFunction< - ffi.Pointer Function(Stitcher, int)>(); + late final _Rng_New_AsyncPtr = + _lookup Function(CvCallback_1)>>( + 'Rng_New_Async'); + late final _Rng_New_Async = _Rng_New_AsyncPtr.asFunction< + ffi.Pointer Function(CvCallback_1)>(); - ffi.Pointer Stitcher_SetPanoConfidenceThresh( - Stitcher self, - double inval, + ffi.Pointer Rotate( + Mat src, + Mat dst, + int rotateCode, ) { - return _Stitcher_SetPanoConfidenceThresh( - self, - inval, + return _Rotate( + src, + dst, + rotateCode, ); } - late final _Stitcher_SetPanoConfidenceThreshPtr = _lookup< + late final _RotatePtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - Stitcher, ffi.Double)>>('Stitcher_SetPanoConfidenceThresh'); - late final _Stitcher_SetPanoConfidenceThresh = - _Stitcher_SetPanoConfidenceThreshPtr.asFunction< - ffi.Pointer Function(Stitcher, double)>(); + ffi.Pointer Function(Mat, Mat, ffi.Int)>>('Rotate'); + late final _Rotate = + _RotatePtr.asFunction Function(Mat, Mat, int)>(); - ffi.Pointer Stitcher_SetRegistrationResol( - Stitcher self, - double inval, + ffi.Pointer RotatedRect_BoundingRect( + RotatedRect rect, + ffi.Pointer rval, ) { - return _Stitcher_SetRegistrationResol( - self, - inval, + return _RotatedRect_BoundingRect( + rect, + rval, ); } - late final _Stitcher_SetRegistrationResolPtr = _lookup< + late final _RotatedRect_BoundingRectPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - Stitcher, ffi.Double)>>('Stitcher_SetRegistrationResol'); - late final _Stitcher_SetRegistrationResol = _Stitcher_SetRegistrationResolPtr - .asFunction Function(Stitcher, double)>(); + RotatedRect, ffi.Pointer)>>('RotatedRect_BoundingRect'); + late final _RotatedRect_BoundingRect = + _RotatedRect_BoundingRectPtr.asFunction< + ffi.Pointer Function(RotatedRect, ffi.Pointer)>(); - ffi.Pointer Stitcher_SetSeamEstimationResol( - Stitcher self, - double inval, + ffi.Pointer RotatedRect_BoundingRect2f( + RotatedRect rect, + ffi.Pointer rval, ) { - return _Stitcher_SetSeamEstimationResol( - self, - inval, + return _RotatedRect_BoundingRect2f( + rect, + rval, ); } - late final _Stitcher_SetSeamEstimationResolPtr = _lookup< + late final _RotatedRect_BoundingRect2fPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - Stitcher, ffi.Double)>>('Stitcher_SetSeamEstimationResol'); - late final _Stitcher_SetSeamEstimationResol = - _Stitcher_SetSeamEstimationResolPtr.asFunction< - ffi.Pointer Function(Stitcher, double)>(); + RotatedRect, ffi.Pointer)>>('RotatedRect_BoundingRect2f'); + late final _RotatedRect_BoundingRect2f = + _RotatedRect_BoundingRect2fPtr.asFunction< + ffi.Pointer Function(RotatedRect, ffi.Pointer)>(); - ffi.Pointer Stitcher_SetWaveCorrectKind( - Stitcher self, - int inval, + ffi.Pointer RotatedRect_Points( + RotatedRect rect, + ffi.Pointer pts, ) { - return _Stitcher_SetWaveCorrectKind( - self, - inval, + return _RotatedRect_Points( + rect, + pts, ); } - late final _Stitcher_SetWaveCorrectKindPtr = _lookup< - ffi - .NativeFunction Function(Stitcher, ffi.Int)>>( - 'Stitcher_SetWaveCorrectKind'); - late final _Stitcher_SetWaveCorrectKind = _Stitcher_SetWaveCorrectKindPtr - .asFunction Function(Stitcher, int)>(); + late final _RotatedRect_PointsPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + RotatedRect, ffi.Pointer)>>('RotatedRect_Points'); + late final _RotatedRect_Points = _RotatedRect_PointsPtr.asFunction< + ffi.Pointer Function(RotatedRect, ffi.Pointer)>(); - ffi.Pointer Stitcher_SetWaveCorrection( - Stitcher self, - bool inval, + void SIFT_Close( + SIFTPtr f, ) { - return _Stitcher_SetWaveCorrection( - self, - inval, + return _SIFT_Close( + f, ); } - late final _Stitcher_SetWaveCorrectionPtr = _lookup< - ffi - .NativeFunction Function(Stitcher, ffi.Bool)>>( - 'Stitcher_SetWaveCorrection'); - late final _Stitcher_SetWaveCorrection = _Stitcher_SetWaveCorrectionPtr - .asFunction Function(Stitcher, bool)>(); + late final _SIFT_ClosePtr = + _lookup>('SIFT_Close'); + late final _SIFT_Close = _SIFT_ClosePtr.asFunction(); - ffi.Pointer Stitcher_Stitch( - Stitcher self, - VecMat mats, - Mat rpano, - ffi.Pointer rval, + ffi.Pointer SIFT_Close_Async( + SIFTPtr self, + CvCallback_0 callback, ) { - return _Stitcher_Stitch( + return _SIFT_Close_Async( self, - mats, - rpano, + 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, + ) { + return _SIFT_Create( rval, ); } - late final _Stitcher_StitchPtr = _lookup< + late final _SIFT_CreatePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('SIFT_Create'); + 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, + ffi.Pointer rval, + ) { + return _SIFT_Detect( + f, + src, + rval, + ); + } + + late final _SIFT_DetectPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - Stitcher, VecMat, Mat, ffi.Pointer)>>('Stitcher_Stitch'); - late final _Stitcher_Stitch = _Stitcher_StitchPtr.asFunction< - ffi.Pointer Function( - Stitcher, VecMat, Mat, ffi.Pointer)>(); + SIFT, Mat, ffi.Pointer)>>('SIFT_Detect'); + late final _SIFT_Detect = _SIFT_DetectPtr.asFunction< + ffi.Pointer Function(SIFT, Mat, ffi.Pointer)>(); - ffi.Pointer Stitcher_Stitch_1( - Stitcher self, - VecMat mats, - VecMat masks, - Mat rpano, - ffi.Pointer rval, + ffi.Pointer SIFT_DetectAndCompute( + SIFT f, + Mat src, + Mat mask, + Mat desc, + ffi.Pointer rval, ) { - return _Stitcher_Stitch_1( - self, - mats, - masks, - rpano, + return _SIFT_DetectAndCompute( + f, + src, + mask, + desc, rval, ); } - late final _Stitcher_Stitch_1Ptr = _lookup< + late final _SIFT_DetectAndComputePtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Stitcher, VecMat, VecMat, Mat, - ffi.Pointer)>>('Stitcher_Stitch_1'); - late final _Stitcher_Stitch_1 = _Stitcher_Stitch_1Ptr.asFunction< + ffi.Pointer Function(SIFT, Mat, Mat, Mat, + ffi.Pointer)>>('SIFT_DetectAndCompute'); + late final _SIFT_DetectAndCompute = _SIFT_DetectAndComputePtr.asFunction< ffi.Pointer Function( - Stitcher, VecMat, VecMat, Mat, ffi.Pointer)>(); + SIFT, Mat, Mat, Mat, ffi.Pointer)>(); - ffi.Pointer Stylization( + ffi.Pointer SIFT_DetectAndCompute_Async( + SIFT self, Mat src, - Mat dst, - double sigma_s, - double sigma_r, + Mat mask, + CvCallback_2 callback, ) { - return _Stylization( + return _SIFT_DetectAndCompute_Async( + self, src, - dst, - sigma_s, - sigma_r, + mask, + callback, ); } - late final _StylizationPtr = _lookup< + late final _SIFT_DetectAndCompute_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - Mat, Mat, ffi.Float, ffi.Float)>>('Stylization'); - late final _Stylization = _StylizationPtr.asFunction< - ffi.Pointer Function(Mat, Mat, double, double)>(); + 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)>(); - void Subdiv2D_Close( - Subdiv2DPtr self, + ffi.Pointer SIFT_Detect_Async( + SIFT self, + Mat src, + CvCallback_1 callback, ) { - return _Subdiv2D_Close( + return _SIFT_Detect_Async( self, + src, + callback, ); } - late final _Subdiv2D_ClosePtr = - _lookup>( - 'Subdiv2D_Close'); - late final _Subdiv2D_Close = - _Subdiv2D_ClosePtr.asFunction(); + 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 Subdiv2D_EdgeDst( - Subdiv2D self, - int edge, - ffi.Pointer dstpt, - ffi.Pointer rval, + ffi.Pointer SVD_Compute( + Mat src, + ffi.Pointer w, + ffi.Pointer u, + ffi.Pointer vt, + int flags, ) { - return _Subdiv2D_EdgeDst( - self, - edge, - dstpt, - rval, + return _SVD_Compute( + src, + w, + u, + vt, + flags, ); } - late final _Subdiv2D_EdgeDstPtr = _lookup< + late final _SVD_ComputePtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Subdiv2D, ffi.Int, - ffi.Pointer, ffi.Pointer)>>('Subdiv2D_EdgeDst'); - late final _Subdiv2D_EdgeDst = _Subdiv2D_EdgeDstPtr.asFunction< + ffi.Pointer Function(Mat, ffi.Pointer, + ffi.Pointer, ffi.Pointer, ffi.Int)>>('SVD_Compute'); + late final _SVD_Compute = _SVD_ComputePtr.asFunction< ffi.Pointer Function( - Subdiv2D, int, ffi.Pointer, ffi.Pointer)>(); + Mat, ffi.Pointer, ffi.Pointer, ffi.Pointer, int)>(); - ffi.Pointer Subdiv2D_EdgeOrg( - Subdiv2D self, - int edge, - ffi.Pointer orgpt, - ffi.Pointer rval, + ffi.Pointer SVD_Compute_Async( + Mat src, + int flags, + CvCallback_3 callback, ) { - return _Subdiv2D_EdgeOrg( - self, - edge, - orgpt, - rval, + return _SVD_Compute_Async( + src, + flags, + callback, ); } - late final _Subdiv2D_EdgeOrgPtr = _lookup< + late final _SVD_Compute_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Subdiv2D, ffi.Int, - ffi.Pointer, ffi.Pointer)>>('Subdiv2D_EdgeOrg'); - late final _Subdiv2D_EdgeOrg = _Subdiv2D_EdgeOrgPtr.asFunction< - ffi.Pointer Function( - Subdiv2D, int, ffi.Pointer, ffi.Pointer)>(); + ffi.Pointer Function( + Mat, ffi.Int, CvCallback_3)>>('SVD_Compute_Async'); + late final _SVD_Compute_Async = _SVD_Compute_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, CvCallback_3)>(); - ffi.Pointer Subdiv2D_FindNearest( - Subdiv2D self, - Point2f pt, - ffi.Pointer nearestPt, - ffi.Pointer rval, + ffi.Pointer SVD_backSubst( + Mat w, + Mat u, + Mat vt, + Mat rhs, + ffi.Pointer dst, ) { - return _Subdiv2D_FindNearest( - self, - pt, - nearestPt, - rval, + return _SVD_backSubst( + w, + u, + vt, + rhs, + dst, ); } - late final _Subdiv2D_FindNearestPtr = _lookup< + late final _SVD_backSubstPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - Subdiv2D, - Point2f, - ffi.Pointer, - ffi.Pointer)>>('Subdiv2D_FindNearest'); - late final _Subdiv2D_FindNearest = _Subdiv2D_FindNearestPtr.asFunction< - ffi.Pointer Function( - Subdiv2D, Point2f, ffi.Pointer, ffi.Pointer)>(); + Mat, Mat, Mat, Mat, ffi.Pointer)>>('SVD_backSubst'); + late final _SVD_backSubst = _SVD_backSubstPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, Mat, ffi.Pointer)>(); - ffi.Pointer Subdiv2D_GetEdge( - Subdiv2D self, - int edge, - int nextEdgeType, - ffi.Pointer rval, + ffi.Pointer SVD_backSubst_Async( + Mat w, + Mat u, + Mat vt, + Mat rhs, + CvCallback_1 callback, + ) { + return _SVD_backSubst_Async( + w, + u, + vt, + rhs, + callback, + ); + } + + late final _SVD_backSubst_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, Mat, Mat, CvCallback_1)>>('SVD_backSubst_Async'); + late final _SVD_backSubst_Async = _SVD_backSubst_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, Mat, CvCallback_1)>(); + + ffi.Pointer Scharr( + Mat src, + Mat dst, + int dDepth, + int dx, + int dy, + double scale, + double delta, + int borderType, + ) { + return _Scharr( + src, + dst, + dDepth, + dx, + dy, + scale, + delta, + borderType, + ); + } + + late final _ScharrPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, ffi.Int, ffi.Int, ffi.Int, + ffi.Double, ffi.Double, ffi.Int)>>('Scharr'); + late final _Scharr = _ScharrPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, int, int, int, double, double, int)>(); + + ffi.Pointer Scharr_Async( + Mat src, + int dDepth, + int dx, + int dy, + double scale, + double delta, + int borderType, + CvCallback_1 callback, + ) { + return _Scharr_Async( + src, + dDepth, + dx, + dy, + scale, + delta, + borderType, + callback, + ); + } + + late final _Scharr_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, ffi.Int, ffi.Int, ffi.Int, + ffi.Double, ffi.Double, ffi.Int, CvCallback_1)>>('Scharr_Async'); + late final _Scharr_Async = _Scharr_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, int, int, int, double, double, int, CvCallback_1)>(); + + ffi.Pointer SeamlessClone( + Mat src, + Mat dst, + Mat mask, + Point p, + Mat blend, + int flags, + ) { + return _SeamlessClone( + src, + dst, + mask, + p, + blend, + flags, + ); + } + + late final _SeamlessClonePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, Mat, Point, Mat, ffi.Int)>>('SeamlessClone'); + late final _SeamlessClone = _SeamlessClonePtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, Point, Mat, int)>(); + + ffi.Pointer SeamlessClone_Async( + Mat src, + Mat dst, + Mat mask, + Point p, + int flags, + CvCallback_1 callback, + ) { + return _SeamlessClone_Async( + src, + dst, + mask, + p, + flags, + callback, + ); + } + + late final _SeamlessClone_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, Mat, Point, ffi.Int, + CvCallback_1)>>('SeamlessClone_Async'); + late final _SeamlessClone_Async = _SeamlessClone_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, Mat, Point, int, CvCallback_1)>(); + + ffi.Pointer SepFilter2D( + Mat src, + Mat dst, + int ddepth, + Mat kernelX, + Mat kernelY, + Point anchor, + double delta, + int borderType, + ) { + return _SepFilter2D( + src, + dst, + ddepth, + kernelX, + kernelY, + anchor, + delta, + borderType, + ); + } + + late final _SepFilter2DPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, ffi.Int, Mat, Mat, Point, + ffi.Double, ffi.Int)>>('SepFilter2D'); + late final _SepFilter2D = _SepFilter2DPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, int, Mat, Mat, Point, double, int)>(); + + ffi.Pointer SepFilter2D_Async( + Mat src, + int ddepth, + Mat kernelX, + Mat kernelY, + Point anchor, + double delta, + int borderType, + CvCallback_1 callback, + ) { + return _SepFilter2D_Async( + src, + ddepth, + kernelX, + kernelY, + anchor, + delta, + borderType, + callback, + ); + } + + late final _SepFilter2D_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, ffi.Int, Mat, Mat, Point, + ffi.Double, ffi.Int, CvCallback_1)>>('SepFilter2D_Async'); + late final _SepFilter2D_Async = _SepFilter2D_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, int, Mat, Mat, Point, double, int, CvCallback_1)>(); + + ffi.Pointer SetNumThreads( + int n, + ) { + return _SetNumThreads( + n, + ); + } + + late final _SetNumThreadsPtr = + _lookup Function(ffi.Int)>>( + 'SetNumThreads'); + late final _SetNumThreads = + _SetNumThreadsPtr.asFunction Function(int)>(); + + ffi.Pointer SetRNGSeed( + int seed, + ) { + return _SetRNGSeed( + seed, + ); + } + + late final _SetRNGSeedPtr = + _lookup Function(ffi.Int)>>( + 'SetRNGSeed'); + late final _SetRNGSeed = + _SetRNGSeedPtr.asFunction Function(int)>(); + + ffi.Pointer SimpleBlobDetectorParams_Create( + ffi.Pointer rval, + ) { + return _SimpleBlobDetectorParams_Create( + rval, + ); + } + + late final _SimpleBlobDetectorParams_CreatePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>( + 'SimpleBlobDetectorParams_Create'); + late final _SimpleBlobDetectorParams_Create = + _SimpleBlobDetectorParams_CreatePtr.asFunction< + ffi.Pointer Function( + ffi.Pointer)>(); + + void SimpleBlobDetector_Close( + SimpleBlobDetectorPtr b, + ) { + return _SimpleBlobDetector_Close( + b, + ); + } + + late final _SimpleBlobDetector_ClosePtr = + _lookup>( + 'SimpleBlobDetector_Close'); + 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, + ) { + return _SimpleBlobDetector_Create( + rval, + ); + } + + late final _SimpleBlobDetector_CreatePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('SimpleBlobDetector_Create'); + late final _SimpleBlobDetector_Create = + _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, + ) { + return _SimpleBlobDetector_Create_WithParams( + params, + rval, + ); + } + + late final _SimpleBlobDetector_Create_WithParamsPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + SimpleBlobDetectorParams, ffi.Pointer)>>( + 'SimpleBlobDetector_Create_WithParams'); + late final _SimpleBlobDetector_Create_WithParams = + _SimpleBlobDetector_Create_WithParamsPtr.asFunction< + 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, + ffi.Pointer rval, + ) { + return _SimpleBlobDetector_Detect( + b, + src, + rval, + ); + } + + late final _SimpleBlobDetector_DetectPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(SimpleBlobDetector, Mat, + ffi.Pointer)>>('SimpleBlobDetector_Detect'); + late final _SimpleBlobDetector_Detect = + _SimpleBlobDetector_DetectPtr.asFunction< + 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, + int ddepth, + int dx, + int dy, + int ksize, + double scale, + double delta, + int borderType, + ) { + return _Sobel( + src, + dst, + ddepth, + dx, + dy, + ksize, + scale, + delta, + borderType, + ); + } + + late final _SobelPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, ffi.Int, ffi.Int, ffi.Int, + ffi.Int, ffi.Double, ffi.Double, ffi.Int)>>('Sobel'); + late final _Sobel = _SobelPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, int, int, int, int, double, double, int)>(); + + ffi.Pointer Sobel_Async( + Mat src, + int ddepth, + int dx, + int dy, + int ksize, + double scale, + double delta, + int borderType, + CvCallback_1 callback, + ) { + return _Sobel_Async( + src, + ddepth, + dx, + dy, + ksize, + scale, + delta, + borderType, + callback, + ); + } + + late final _Sobel_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, + ffi.Int, + ffi.Int, + ffi.Int, + ffi.Int, + ffi.Double, + ffi.Double, + ffi.Int, + CvCallback_1)>>('Sobel_Async'); + late final _Sobel_Async = _Sobel_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, int, int, int, int, double, double, int, CvCallback_1)>(); + + ffi.Pointer SpatialGradient( + Mat src, + Mat dx, + Mat dy, + int ksize, + int borderType, + ) { + return _SpatialGradient( + src, + dx, + dy, + ksize, + borderType, + ); + } + + late final _SpatialGradientPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, Mat, ffi.Int, ffi.Int)>>('SpatialGradient'); + late final _SpatialGradient = _SpatialGradientPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, int, int)>(); + + ffi.Pointer SpatialGradient_Async( + Mat src, + int ksize, + int borderType, + CvCallback_2 callback, + ) { + return _SpatialGradient_Async( + src, + ksize, + borderType, + callback, + ); + } + + late final _SpatialGradient_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, ffi.Int, ffi.Int, CvCallback_2)>>('SpatialGradient_Async'); + late final _SpatialGradient_Async = _SpatialGradient_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, int, CvCallback_2)>(); + + ffi.Pointer SqBoxFilter( + Mat src, + Mat dst, + int ddepth, + Size ps, + ) { + return _SqBoxFilter( + src, + dst, + ddepth, + ps, + ); + } + + late final _SqBoxFilterPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, ffi.Int, Size)>>('SqBoxFilter'); + late final _SqBoxFilter = _SqBoxFilterPtr.asFunction< + ffi.Pointer Function(Mat, Mat, int, Size)>(); + + ffi.Pointer SqBoxFilter_Async( + Mat src, + int ddepth, + Size ps, + CvCallback_1 callback, + ) { + return _SqBoxFilter_Async( + src, + ddepth, + ps, + callback, + ); + } + + late final _SqBoxFilter_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, ffi.Int, Size, CvCallback_1)>>('SqBoxFilter_Async'); + late final _SqBoxFilter_Async = _SqBoxFilter_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, Size, CvCallback_1)>(); + + void Stitcher_Close( + StitcherPtr stitcher, + ) { + return _Stitcher_Close( + stitcher, + ); + } + + late final _Stitcher_ClosePtr = + _lookup>( + 'Stitcher_Close'); + late final _Stitcher_Close = + _Stitcher_ClosePtr.asFunction(); + + void Stitcher_Close_Async( + StitcherPtr stitcher, + CvCallback_0 callback, + ) { + return _Stitcher_Close_Async( + stitcher, + callback, + ); + } + + late final _Stitcher_Close_AsyncPtr = + _lookup>( + 'Stitcher_Close_Async'); + late final _Stitcher_Close_Async = _Stitcher_Close_AsyncPtr.asFunction< + void Function(StitcherPtr, CvCallback_0)>(); + + ffi.Pointer Stitcher_Component( + Stitcher self, + ffi.Pointer rval, + ) { + return _Stitcher_Component( + self, + rval, + ); + } + + late final _Stitcher_ComponentPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Stitcher, ffi.Pointer)>>('Stitcher_Component'); + late final _Stitcher_Component = _Stitcher_ComponentPtr.asFunction< + ffi.Pointer Function(Stitcher, ffi.Pointer)>(); + + ffi.Pointer Stitcher_Component_Async( + Stitcher self, + CvCallback_1 callback, + ) { + return _Stitcher_Component_Async( + self, + callback, + ); + } + + late final _Stitcher_Component_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Stitcher, CvCallback_1)>>('Stitcher_Component_Async'); + late final _Stitcher_Component_Async = _Stitcher_Component_AsyncPtr + .asFunction Function(Stitcher, CvCallback_1)>(); + + ffi.Pointer Stitcher_ComposePanorama( + Stitcher self, + Mat rpano, + ffi.Pointer rval, + ) { + return _Stitcher_ComposePanorama( + self, + rpano, + rval, + ); + } + + late final _Stitcher_ComposePanoramaPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Stitcher, Mat, + ffi.Pointer)>>('Stitcher_ComposePanorama'); + late final _Stitcher_ComposePanorama = + _Stitcher_ComposePanoramaPtr.asFunction< + ffi.Pointer Function( + Stitcher, Mat, ffi.Pointer)>(); + + ffi.Pointer Stitcher_ComposePanorama_1( + Stitcher self, + VecMat mats, + Mat rpano, + ffi.Pointer rval, + ) { + return _Stitcher_ComposePanorama_1( + self, + mats, + rpano, + rval, + ); + } + + late final _Stitcher_ComposePanorama_1Ptr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Stitcher, VecMat, Mat, + ffi.Pointer)>>('Stitcher_ComposePanorama_1'); + late final _Stitcher_ComposePanorama_1 = + _Stitcher_ComposePanorama_1Ptr.asFunction< + ffi.Pointer Function( + Stitcher, VecMat, Mat, ffi.Pointer)>(); + + ffi.Pointer Stitcher_ComposePanorama_1_Async( + Stitcher self, + VecMat mats, + CvCallback_2 callback, + ) { + return _Stitcher_ComposePanorama_1_Async( + self, + mats, + callback, + ); + } + + late final _Stitcher_ComposePanorama_1_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Stitcher, VecMat, + CvCallback_2)>>('Stitcher_ComposePanorama_1_Async'); + late final _Stitcher_ComposePanorama_1_Async = + _Stitcher_ComposePanorama_1_AsyncPtr.asFunction< + ffi.Pointer Function(Stitcher, VecMat, CvCallback_2)>(); + + ffi.Pointer Stitcher_ComposePanorama_Async( + Stitcher self, + CvCallback_2 callback, + ) { + return _Stitcher_ComposePanorama_Async( + self, + callback, + ); + } + + late final _Stitcher_ComposePanorama_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Stitcher, CvCallback_2)>>('Stitcher_ComposePanorama_Async'); + late final _Stitcher_ComposePanorama_Async = + _Stitcher_ComposePanorama_AsyncPtr.asFunction< + ffi.Pointer Function(Stitcher, CvCallback_2)>(); + + ffi.Pointer Stitcher_Create( + int mode, + ffi.Pointer rval, + ) { + return _Stitcher_Create( + mode, + rval, + ); + } + + late final _Stitcher_CreatePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Int, ffi.Pointer)>>('Stitcher_Create'); + late final _Stitcher_Create = _Stitcher_CreatePtr.asFunction< + ffi.Pointer Function(int, ffi.Pointer)>(); + + ffi.Pointer Stitcher_Create_Async( + int mode, + CvCallback_1 callback, + ) { + return _Stitcher_Create_Async( + mode, + callback, + ); + } + + late final _Stitcher_Create_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Int, CvCallback_1)>>('Stitcher_Create_Async'); + late final _Stitcher_Create_Async = _Stitcher_Create_AsyncPtr.asFunction< + ffi.Pointer Function(int, CvCallback_1)>(); + + ffi.Pointer Stitcher_EstimateTransform( + Stitcher self, + VecMat mats, + VecMat masks, + ffi.Pointer rval, + ) { + return _Stitcher_EstimateTransform( + self, + mats, + masks, + rval, + ); + } + + late final _Stitcher_EstimateTransformPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Stitcher, VecMat, VecMat, + ffi.Pointer)>>('Stitcher_EstimateTransform'); + late final _Stitcher_EstimateTransform = + _Stitcher_EstimateTransformPtr.asFunction< + ffi.Pointer Function( + Stitcher, VecMat, VecMat, ffi.Pointer)>(); + + ffi.Pointer Stitcher_EstimateTransform_Async( + Stitcher self, + VecMat mats, + VecMat masks, + CvCallback_1 callback, + ) { + return _Stitcher_EstimateTransform_Async( + self, + mats, + masks, + callback, + ); + } + + late final _Stitcher_EstimateTransform_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Stitcher, VecMat, VecMat, + CvCallback_1)>>('Stitcher_EstimateTransform_Async'); + late final _Stitcher_EstimateTransform_Async = + _Stitcher_EstimateTransform_AsyncPtr.asFunction< + ffi.Pointer Function( + Stitcher, VecMat, VecMat, CvCallback_1)>(); + + ffi.Pointer Stitcher_Get( + Stitcher self, + ffi.Pointer rval, + ) { + return _Stitcher_Get( + self, + rval, + ); + } + + late final _Stitcher_GetPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Stitcher, ffi.Pointer)>>('Stitcher_Get'); + late final _Stitcher_Get = _Stitcher_GetPtr.asFunction< + ffi.Pointer Function(Stitcher, ffi.Pointer)>(); + + ffi.Pointer Stitcher_GetCompositingResol( + Stitcher self, + ffi.Pointer rval, + ) { + return _Stitcher_GetCompositingResol( + self, + rval, + ); + } + + late final _Stitcher_GetCompositingResolPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Stitcher, + ffi.Pointer)>>('Stitcher_GetCompositingResol'); + late final _Stitcher_GetCompositingResol = + _Stitcher_GetCompositingResolPtr.asFunction< + ffi.Pointer Function(Stitcher, ffi.Pointer)>(); + + ffi.Pointer Stitcher_GetCompositingResol_Async( + Stitcher self, + CvCallback_1 callback, + ) { + return _Stitcher_GetCompositingResol_Async( + self, + callback, + ); + } + + late final _Stitcher_GetCompositingResol_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Stitcher, CvCallback_1)>>('Stitcher_GetCompositingResol_Async'); + late final _Stitcher_GetCompositingResol_Async = + _Stitcher_GetCompositingResol_AsyncPtr.asFunction< + ffi.Pointer Function(Stitcher, CvCallback_1)>(); + + ffi.Pointer Stitcher_GetInterpolationFlags( + Stitcher self, + ffi.Pointer rval, + ) { + return _Stitcher_GetInterpolationFlags( + self, + rval, + ); + } + + late final _Stitcher_GetInterpolationFlagsPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Stitcher, + ffi.Pointer)>>('Stitcher_GetInterpolationFlags'); + late final _Stitcher_GetInterpolationFlags = + _Stitcher_GetInterpolationFlagsPtr.asFunction< + ffi.Pointer Function(Stitcher, ffi.Pointer)>(); + + ffi.Pointer Stitcher_GetInterpolationFlags_Async( + Stitcher self, + CvCallback_1 callback, + ) { + return _Stitcher_GetInterpolationFlags_Async( + self, + callback, + ); + } + + late final _Stitcher_GetInterpolationFlags_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Stitcher, CvCallback_1)>>('Stitcher_GetInterpolationFlags_Async'); + late final _Stitcher_GetInterpolationFlags_Async = + _Stitcher_GetInterpolationFlags_AsyncPtr.asFunction< + ffi.Pointer Function(Stitcher, CvCallback_1)>(); + + ffi.Pointer Stitcher_GetPanoConfidenceThresh( + Stitcher self, + ffi.Pointer rval, + ) { + return _Stitcher_GetPanoConfidenceThresh( + self, + rval, + ); + } + + late final _Stitcher_GetPanoConfidenceThreshPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Stitcher, + ffi.Pointer)>>('Stitcher_GetPanoConfidenceThresh'); + late final _Stitcher_GetPanoConfidenceThresh = + _Stitcher_GetPanoConfidenceThreshPtr.asFunction< + ffi.Pointer Function(Stitcher, ffi.Pointer)>(); + + ffi.Pointer Stitcher_GetPanoConfidenceThresh_Async( + Stitcher self, + CvCallback_1 callback, + ) { + return _Stitcher_GetPanoConfidenceThresh_Async( + self, + callback, + ); + } + + late final _Stitcher_GetPanoConfidenceThresh_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Stitcher, + CvCallback_1)>>('Stitcher_GetPanoConfidenceThresh_Async'); + late final _Stitcher_GetPanoConfidenceThresh_Async = + _Stitcher_GetPanoConfidenceThresh_AsyncPtr.asFunction< + ffi.Pointer Function(Stitcher, CvCallback_1)>(); + + ffi.Pointer Stitcher_GetRegistrationResol( + Stitcher self, + ffi.Pointer rval, + ) { + return _Stitcher_GetRegistrationResol( + self, + rval, + ); + } + + late final _Stitcher_GetRegistrationResolPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Stitcher, + ffi.Pointer)>>('Stitcher_GetRegistrationResol'); + late final _Stitcher_GetRegistrationResol = + _Stitcher_GetRegistrationResolPtr.asFunction< + ffi.Pointer Function(Stitcher, ffi.Pointer)>(); + + ffi.Pointer Stitcher_GetRegistrationResol_Async( + Stitcher self, + CvCallback_1 callback, + ) { + return _Stitcher_GetRegistrationResol_Async( + self, + callback, + ); + } + + late final _Stitcher_GetRegistrationResol_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Stitcher, CvCallback_1)>>('Stitcher_GetRegistrationResol_Async'); + late final _Stitcher_GetRegistrationResol_Async = + _Stitcher_GetRegistrationResol_AsyncPtr.asFunction< + ffi.Pointer Function(Stitcher, CvCallback_1)>(); + + ffi.Pointer Stitcher_GetSeamEstimationResol( + Stitcher self, + ffi.Pointer rval, + ) { + return _Stitcher_GetSeamEstimationResol( + self, + rval, + ); + } + + late final _Stitcher_GetSeamEstimationResolPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Stitcher, + ffi.Pointer)>>('Stitcher_GetSeamEstimationResol'); + late final _Stitcher_GetSeamEstimationResol = + _Stitcher_GetSeamEstimationResolPtr.asFunction< + ffi.Pointer Function(Stitcher, ffi.Pointer)>(); + + ffi.Pointer Stitcher_GetSeamEstimationResol_Async( + Stitcher self, + CvCallback_1 callback, + ) { + return _Stitcher_GetSeamEstimationResol_Async( + self, + callback, + ); + } + + late final _Stitcher_GetSeamEstimationResol_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Stitcher, + CvCallback_1)>>('Stitcher_GetSeamEstimationResol_Async'); + late final _Stitcher_GetSeamEstimationResol_Async = + _Stitcher_GetSeamEstimationResol_AsyncPtr.asFunction< + ffi.Pointer Function(Stitcher, CvCallback_1)>(); + + ffi.Pointer Stitcher_GetWaveCorrectKind( + Stitcher self, + ffi.Pointer rval, + ) { + return _Stitcher_GetWaveCorrectKind( + self, + rval, + ); + } + + late final _Stitcher_GetWaveCorrectKindPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Stitcher, ffi.Pointer)>>('Stitcher_GetWaveCorrectKind'); + late final _Stitcher_GetWaveCorrectKind = + _Stitcher_GetWaveCorrectKindPtr.asFunction< + ffi.Pointer Function(Stitcher, ffi.Pointer)>(); + + ffi.Pointer Stitcher_GetWaveCorrectKind_Async( + Stitcher self, + CvCallback_1 callback, + ) { + return _Stitcher_GetWaveCorrectKind_Async( + self, + callback, + ); + } + + late final _Stitcher_GetWaveCorrectKind_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Stitcher, CvCallback_1)>>('Stitcher_GetWaveCorrectKind_Async'); + late final _Stitcher_GetWaveCorrectKind_Async = + _Stitcher_GetWaveCorrectKind_AsyncPtr.asFunction< + ffi.Pointer Function(Stitcher, CvCallback_1)>(); + + ffi.Pointer Stitcher_GetWaveCorrection( + Stitcher self, + ffi.Pointer rval, + ) { + return _Stitcher_GetWaveCorrection( + self, + rval, + ); + } + + late final _Stitcher_GetWaveCorrectionPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Stitcher, ffi.Pointer)>>('Stitcher_GetWaveCorrection'); + late final _Stitcher_GetWaveCorrection = + _Stitcher_GetWaveCorrectionPtr.asFunction< + ffi.Pointer Function(Stitcher, ffi.Pointer)>(); + + ffi.Pointer Stitcher_GetWaveCorrection_Async( + Stitcher self, + CvCallback_1 callback, + ) { + return _Stitcher_GetWaveCorrection_Async( + self, + callback, + ); + } + + late final _Stitcher_GetWaveCorrection_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Stitcher, CvCallback_1)>>('Stitcher_GetWaveCorrection_Async'); + late final _Stitcher_GetWaveCorrection_Async = + _Stitcher_GetWaveCorrection_AsyncPtr.asFunction< + ffi.Pointer Function(Stitcher, CvCallback_1)>(); + + ffi.Pointer Stitcher_SetCompositingResol( + Stitcher self, + double inval, + ) { + return _Stitcher_SetCompositingResol( + self, + inval, + ); + } + + late final _Stitcher_SetCompositingResolPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Stitcher, ffi.Double)>>('Stitcher_SetCompositingResol'); + late final _Stitcher_SetCompositingResol = _Stitcher_SetCompositingResolPtr + .asFunction Function(Stitcher, double)>(); + + ffi.Pointer Stitcher_SetCompositingResol_Async( + Stitcher self, + double inval, + CvCallback_0 callback, + ) { + return _Stitcher_SetCompositingResol_Async( + self, + inval, + callback, + ); + } + + late final _Stitcher_SetCompositingResol_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Stitcher, ffi.Double, + CvCallback_0)>>('Stitcher_SetCompositingResol_Async'); + late final _Stitcher_SetCompositingResol_Async = + _Stitcher_SetCompositingResol_AsyncPtr.asFunction< + ffi.Pointer Function(Stitcher, double, CvCallback_0)>(); + + ffi.Pointer Stitcher_SetInterpolationFlags( + Stitcher self, + int inval, + ) { + return _Stitcher_SetInterpolationFlags( + self, + inval, + ); + } + + late final _Stitcher_SetInterpolationFlagsPtr = _lookup< + ffi + .NativeFunction Function(Stitcher, ffi.Int)>>( + 'Stitcher_SetInterpolationFlags'); + late final _Stitcher_SetInterpolationFlags = + _Stitcher_SetInterpolationFlagsPtr.asFunction< + ffi.Pointer Function(Stitcher, int)>(); + + ffi.Pointer Stitcher_SetInterpolationFlags_Async( + Stitcher self, + int inval, + CvCallback_0 callback, + ) { + return _Stitcher_SetInterpolationFlags_Async( + self, + inval, + callback, + ); + } + + late final _Stitcher_SetInterpolationFlags_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Stitcher, ffi.Int, + CvCallback_0)>>('Stitcher_SetInterpolationFlags_Async'); + late final _Stitcher_SetInterpolationFlags_Async = + _Stitcher_SetInterpolationFlags_AsyncPtr.asFunction< + ffi.Pointer Function(Stitcher, int, CvCallback_0)>(); + + ffi.Pointer Stitcher_SetPanoConfidenceThresh( + Stitcher self, + double inval, + ) { + return _Stitcher_SetPanoConfidenceThresh( + self, + inval, + ); + } + + late final _Stitcher_SetPanoConfidenceThreshPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Stitcher, ffi.Double)>>('Stitcher_SetPanoConfidenceThresh'); + late final _Stitcher_SetPanoConfidenceThresh = + _Stitcher_SetPanoConfidenceThreshPtr.asFunction< + ffi.Pointer Function(Stitcher, double)>(); + + ffi.Pointer Stitcher_SetPanoConfidenceThresh_Async( + Stitcher self, + double inval, + CvCallback_0 callback, + ) { + return _Stitcher_SetPanoConfidenceThresh_Async( + self, + inval, + callback, + ); + } + + late final _Stitcher_SetPanoConfidenceThresh_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Stitcher, ffi.Double, + CvCallback_0)>>('Stitcher_SetPanoConfidenceThresh_Async'); + late final _Stitcher_SetPanoConfidenceThresh_Async = + _Stitcher_SetPanoConfidenceThresh_AsyncPtr.asFunction< + ffi.Pointer Function(Stitcher, double, CvCallback_0)>(); + + ffi.Pointer Stitcher_SetRegistrationResol( + Stitcher self, + double inval, + ) { + return _Stitcher_SetRegistrationResol( + self, + inval, + ); + } + + late final _Stitcher_SetRegistrationResolPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Stitcher, ffi.Double)>>('Stitcher_SetRegistrationResol'); + late final _Stitcher_SetRegistrationResol = _Stitcher_SetRegistrationResolPtr + .asFunction Function(Stitcher, double)>(); + + ffi.Pointer Stitcher_SetRegistrationResol_Async( + Stitcher self, + double inval, + CvCallback_0 callback, + ) { + return _Stitcher_SetRegistrationResol_Async( + self, + inval, + callback, + ); + } + + late final _Stitcher_SetRegistrationResol_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Stitcher, ffi.Double, + CvCallback_0)>>('Stitcher_SetRegistrationResol_Async'); + late final _Stitcher_SetRegistrationResol_Async = + _Stitcher_SetRegistrationResol_AsyncPtr.asFunction< + ffi.Pointer Function(Stitcher, double, CvCallback_0)>(); + + ffi.Pointer Stitcher_SetSeamEstimationResol( + Stitcher self, + double inval, + ) { + return _Stitcher_SetSeamEstimationResol( + self, + inval, + ); + } + + late final _Stitcher_SetSeamEstimationResolPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Stitcher, ffi.Double)>>('Stitcher_SetSeamEstimationResol'); + late final _Stitcher_SetSeamEstimationResol = + _Stitcher_SetSeamEstimationResolPtr.asFunction< + ffi.Pointer Function(Stitcher, double)>(); + + ffi.Pointer Stitcher_SetSeamEstimationResol_Async( + Stitcher self, + double inval, + CvCallback_0 callback, + ) { + return _Stitcher_SetSeamEstimationResol_Async( + self, + inval, + callback, + ); + } + + late final _Stitcher_SetSeamEstimationResol_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Stitcher, ffi.Double, + CvCallback_0)>>('Stitcher_SetSeamEstimationResol_Async'); + late final _Stitcher_SetSeamEstimationResol_Async = + _Stitcher_SetSeamEstimationResol_AsyncPtr.asFunction< + ffi.Pointer Function(Stitcher, double, CvCallback_0)>(); + + ffi.Pointer Stitcher_SetWaveCorrectKind( + Stitcher self, + int inval, + ) { + return _Stitcher_SetWaveCorrectKind( + self, + inval, + ); + } + + late final _Stitcher_SetWaveCorrectKindPtr = _lookup< + ffi + .NativeFunction Function(Stitcher, ffi.Int)>>( + 'Stitcher_SetWaveCorrectKind'); + late final _Stitcher_SetWaveCorrectKind = _Stitcher_SetWaveCorrectKindPtr + .asFunction Function(Stitcher, int)>(); + + ffi.Pointer Stitcher_SetWaveCorrectKind_Async( + Stitcher self, + int inval, + CvCallback_0 callback, + ) { + return _Stitcher_SetWaveCorrectKind_Async( + self, + inval, + callback, + ); + } + + late final _Stitcher_SetWaveCorrectKind_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Stitcher, ffi.Int, + CvCallback_0)>>('Stitcher_SetWaveCorrectKind_Async'); + late final _Stitcher_SetWaveCorrectKind_Async = + _Stitcher_SetWaveCorrectKind_AsyncPtr.asFunction< + ffi.Pointer Function(Stitcher, int, CvCallback_0)>(); + + ffi.Pointer Stitcher_SetWaveCorrection( + Stitcher self, + bool inval, + ) { + return _Stitcher_SetWaveCorrection( + self, + inval, + ); + } + + late final _Stitcher_SetWaveCorrectionPtr = _lookup< + ffi + .NativeFunction Function(Stitcher, ffi.Bool)>>( + 'Stitcher_SetWaveCorrection'); + late final _Stitcher_SetWaveCorrection = _Stitcher_SetWaveCorrectionPtr + .asFunction Function(Stitcher, bool)>(); + + ffi.Pointer Stitcher_SetWaveCorrection_Async( + Stitcher self, + bool inval, + CvCallback_0 callback, + ) { + return _Stitcher_SetWaveCorrection_Async( + self, + inval, + callback, + ); + } + + late final _Stitcher_SetWaveCorrection_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Stitcher, ffi.Bool, + CvCallback_0)>>('Stitcher_SetWaveCorrection_Async'); + late final _Stitcher_SetWaveCorrection_Async = + _Stitcher_SetWaveCorrection_AsyncPtr.asFunction< + ffi.Pointer Function(Stitcher, bool, CvCallback_0)>(); + + ffi.Pointer Stitcher_Stitch( + Stitcher self, + VecMat mats, + Mat rpano, + ffi.Pointer rval, + ) { + return _Stitcher_Stitch( + self, + mats, + rpano, + rval, + ); + } + + late final _Stitcher_StitchPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Stitcher, VecMat, Mat, ffi.Pointer)>>('Stitcher_Stitch'); + late final _Stitcher_Stitch = _Stitcher_StitchPtr.asFunction< + ffi.Pointer Function( + Stitcher, VecMat, Mat, ffi.Pointer)>(); + + ffi.Pointer Stitcher_Stitch_1( + Stitcher self, + VecMat mats, + VecMat masks, + Mat rpano, + ffi.Pointer rval, + ) { + return _Stitcher_Stitch_1( + self, + mats, + masks, + rpano, + rval, + ); + } + + late final _Stitcher_Stitch_1Ptr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Stitcher, VecMat, VecMat, Mat, + ffi.Pointer)>>('Stitcher_Stitch_1'); + late final _Stitcher_Stitch_1 = _Stitcher_Stitch_1Ptr.asFunction< + ffi.Pointer Function( + Stitcher, VecMat, VecMat, Mat, ffi.Pointer)>(); + + ffi.Pointer Stitcher_Stitch_1_Async( + Stitcher self, + VecMat mats, + VecMat masks, + CvCallback_2 callback, + ) { + return _Stitcher_Stitch_1_Async( + self, + mats, + masks, + callback, + ); + } + + late final _Stitcher_Stitch_1_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Stitcher, VecMat, VecMat, + CvCallback_2)>>('Stitcher_Stitch_1_Async'); + late final _Stitcher_Stitch_1_Async = _Stitcher_Stitch_1_AsyncPtr.asFunction< + ffi.Pointer Function(Stitcher, VecMat, VecMat, CvCallback_2)>(); + + ffi.Pointer Stitcher_Stitch_Async( + Stitcher self, + VecMat mats, + CvCallback_2 callback, + ) { + return _Stitcher_Stitch_Async( + self, + mats, + callback, + ); + } + + late final _Stitcher_Stitch_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Stitcher, VecMat, CvCallback_2)>>('Stitcher_Stitch_Async'); + late final _Stitcher_Stitch_Async = _Stitcher_Stitch_AsyncPtr.asFunction< + ffi.Pointer Function(Stitcher, VecMat, CvCallback_2)>(); + + ffi.Pointer Stylization( + Mat src, + Mat dst, + double sigma_s, + double sigma_r, + ) { + return _Stylization( + src, + dst, + sigma_s, + sigma_r, + ); + } + + late final _StylizationPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, ffi.Float, ffi.Float)>>('Stylization'); + late final _Stylization = _StylizationPtr.asFunction< + ffi.Pointer Function(Mat, Mat, double, double)>(); + + ffi.Pointer Stylization_Async( + Mat src, + double sigma_s, + double sigma_r, + CvCallback_1 callback, + ) { + return _Stylization_Async( + src, + sigma_s, + sigma_r, + callback, + ); + } + + late final _Stylization_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, ffi.Float, ffi.Float, CvCallback_1)>>('Stylization_Async'); + late final _Stylization_Async = _Stylization_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, double, double, CvCallback_1)>(); + + void Subdiv2D_Close( + Subdiv2DPtr self, + ) { + return _Subdiv2D_Close( + self, + ); + } + + late final _Subdiv2D_ClosePtr = + _lookup>( + 'Subdiv2D_Close'); + late final _Subdiv2D_Close = + _Subdiv2D_ClosePtr.asFunction(); + + void Subdiv2D_Close_Async( + Subdiv2DPtr self, + CvCallback_0 callback, + ) { + return _Subdiv2D_Close_Async( + self, + callback, + ); + } + + late final _Subdiv2D_Close_AsyncPtr = + _lookup>( + 'Subdiv2D_Close_Async'); + late final _Subdiv2D_Close_Async = _Subdiv2D_Close_AsyncPtr.asFunction< + void Function(Subdiv2DPtr, CvCallback_0)>(); + + ffi.Pointer Subdiv2D_EdgeDst( + Subdiv2D self, + int edge, + ffi.Pointer dstpt, + ffi.Pointer rval, + ) { + return _Subdiv2D_EdgeDst( + self, + edge, + dstpt, + rval, + ); + } + + late final _Subdiv2D_EdgeDstPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Subdiv2D, ffi.Int, + ffi.Pointer, ffi.Pointer)>>('Subdiv2D_EdgeDst'); + late final _Subdiv2D_EdgeDst = _Subdiv2D_EdgeDstPtr.asFunction< + ffi.Pointer Function( + Subdiv2D, int, ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer Subdiv2D_EdgeDst_Async( + Subdiv2D self, + int edge, + CvCallback_2 callback, + ) { + return _Subdiv2D_EdgeDst_Async( + self, + edge, + callback, + ); + } + + late final _Subdiv2D_EdgeDst_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Subdiv2D, ffi.Int, CvCallback_2)>>('Subdiv2D_EdgeDst_Async'); + late final _Subdiv2D_EdgeDst_Async = _Subdiv2D_EdgeDst_AsyncPtr.asFunction< + ffi.Pointer Function(Subdiv2D, int, CvCallback_2)>(); + + ffi.Pointer Subdiv2D_EdgeOrg( + Subdiv2D self, + int edge, + ffi.Pointer orgpt, + ffi.Pointer rval, + ) { + return _Subdiv2D_EdgeOrg( + self, + edge, + orgpt, + rval, + ); + } + + late final _Subdiv2D_EdgeOrgPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Subdiv2D, ffi.Int, + ffi.Pointer, ffi.Pointer)>>('Subdiv2D_EdgeOrg'); + late final _Subdiv2D_EdgeOrg = _Subdiv2D_EdgeOrgPtr.asFunction< + ffi.Pointer Function( + Subdiv2D, int, ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer Subdiv2D_EdgeOrg_Async( + Subdiv2D self, + int edge, + CvCallback_2 callback, + ) { + return _Subdiv2D_EdgeOrg_Async( + self, + edge, + callback, + ); + } + + late final _Subdiv2D_EdgeOrg_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Subdiv2D, ffi.Int, CvCallback_2)>>('Subdiv2D_EdgeOrg_Async'); + late final _Subdiv2D_EdgeOrg_Async = _Subdiv2D_EdgeOrg_AsyncPtr.asFunction< + ffi.Pointer Function(Subdiv2D, int, CvCallback_2)>(); + + ffi.Pointer Subdiv2D_FindNearest( + Subdiv2D self, + Point2f pt, + ffi.Pointer nearestPt, + ffi.Pointer rval, + ) { + return _Subdiv2D_FindNearest( + self, + pt, + nearestPt, + rval, + ); + } + + late final _Subdiv2D_FindNearestPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Subdiv2D, + Point2f, + ffi.Pointer, + ffi.Pointer)>>('Subdiv2D_FindNearest'); + late final _Subdiv2D_FindNearest = _Subdiv2D_FindNearestPtr.asFunction< + ffi.Pointer Function( + Subdiv2D, Point2f, ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer Subdiv2D_FindNearest_Async( + Subdiv2D self, + Point2f pt, + CvCallback_2 callback, + ) { + return _Subdiv2D_FindNearest_Async( + self, + pt, + callback, + ); + } + + late final _Subdiv2D_FindNearest_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Subdiv2D, Point2f, CvCallback_2)>>('Subdiv2D_FindNearest_Async'); + late final _Subdiv2D_FindNearest_Async = + _Subdiv2D_FindNearest_AsyncPtr.asFunction< + ffi.Pointer Function(Subdiv2D, Point2f, CvCallback_2)>(); + + ffi.Pointer Subdiv2D_GetEdge( + Subdiv2D self, + int edge, + int nextEdgeType, + ffi.Pointer rval, + ) { + return _Subdiv2D_GetEdge( + self, + edge, + nextEdgeType, + rval, + ); + } + + late final _Subdiv2D_GetEdgePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Subdiv2D, ffi.Int, ffi.Int, + ffi.Pointer)>>('Subdiv2D_GetEdge'); + late final _Subdiv2D_GetEdge = _Subdiv2D_GetEdgePtr.asFunction< + ffi.Pointer Function( + Subdiv2D, int, int, ffi.Pointer)>(); + + ffi.Pointer Subdiv2D_GetEdgeList( + Subdiv2D self, + ffi.Pointer> rval, + ffi.Pointer size, + ) { + return _Subdiv2D_GetEdgeList( + self, + rval, + size, + ); + } + + late final _Subdiv2D_GetEdgeListPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Subdiv2D, + ffi.Pointer>, + ffi.Pointer)>>('Subdiv2D_GetEdgeList'); + late final _Subdiv2D_GetEdgeList = _Subdiv2D_GetEdgeListPtr.asFunction< + ffi.Pointer Function( + Subdiv2D, ffi.Pointer>, ffi.Pointer)>(); + + ffi.Pointer Subdiv2D_GetEdgeList_Async( + Subdiv2D self, + CvCallback_1 callback, + ) { + return _Subdiv2D_GetEdgeList_Async( + self, + callback, + ); + } + + late final _Subdiv2D_GetEdgeList_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Subdiv2D, CvCallback_1)>>('Subdiv2D_GetEdgeList_Async'); + late final _Subdiv2D_GetEdgeList_Async = _Subdiv2D_GetEdgeList_AsyncPtr + .asFunction Function(Subdiv2D, CvCallback_1)>(); + + ffi.Pointer Subdiv2D_GetEdge_Async( + Subdiv2D self, + int edge, + int nextEdgeType, + CvCallback_1 callback, + ) { + return _Subdiv2D_GetEdge_Async( + self, + edge, + nextEdgeType, + callback, + ); + } + + late final _Subdiv2D_GetEdge_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Subdiv2D, ffi.Int, ffi.Int, + CvCallback_1)>>('Subdiv2D_GetEdge_Async'); + late final _Subdiv2D_GetEdge_Async = _Subdiv2D_GetEdge_AsyncPtr.asFunction< + ffi.Pointer Function(Subdiv2D, int, int, CvCallback_1)>(); + + ffi.Pointer Subdiv2D_GetLeadingEdgeList( + Subdiv2D self, + ffi.Pointer leadingEdgeList, + ) { + return _Subdiv2D_GetLeadingEdgeList( + self, + leadingEdgeList, + ); + } + + late final _Subdiv2D_GetLeadingEdgeListPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Subdiv2D, ffi.Pointer)>>('Subdiv2D_GetLeadingEdgeList'); + late final _Subdiv2D_GetLeadingEdgeList = + _Subdiv2D_GetLeadingEdgeListPtr.asFunction< + ffi.Pointer Function(Subdiv2D, ffi.Pointer)>(); + + ffi.Pointer Subdiv2D_GetLeadingEdgeList_Async( + Subdiv2D self, + CvCallback_1 callback, + ) { + return _Subdiv2D_GetLeadingEdgeList_Async( + self, + callback, + ); + } + + late final _Subdiv2D_GetLeadingEdgeList_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Subdiv2D, CvCallback_1)>>('Subdiv2D_GetLeadingEdgeList_Async'); + late final _Subdiv2D_GetLeadingEdgeList_Async = + _Subdiv2D_GetLeadingEdgeList_AsyncPtr.asFunction< + ffi.Pointer Function(Subdiv2D, CvCallback_1)>(); + + ffi.Pointer Subdiv2D_GetTriangleList( + Subdiv2D self, + ffi.Pointer> rval, + ffi.Pointer size, + ) { + return _Subdiv2D_GetTriangleList( + self, + rval, + size, + ); + } + + late final _Subdiv2D_GetTriangleListPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Subdiv2D, + ffi.Pointer>, + ffi.Pointer)>>('Subdiv2D_GetTriangleList'); + late final _Subdiv2D_GetTriangleList = + _Subdiv2D_GetTriangleListPtr.asFunction< + ffi.Pointer Function(Subdiv2D, + ffi.Pointer>, ffi.Pointer)>(); + + ffi.Pointer Subdiv2D_GetTriangleList_Async( + Subdiv2D self, + CvCallback_1 callback, + ) { + return _Subdiv2D_GetTriangleList_Async( + self, + callback, + ); + } + + late final _Subdiv2D_GetTriangleList_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Subdiv2D, CvCallback_1)>>('Subdiv2D_GetTriangleList_Async'); + late final _Subdiv2D_GetTriangleList_Async = + _Subdiv2D_GetTriangleList_AsyncPtr.asFunction< + ffi.Pointer Function(Subdiv2D, CvCallback_1)>(); + + ffi.Pointer Subdiv2D_GetVertex( + Subdiv2D self, + int vertex, + ffi.Pointer firstEdge, + ffi.Pointer rval, + ) { + return _Subdiv2D_GetVertex( + self, + vertex, + firstEdge, + rval, + ); + } + + late final _Subdiv2D_GetVertexPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Subdiv2D, + ffi.Int, + ffi.Pointer, + ffi.Pointer)>>('Subdiv2D_GetVertex'); + late final _Subdiv2D_GetVertex = _Subdiv2D_GetVertexPtr.asFunction< + ffi.Pointer Function( + Subdiv2D, int, ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer Subdiv2D_GetVertex_Async( + Subdiv2D self, + int vertex, + CvCallback_2 callback, + ) { + return _Subdiv2D_GetVertex_Async( + self, + vertex, + callback, + ); + } + + late final _Subdiv2D_GetVertex_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Subdiv2D, ffi.Int, CvCallback_2)>>('Subdiv2D_GetVertex_Async'); + late final _Subdiv2D_GetVertex_Async = + _Subdiv2D_GetVertex_AsyncPtr.asFunction< + ffi.Pointer Function(Subdiv2D, int, CvCallback_2)>(); + + ffi.Pointer Subdiv2D_GetVoronoiFacetList( + Subdiv2D self, + VecInt idx, + ffi.Pointer facetList, + ffi.Pointer facetCenters, + ) { + return _Subdiv2D_GetVoronoiFacetList( + self, + idx, + facetList, + facetCenters, + ); + } + + late final _Subdiv2D_GetVoronoiFacetListPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Subdiv2D, + VecInt, + ffi.Pointer, + ffi.Pointer)>>('Subdiv2D_GetVoronoiFacetList'); + late final _Subdiv2D_GetVoronoiFacetList = + _Subdiv2D_GetVoronoiFacetListPtr.asFunction< + ffi.Pointer Function(Subdiv2D, VecInt, + ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer Subdiv2D_GetVoronoiFacetList_Async( + Subdiv2D self, + VecInt idx, + CvCallback_2 callback, + ) { + return _Subdiv2D_GetVoronoiFacetList_Async( + self, + idx, + callback, + ); + } + + late final _Subdiv2D_GetVoronoiFacetList_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Subdiv2D, VecInt, + CvCallback_2)>>('Subdiv2D_GetVoronoiFacetList_Async'); + late final _Subdiv2D_GetVoronoiFacetList_Async = + _Subdiv2D_GetVoronoiFacetList_AsyncPtr.asFunction< + ffi.Pointer Function(Subdiv2D, VecInt, CvCallback_2)>(); + + ffi.Pointer Subdiv2D_InitDelaunay( + Subdiv2D self, + Rect rect, + ) { + return _Subdiv2D_InitDelaunay( + self, + rect, + ); + } + + late final _Subdiv2D_InitDelaunayPtr = _lookup< + ffi.NativeFunction Function(Subdiv2D, Rect)>>( + 'Subdiv2D_InitDelaunay'); + late final _Subdiv2D_InitDelaunay = _Subdiv2D_InitDelaunayPtr.asFunction< + ffi.Pointer Function(Subdiv2D, Rect)>(); + + ffi.Pointer Subdiv2D_InitDelaunay_Async( + Subdiv2D self, + Rect rect, + CvCallback_0 callback, + ) { + return _Subdiv2D_InitDelaunay_Async( + self, + rect, + callback, + ); + } + + late final _Subdiv2D_InitDelaunay_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Subdiv2D, Rect, CvCallback_0)>>('Subdiv2D_InitDelaunay_Async'); + late final _Subdiv2D_InitDelaunay_Async = + _Subdiv2D_InitDelaunay_AsyncPtr.asFunction< + ffi.Pointer Function(Subdiv2D, Rect, CvCallback_0)>(); + + ffi.Pointer Subdiv2D_Insert( + Subdiv2D self, + Point2f pt, + ffi.Pointer rval, + ) { + return _Subdiv2D_Insert( + self, + pt, + rval, + ); + } + + late final _Subdiv2D_InsertPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Subdiv2D, Point2f, ffi.Pointer)>>('Subdiv2D_Insert'); + late final _Subdiv2D_Insert = _Subdiv2D_InsertPtr.asFunction< + ffi.Pointer Function( + Subdiv2D, Point2f, ffi.Pointer)>(); + + ffi.Pointer Subdiv2D_InsertVec( + Subdiv2D self, + VecPoint2f ptvec, + ) { + return _Subdiv2D_InsertVec( + self, + ptvec, + ); + } + + late final _Subdiv2D_InsertVecPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Subdiv2D, VecPoint2f)>>('Subdiv2D_InsertVec'); + late final _Subdiv2D_InsertVec = _Subdiv2D_InsertVecPtr.asFunction< + ffi.Pointer Function(Subdiv2D, VecPoint2f)>(); + + ffi.Pointer Subdiv2D_InsertVec_Async( + Subdiv2D self, + VecPoint2f ptvec, + CvCallback_0 callback, + ) { + return _Subdiv2D_InsertVec_Async( + self, + ptvec, + callback, + ); + } + + late final _Subdiv2D_InsertVec_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Subdiv2D, VecPoint2f, CvCallback_0)>>('Subdiv2D_InsertVec_Async'); + late final _Subdiv2D_InsertVec_Async = + _Subdiv2D_InsertVec_AsyncPtr.asFunction< + ffi.Pointer Function(Subdiv2D, VecPoint2f, CvCallback_0)>(); + + ffi.Pointer Subdiv2D_Insert_Async( + Subdiv2D self, + Point2f pt, + CvCallback_1 callback, + ) { + return _Subdiv2D_Insert_Async( + self, + pt, + callback, + ); + } + + late final _Subdiv2D_Insert_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Subdiv2D, Point2f, CvCallback_1)>>('Subdiv2D_Insert_Async'); + late final _Subdiv2D_Insert_Async = _Subdiv2D_Insert_AsyncPtr.asFunction< + ffi.Pointer Function(Subdiv2D, Point2f, CvCallback_1)>(); + + ffi.Pointer Subdiv2D_Locate( + Subdiv2D self, + Point2f pt, + ffi.Pointer edge, + ffi.Pointer vertex, + ffi.Pointer rval, + ) { + return _Subdiv2D_Locate( + self, + pt, + edge, + vertex, + rval, + ); + } + + late final _Subdiv2D_LocatePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Subdiv2D, + Point2f, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>('Subdiv2D_Locate'); + late final _Subdiv2D_Locate = _Subdiv2D_LocatePtr.asFunction< + ffi.Pointer Function(Subdiv2D, Point2f, ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer Subdiv2D_Locate_Async( + Subdiv2D self, + Point2f pt, + CvCallback_3 callback, + ) { + return _Subdiv2D_Locate_Async( + self, + pt, + callback, + ); + } + + late final _Subdiv2D_Locate_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Subdiv2D, Point2f, CvCallback_3)>>('Subdiv2D_Locate_Async'); + late final _Subdiv2D_Locate_Async = _Subdiv2D_Locate_AsyncPtr.asFunction< + ffi.Pointer Function(Subdiv2D, Point2f, CvCallback_3)>(); + + ffi.Pointer Subdiv2D_NewEmpty( + ffi.Pointer rval, + ) { + return _Subdiv2D_NewEmpty( + rval, + ); + } + + late final _Subdiv2D_NewEmptyPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('Subdiv2D_NewEmpty'); + late final _Subdiv2D_NewEmpty = _Subdiv2D_NewEmptyPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer Subdiv2D_NewEmpty_Async( + CvCallback_1 callback, + ) { + return _Subdiv2D_NewEmpty_Async( + callback, + ); + } + + late final _Subdiv2D_NewEmpty_AsyncPtr = + _lookup Function(CvCallback_1)>>( + 'Subdiv2D_NewEmpty_Async'); + late final _Subdiv2D_NewEmpty_Async = _Subdiv2D_NewEmpty_AsyncPtr.asFunction< + ffi.Pointer Function(CvCallback_1)>(); + + ffi.Pointer Subdiv2D_NewWithRect( + Rect rect, + ffi.Pointer rval, + ) { + return _Subdiv2D_NewWithRect( + rect, + rval, + ); + } + + late final _Subdiv2D_NewWithRectPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Rect, ffi.Pointer)>>('Subdiv2D_NewWithRect'); + late final _Subdiv2D_NewWithRect = _Subdiv2D_NewWithRectPtr.asFunction< + ffi.Pointer Function(Rect, ffi.Pointer)>(); + + ffi.Pointer Subdiv2D_NewWithRect_Async( + Rect rect, + CvCallback_1 callback, + ) { + return _Subdiv2D_NewWithRect_Async( + rect, + callback, + ); + } + + late final _Subdiv2D_NewWithRect_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Rect, CvCallback_1)>>( + 'Subdiv2D_NewWithRect_Async'); + late final _Subdiv2D_NewWithRect_Async = _Subdiv2D_NewWithRect_AsyncPtr + .asFunction Function(Rect, CvCallback_1)>(); + + ffi.Pointer Subdiv2D_NextEdge( + Subdiv2D self, + int edge, + ffi.Pointer rval, + ) { + return _Subdiv2D_NextEdge( + self, + edge, + rval, + ); + } + + late final _Subdiv2D_NextEdgePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Subdiv2D, ffi.Int, ffi.Pointer)>>('Subdiv2D_NextEdge'); + late final _Subdiv2D_NextEdge = _Subdiv2D_NextEdgePtr.asFunction< + ffi.Pointer Function(Subdiv2D, int, ffi.Pointer)>(); + + ffi.Pointer Subdiv2D_NextEdge_Async( + Subdiv2D self, + int edge, + CvCallback_1 callback, + ) { + return _Subdiv2D_NextEdge_Async( + self, + edge, + callback, + ); + } + + late final _Subdiv2D_NextEdge_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Subdiv2D, ffi.Int, CvCallback_1)>>('Subdiv2D_NextEdge_Async'); + late final _Subdiv2D_NextEdge_Async = _Subdiv2D_NextEdge_AsyncPtr.asFunction< + ffi.Pointer Function(Subdiv2D, int, CvCallback_1)>(); + + ffi.Pointer Subdiv2D_RotateEdge( + Subdiv2D self, + int edge, + int rotate, + ffi.Pointer rval, + ) { + return _Subdiv2D_RotateEdge( + self, + edge, + rotate, + rval, + ); + } + + late final _Subdiv2D_RotateEdgePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Subdiv2D, ffi.Int, ffi.Int, + ffi.Pointer)>>('Subdiv2D_RotateEdge'); + late final _Subdiv2D_RotateEdge = _Subdiv2D_RotateEdgePtr.asFunction< + ffi.Pointer Function( + Subdiv2D, int, int, ffi.Pointer)>(); + + ffi.Pointer Subdiv2D_RotateEdge_Async( + Subdiv2D self, + int edge, + int rotate, + CvCallback_1 callback, + ) { + return _Subdiv2D_RotateEdge_Async( + self, + edge, + rotate, + callback, + ); + } + + late final _Subdiv2D_RotateEdge_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Subdiv2D, ffi.Int, ffi.Int, + CvCallback_1)>>('Subdiv2D_RotateEdge_Async'); + late final _Subdiv2D_RotateEdge_Async = + _Subdiv2D_RotateEdge_AsyncPtr.asFunction< + ffi.Pointer Function(Subdiv2D, int, int, CvCallback_1)>(); + + ffi.Pointer Subdiv2D_SymEdge( + Subdiv2D self, + int edge, + ffi.Pointer rval, + ) { + return _Subdiv2D_SymEdge( + self, + edge, + rval, + ); + } + + late final _Subdiv2D_SymEdgePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Subdiv2D, ffi.Int, ffi.Pointer)>>('Subdiv2D_SymEdge'); + late final _Subdiv2D_SymEdge = _Subdiv2D_SymEdgePtr.asFunction< + ffi.Pointer Function(Subdiv2D, int, ffi.Pointer)>(); + + ffi.Pointer Subdiv2D_SymEdge_Async( + Subdiv2D self, + int edge, + CvCallback_1 callback, + ) { + return _Subdiv2D_SymEdge_Async( + self, + edge, + callback, + ); + } + + late final _Subdiv2D_SymEdge_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Subdiv2D, ffi.Int, CvCallback_1)>>('Subdiv2D_SymEdge_Async'); + late final _Subdiv2D_SymEdge_Async = _Subdiv2D_SymEdge_AsyncPtr.asFunction< + ffi.Pointer Function(Subdiv2D, int, CvCallback_1)>(); + + ffi.Pointer TextureFlattening( + Mat src, + Mat mask, + Mat dst, + double low_threshold, + double high_threshold, + int kernel_size, + ) { + return _TextureFlattening( + src, + mask, + dst, + low_threshold, + high_threshold, + kernel_size, + ); + } + + late final _TextureFlatteningPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, Mat, ffi.Float, ffi.Float, + ffi.Int)>>('TextureFlattening'); + late final _TextureFlattening = _TextureFlatteningPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, double, double, int)>(); + + ffi.Pointer TextureFlattening_Async( + Mat src, + Mat mask, + double low_threshold, + double high_threshold, + int kernel_size, + CvCallback_1 callback, + ) { + return _TextureFlattening_Async( + src, + mask, + low_threshold, + high_threshold, + kernel_size, + callback, + ); + } + + late final _TextureFlattening_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, ffi.Float, ffi.Float, + ffi.Int, CvCallback_1)>>('TextureFlattening_Async'); + late final _TextureFlattening_Async = _TextureFlattening_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, double, double, int, CvCallback_1)>(); + + ffi.Pointer TheRNG( + ffi.Pointer rval, + ) { + return _TheRNG( + rval, + ); + } + + late final _TheRNGPtr = _lookup< + ffi.NativeFunction Function(ffi.Pointer)>>( + 'TheRNG'); + late final _TheRNG = + _TheRNGPtr.asFunction Function(ffi.Pointer)>(); + + ffi.Pointer Threshold( + Mat src, + Mat dst, + double thresh, + double maxvalue, + int typ, + ffi.Pointer rval, + ) { + return _Threshold( + src, + dst, + thresh, + maxvalue, + typ, + rval, + ); + } + + late final _ThresholdPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, ffi.Double, ffi.Double, + ffi.Int, ffi.Pointer)>>('Threshold'); + late final _Threshold = _ThresholdPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, double, double, int, ffi.Pointer)>(); + + ffi.Pointer Threshold_Async( + Mat src, + double thresh, + double maxvalue, + int typ, + CvCallback_2 callback, + ) { + return _Threshold_Async( + src, + thresh, + maxvalue, + typ, + callback, + ); + } + + late final _Threshold_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, ffi.Double, ffi.Double, ffi.Int, + CvCallback_2)>>('Threshold_Async'); + late final _Threshold_Async = _Threshold_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, double, double, int, CvCallback_2)>(); + + ffi.Pointer Trackbar_Create( + ffi.Pointer winname, + ffi.Pointer trackname, + int max, + ) { + return _Trackbar_Create( + winname, + trackname, + max, + ); + } + + late final _Trackbar_CreatePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Int)>>('Trackbar_Create'); + late final _Trackbar_Create = _Trackbar_CreatePtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer, int)>(); + + ffi.Pointer Trackbar_CreateWithValue( + ffi.Pointer winname, + ffi.Pointer trackname, + ffi.Pointer value, + int max, + ) { + return _Trackbar_CreateWithValue( + winname, + trackname, + value, + max, + ); + } + + late final _Trackbar_CreateWithValuePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Int)>>('Trackbar_CreateWithValue'); + late final _Trackbar_CreateWithValue = + _Trackbar_CreateWithValuePtr.asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer, int)>(); + + ffi.Pointer Trackbar_GetPos( + ffi.Pointer winname, + ffi.Pointer trackname, + ffi.Pointer rval, + ) { + return _Trackbar_GetPos( + winname, + trackname, + rval, + ); + } + + late final _Trackbar_GetPosPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>>('Trackbar_GetPos'); + late final _Trackbar_GetPos = _Trackbar_GetPosPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer Trackbar_SetMax( + ffi.Pointer winname, + ffi.Pointer trackname, + int pos, + ) { + return _Trackbar_SetMax( + winname, + trackname, + pos, + ); + } + + late final _Trackbar_SetMaxPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Int)>>('Trackbar_SetMax'); + late final _Trackbar_SetMax = _Trackbar_SetMaxPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer, int)>(); + + ffi.Pointer Trackbar_SetMin( + ffi.Pointer winname, + ffi.Pointer trackname, + int pos, + ) { + return _Trackbar_SetMin( + winname, + trackname, + pos, + ); + } + + late final _Trackbar_SetMinPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Int)>>('Trackbar_SetMin'); + late final _Trackbar_SetMin = _Trackbar_SetMinPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer, int)>(); + + ffi.Pointer Trackbar_SetPos( + ffi.Pointer winname, + ffi.Pointer trackname, + int pos, + ) { + return _Trackbar_SetPos( + winname, + trackname, + pos, + ); + } + + late final _Trackbar_SetPosPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Int)>>('Trackbar_SetPos'); + late final _Trackbar_SetPos = _Trackbar_SetPosPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer, int)>(); + + void TrackerMIL_Close( + TrackerMILPtr self, + ) { + return _TrackerMIL_Close( + self, + ); + } + + late final _TrackerMIL_ClosePtr = + _lookup>( + 'TrackerMIL_Close'); + late final _TrackerMIL_Close = + _TrackerMIL_ClosePtr.asFunction(); + + ffi.Pointer TrackerMIL_Create( + ffi.Pointer rval, + ) { + return _TrackerMIL_Create( + rval, + ); + } + + late final _TrackerMIL_CreatePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('TrackerMIL_Create'); + 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, + Rect bbox, + ) { + return _TrackerMIL_Init( + self, + image, + bbox, + ); + } + + late final _TrackerMIL_InitPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + TrackerMIL, Mat, Rect)>>('TrackerMIL_Init'); + 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, + ffi.Pointer boundingBox, + ffi.Pointer rval, + ) { + return _TrackerMIL_Update( + self, + image, + boundingBox, + rval, + ); + } + + late final _TrackerMIL_UpdatePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(TrackerMIL, Mat, ffi.Pointer, + ffi.Pointer)>>('TrackerMIL_Update'); + late final _TrackerMIL_Update = _TrackerMIL_UpdatePtr.asFunction< + 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, + Mat cameraMatrix, + Mat distCoeffs, + Mat newCameraMatrix, + ) { + return _Undistort( + src, + dst, + cameraMatrix, + distCoeffs, + newCameraMatrix, + ); + } + + late final _UndistortPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, Mat, Mat, Mat)>>('Undistort'); + late final _Undistort = _UndistortPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, Mat, Mat)>(); + + ffi.Pointer UndistortPoints( + Mat distorted, + Mat undistorted, + Mat k, + Mat d, + Mat r, + Mat p, + TermCriteria criteria, + ) { + return _UndistortPoints( + distorted, + undistorted, + k, + d, + r, + p, + criteria, + ); + } + + late final _UndistortPointsPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, Mat, Mat, Mat, Mat, TermCriteria)>>('UndistortPoints'); + late final _UndistortPoints = _UndistortPointsPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, Mat, Mat, Mat, Mat, TermCriteria)>(); + + ffi.Pointer VecChar_Append( + VecChar vec, + int i, + ) { + return _VecChar_Append( + vec, + i, + ); + } + + late final _VecChar_AppendPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecChar, ffi.Char)>>('VecChar_Append'); + late final _VecChar_Append = _VecChar_AppendPtr.asFunction< + ffi.Pointer Function(VecChar, int)>(); + + ffi.Pointer VecChar_At( + VecChar vec, + int idx, + ffi.Pointer rval, + ) { + return _VecChar_At( + vec, + idx, + rval, + ); + } + + late final _VecChar_AtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecChar, ffi.Int, ffi.Pointer)>>('VecChar_At'); + late final _VecChar_At = _VecChar_AtPtr.asFunction< + ffi.Pointer Function(VecChar, int, ffi.Pointer)>(); + + void VecChar_Close( + VecCharPtr vec, + ) { + return _VecChar_Close( + vec, + ); + } + + late final _VecChar_ClosePtr = + _lookup>( + 'VecChar_Close'); + late final _VecChar_Close = + _VecChar_ClosePtr.asFunction(); + + ffi.Pointer VecChar_Data( + VecChar vec, + ffi.Pointer> rval, + ) { + return _VecChar_Data( + vec, + rval, + ); + } + + late final _VecChar_DataPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecChar, ffi.Pointer>)>>('VecChar_Data'); + late final _VecChar_Data = _VecChar_DataPtr.asFunction< + ffi.Pointer Function( + VecChar, ffi.Pointer>)>(); + + ffi.Pointer VecChar_New( + ffi.Pointer rval, + ) { + return _VecChar_New( + rval, + ); + } + + late final _VecChar_NewPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('VecChar_New'); + late final _VecChar_New = _VecChar_NewPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer VecChar_NewFromPointer( + ffi.Pointer p, + int length, + ffi.Pointer rval, + ) { + return _VecChar_NewFromPointer( + p, + length, + rval, + ); + } + + late final _VecChar_NewFromPointerPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Int, + ffi.Pointer)>>('VecChar_NewFromPointer'); + late final _VecChar_NewFromPointer = _VecChar_NewFromPointerPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, ffi.Pointer)>(); + + ffi.Pointer VecChar_NewFromVec( + VecChar vec, + ffi.Pointer rval, + ) { + return _VecChar_NewFromVec( + vec, + rval, + ); + } + + late final _VecChar_NewFromVecPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecChar, ffi.Pointer)>>('VecChar_NewFromVec'); + late final _VecChar_NewFromVec = _VecChar_NewFromVecPtr.asFunction< + ffi.Pointer Function(VecChar, ffi.Pointer)>(); + + ffi.Pointer VecChar_Size( + VecChar vec, + ffi.Pointer rval, + ) { + return _VecChar_Size( + vec, + rval, + ); + } + + late final _VecChar_SizePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecChar, ffi.Pointer)>>('VecChar_Size'); + late final _VecChar_Size = _VecChar_SizePtr.asFunction< + ffi.Pointer Function(VecChar, ffi.Pointer)>(); + + ffi.Pointer VecChar_ToString( + VecChar vec, + ffi.Pointer> rval, + ffi.Pointer length, + ) { + return _VecChar_ToString( + vec, + rval, + length, + ); + } + + late final _VecChar_ToStringPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecChar, + ffi.Pointer>, + ffi.Pointer)>>('VecChar_ToString'); + late final _VecChar_ToString = _VecChar_ToStringPtr.asFunction< + ffi.Pointer Function( + VecChar, ffi.Pointer>, ffi.Pointer)>(); + + ffi.Pointer VecDMatch_Append( + VecDMatch vec, + DMatch dm, + ) { + return _VecDMatch_Append( + vec, + dm, + ); + } + + late final _VecDMatch_AppendPtr = _lookup< + ffi + .NativeFunction Function(VecDMatch, DMatch)>>( + 'VecDMatch_Append'); + late final _VecDMatch_Append = _VecDMatch_AppendPtr.asFunction< + ffi.Pointer Function(VecDMatch, DMatch)>(); + + ffi.Pointer VecDMatch_At( + VecDMatch vec, + int idx, + ffi.Pointer rval, + ) { + return _VecDMatch_At( + vec, + idx, + rval, + ); + } + + late final _VecDMatch_AtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecDMatch, ffi.Int, ffi.Pointer)>>('VecDMatch_At'); + late final _VecDMatch_At = _VecDMatch_AtPtr.asFunction< + ffi.Pointer Function(VecDMatch, int, ffi.Pointer)>(); + + void VecDMatch_Close( + VecDMatchPtr vec, + ) { + return _VecDMatch_Close( + vec, + ); + } + + late final _VecDMatch_ClosePtr = + _lookup>( + 'VecDMatch_Close'); + late final _VecDMatch_Close = + _VecDMatch_ClosePtr.asFunction(); + + ffi.Pointer VecDMatch_New( + ffi.Pointer rval, + ) { + return _VecDMatch_New( + rval, + ); + } + + late final _VecDMatch_NewPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('VecDMatch_New'); + late final _VecDMatch_New = _VecDMatch_NewPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer VecDMatch_NewFromPointer( + ffi.Pointer matches, + int length, + ffi.Pointer rval, + ) { + return _VecDMatch_NewFromPointer( + matches, + length, + rval, + ); + } + + late final _VecDMatch_NewFromPointerPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Int, + ffi.Pointer)>>('VecDMatch_NewFromPointer'); + late final _VecDMatch_NewFromPointer = + _VecDMatch_NewFromPointerPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, ffi.Pointer)>(); + + ffi.Pointer VecDMatch_NewFromVec( + VecDMatch vec, + ffi.Pointer rval, + ) { + return _VecDMatch_NewFromVec( + vec, + rval, + ); + } + + late final _VecDMatch_NewFromVecPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecDMatch, ffi.Pointer)>>('VecDMatch_NewFromVec'); + late final _VecDMatch_NewFromVec = _VecDMatch_NewFromVecPtr.asFunction< + ffi.Pointer Function(VecDMatch, ffi.Pointer)>(); + + ffi.Pointer VecDMatch_Size( + VecDMatch vec, + ffi.Pointer rval, + ) { + return _VecDMatch_Size( + vec, + rval, + ); + } + + late final _VecDMatch_SizePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecDMatch, ffi.Pointer)>>('VecDMatch_Size'); + late final _VecDMatch_Size = _VecDMatch_SizePtr.asFunction< + ffi.Pointer Function(VecDMatch, ffi.Pointer)>(); + + ffi.Pointer VecDouble_Append( + VecDouble vec, + double d, + ) { + return _VecDouble_Append( + vec, + d, + ); + } + + late final _VecDouble_AppendPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecDouble, ffi.Double)>>('VecDouble_Append'); + late final _VecDouble_Append = _VecDouble_AppendPtr.asFunction< + ffi.Pointer Function(VecDouble, double)>(); + + ffi.Pointer VecDouble_At( + VecDouble vec, + int idx, + ffi.Pointer rval, + ) { + return _VecDouble_At( + vec, + idx, + rval, + ); + } + + late final _VecDouble_AtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecDouble, ffi.Int, ffi.Pointer)>>('VecDouble_At'); + late final _VecDouble_At = _VecDouble_AtPtr.asFunction< + ffi.Pointer Function( + VecDouble, int, ffi.Pointer)>(); + + void VecDouble_Close( + VecDoublePtr vec, + ) { + return _VecDouble_Close( + vec, + ); + } + + late final _VecDouble_ClosePtr = + _lookup>( + 'VecDouble_Close'); + late final _VecDouble_Close = + _VecDouble_ClosePtr.asFunction(); + + ffi.Pointer VecDouble_Data( + VecDouble vec, + ffi.Pointer> rval, + ) { + return _VecDouble_Data( + vec, + rval, + ); + } + + late final _VecDouble_DataPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecDouble, + ffi.Pointer>)>>('VecDouble_Data'); + late final _VecDouble_Data = _VecDouble_DataPtr.asFunction< + ffi.Pointer Function( + VecDouble, ffi.Pointer>)>(); + + ffi.Pointer VecDouble_New( + ffi.Pointer rval, + ) { + return _VecDouble_New( + rval, + ); + } + + late final _VecDouble_NewPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('VecDouble_New'); + late final _VecDouble_New = _VecDouble_NewPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer VecDouble_NewFromPointer( + ffi.Pointer p, + int length, + ffi.Pointer rval, + ) { + return _VecDouble_NewFromPointer( + p, + length, + rval, + ); + } + + late final _VecDouble_NewFromPointerPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Int, + ffi.Pointer)>>('VecDouble_NewFromPointer'); + late final _VecDouble_NewFromPointer = + _VecDouble_NewFromPointerPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, ffi.Pointer)>(); + + ffi.Pointer VecDouble_NewFromVec( + VecDouble vec, + ffi.Pointer rval, + ) { + return _VecDouble_NewFromVec( + vec, + rval, + ); + } + + late final _VecDouble_NewFromVecPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecDouble, ffi.Pointer)>>('VecDouble_NewFromVec'); + late final _VecDouble_NewFromVec = _VecDouble_NewFromVecPtr.asFunction< + ffi.Pointer Function(VecDouble, ffi.Pointer)>(); + + ffi.Pointer VecDouble_Size( + VecDouble vec, + ffi.Pointer rval, + ) { + return _VecDouble_Size( + vec, + rval, + ); + } + + late final _VecDouble_SizePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecDouble, ffi.Pointer)>>('VecDouble_Size'); + late final _VecDouble_Size = _VecDouble_SizePtr.asFunction< + ffi.Pointer Function(VecDouble, ffi.Pointer)>(); + + ffi.Pointer VecFloat_Append( + VecFloat vec, + double f, + ) { + return _VecFloat_Append( + vec, + f, + ); + } + + late final _VecFloat_AppendPtr = _lookup< + ffi + .NativeFunction Function(VecFloat, ffi.Float)>>( + 'VecFloat_Append'); + late final _VecFloat_Append = _VecFloat_AppendPtr.asFunction< + ffi.Pointer Function(VecFloat, double)>(); + + ffi.Pointer VecFloat_At( + VecFloat vec, + int idx, + ffi.Pointer rval, + ) { + return _VecFloat_At( + vec, + idx, + rval, + ); + } + + late final _VecFloat_AtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecFloat, ffi.Int, ffi.Pointer)>>('VecFloat_At'); + late final _VecFloat_At = _VecFloat_AtPtr.asFunction< + ffi.Pointer Function(VecFloat, int, ffi.Pointer)>(); + + void VecFloat_Close( + VecFloatPtr vec, + ) { + return _VecFloat_Close( + vec, + ); + } + + late final _VecFloat_ClosePtr = + _lookup>( + 'VecFloat_Close'); + late final _VecFloat_Close = + _VecFloat_ClosePtr.asFunction(); + + ffi.Pointer VecFloat_Data( + VecFloat vec, + ffi.Pointer> rval, + ) { + return _VecFloat_Data( + vec, + rval, + ); + } + + late final _VecFloat_DataPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecFloat, ffi.Pointer>)>>('VecFloat_Data'); + late final _VecFloat_Data = _VecFloat_DataPtr.asFunction< + ffi.Pointer Function( + VecFloat, ffi.Pointer>)>(); + + ffi.Pointer VecFloat_New( + ffi.Pointer rval, + ) { + return _VecFloat_New( + rval, + ); + } + + late final _VecFloat_NewPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('VecFloat_New'); + late final _VecFloat_New = _VecFloat_NewPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer VecFloat_NewFromPointer( + ffi.Pointer p, + int length, + ffi.Pointer rval, + ) { + return _VecFloat_NewFromPointer( + p, + length, + rval, + ); + } + + late final _VecFloat_NewFromPointerPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Int, + ffi.Pointer)>>('VecFloat_NewFromPointer'); + late final _VecFloat_NewFromPointer = _VecFloat_NewFromPointerPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, ffi.Pointer)>(); + + ffi.Pointer VecFloat_NewFromVec( + VecFloat vec, + ffi.Pointer rval, + ) { + return _VecFloat_NewFromVec( + vec, + rval, + ); + } + + late final _VecFloat_NewFromVecPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecFloat, ffi.Pointer)>>('VecFloat_NewFromVec'); + late final _VecFloat_NewFromVec = _VecFloat_NewFromVecPtr.asFunction< + ffi.Pointer Function(VecFloat, ffi.Pointer)>(); + + ffi.Pointer VecFloat_Size( + VecFloat vec, + ffi.Pointer rval, + ) { + return _VecFloat_Size( + vec, + rval, + ); + } + + late final _VecFloat_SizePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecFloat, ffi.Pointer)>>('VecFloat_Size'); + late final _VecFloat_Size = _VecFloat_SizePtr.asFunction< + ffi.Pointer Function(VecFloat, ffi.Pointer)>(); + + ffi.Pointer VecInt_Append( + VecInt vec, + int i, + ) { + return _VecInt_Append( + vec, + i, + ); + } + + late final _VecInt_AppendPtr = _lookup< + ffi.NativeFunction Function(VecInt, ffi.Int)>>( + 'VecInt_Append'); + late final _VecInt_Append = _VecInt_AppendPtr.asFunction< + ffi.Pointer Function(VecInt, int)>(); + + ffi.Pointer VecInt_At( + VecInt vec, + int idx, + ffi.Pointer rval, + ) { + return _VecInt_At( + vec, + idx, + rval, + ); + } + + late final _VecInt_AtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecInt, ffi.Int, ffi.Pointer)>>('VecInt_At'); + late final _VecInt_At = _VecInt_AtPtr.asFunction< + ffi.Pointer Function(VecInt, int, ffi.Pointer)>(); + + ffi.Pointer VecInt_AtNoBoundCheck( + VecInt vec, + int idx, + ffi.Pointer rval, + ) { + return _VecInt_AtNoBoundCheck( + vec, + idx, + rval, + ); + } + + late final _VecInt_AtNoBoundCheckPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecInt, ffi.Int, ffi.Pointer)>>('VecInt_AtNoBoundCheck'); + late final _VecInt_AtNoBoundCheck = _VecInt_AtNoBoundCheckPtr.asFunction< + ffi.Pointer Function(VecInt, int, ffi.Pointer)>(); + + void VecInt_Close( + VecIntPtr vec, + ) { + return _VecInt_Close( + vec, + ); + } + + late final _VecInt_ClosePtr = + _lookup>('VecInt_Close'); + late final _VecInt_Close = + _VecInt_ClosePtr.asFunction(); + + ffi.Pointer VecInt_Data( + VecInt vec, + ffi.Pointer> rval, + ) { + return _VecInt_Data( + vec, + rval, + ); + } + + late final _VecInt_DataPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecInt, ffi.Pointer>)>>('VecInt_Data'); + late final _VecInt_Data = _VecInt_DataPtr.asFunction< + ffi.Pointer Function( + VecInt, ffi.Pointer>)>(); + + ffi.Pointer VecInt_New( + ffi.Pointer rval, + ) { + return _VecInt_New( + rval, + ); + } + + late final _VecInt_NewPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('VecInt_New'); + late final _VecInt_New = _VecInt_NewPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + /// Copy from a pointer + ffi.Pointer VecInt_NewFromPointer( + ffi.Pointer p, + int length, + ffi.Pointer rval, + ) { + return _VecInt_NewFromPointer( + p, + length, + rval, + ); + } + + late final _VecInt_NewFromPointerPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Int, + ffi.Pointer)>>('VecInt_NewFromPointer'); + late final _VecInt_NewFromPointer = _VecInt_NewFromPointerPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, ffi.Pointer)>(); + + ffi.Pointer VecInt_NewFromVec( + VecInt vec, + ffi.Pointer rval, + ) { + return _VecInt_NewFromVec( + vec, + rval, + ); + } + + late final _VecInt_NewFromVecPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecInt, ffi.Pointer)>>('VecInt_NewFromVec'); + late final _VecInt_NewFromVec = _VecInt_NewFromVecPtr.asFunction< + ffi.Pointer Function(VecInt, ffi.Pointer)>(); + + ffi.Pointer VecInt_Size( + VecInt vec, + ffi.Pointer rval, + ) { + return _VecInt_Size( + vec, + rval, + ); + } + + late final _VecInt_SizePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecInt, ffi.Pointer)>>('VecInt_Size'); + late final _VecInt_Size = _VecInt_SizePtr.asFunction< + ffi.Pointer Function(VecInt, ffi.Pointer)>(); + + ffi.Pointer VecKeyPoint_Append( + VecKeyPoint vec, + KeyPoint kp, + ) { + return _VecKeyPoint_Append( + vec, + kp, + ); + } + + late final _VecKeyPoint_AppendPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecKeyPoint, KeyPoint)>>('VecKeyPoint_Append'); + late final _VecKeyPoint_Append = _VecKeyPoint_AppendPtr.asFunction< + ffi.Pointer Function(VecKeyPoint, KeyPoint)>(); + + ffi.Pointer VecKeyPoint_At( + VecKeyPoint vec, + int idx, + ffi.Pointer rval, + ) { + return _VecKeyPoint_At( + vec, + idx, + rval, + ); + } + + late final _VecKeyPoint_AtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecKeyPoint, ffi.Int, ffi.Pointer)>>('VecKeyPoint_At'); + late final _VecKeyPoint_At = _VecKeyPoint_AtPtr.asFunction< + ffi.Pointer Function( + VecKeyPoint, int, ffi.Pointer)>(); + + void VecKeyPoint_Close( + VecKeyPointPtr vec, + ) { + return _VecKeyPoint_Close( + vec, + ); + } + + late final _VecKeyPoint_ClosePtr = + _lookup>( + 'VecKeyPoint_Close'); + late final _VecKeyPoint_Close = + _VecKeyPoint_ClosePtr.asFunction(); + + ffi.Pointer VecKeyPoint_New( + ffi.Pointer rval, + ) { + return _VecKeyPoint_New( + rval, + ); + } + + late final _VecKeyPoint_NewPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('VecKeyPoint_New'); + late final _VecKeyPoint_New = _VecKeyPoint_NewPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer VecKeyPoint_NewFromPointer( + ffi.Pointer keypoints, + int length, + ffi.Pointer rval, + ) { + return _VecKeyPoint_NewFromPointer( + keypoints, + length, + rval, + ); + } + + late final _VecKeyPoint_NewFromPointerPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Int, + ffi.Pointer)>>('VecKeyPoint_NewFromPointer'); + late final _VecKeyPoint_NewFromPointer = + _VecKeyPoint_NewFromPointerPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, ffi.Pointer)>(); + + ffi.Pointer VecKeyPoint_NewFromVec( + VecKeyPoint vec, + ffi.Pointer rval, + ) { + return _VecKeyPoint_NewFromVec( + vec, + rval, + ); + } + + late final _VecKeyPoint_NewFromVecPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecKeyPoint, + ffi.Pointer)>>('VecKeyPoint_NewFromVec'); + late final _VecKeyPoint_NewFromVec = _VecKeyPoint_NewFromVecPtr.asFunction< + ffi.Pointer Function(VecKeyPoint, ffi.Pointer)>(); + + ffi.Pointer VecKeyPoint_Size( + VecKeyPoint vec, + ffi.Pointer rval, + ) { + return _VecKeyPoint_Size( + vec, + rval, + ); + } + + late final _VecKeyPoint_SizePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecKeyPoint, ffi.Pointer)>>('VecKeyPoint_Size'); + late final _VecKeyPoint_Size = _VecKeyPoint_SizePtr.asFunction< + ffi.Pointer Function(VecKeyPoint, ffi.Pointer)>(); + + ffi.Pointer VecMat_Append( + VecMat vec, + Mat mat, + ) { + return _VecMat_Append( + vec, + mat, + ); + } + + late final _VecMat_AppendPtr = + _lookup Function(VecMat, Mat)>>( + 'VecMat_Append'); + late final _VecMat_Append = _VecMat_AppendPtr.asFunction< + ffi.Pointer Function(VecMat, Mat)>(); + + ffi.Pointer VecMat_At( + VecMat vec, + int i, + ffi.Pointer rval, + ) { + return _VecMat_At( + vec, + i, + rval, + ); + } + + late final _VecMat_AtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecMat, ffi.Int, ffi.Pointer)>>('VecMat_At'); + late final _VecMat_At = _VecMat_AtPtr.asFunction< + ffi.Pointer Function(VecMat, int, ffi.Pointer)>(); + + void VecMat_Close( + VecMatPtr vec, + ) { + return _VecMat_Close( + vec, + ); + } + + late final _VecMat_ClosePtr = + _lookup>('VecMat_Close'); + late final _VecMat_Close = + _VecMat_ClosePtr.asFunction(); + + ffi.Pointer VecMat_New( + ffi.Pointer rval, + ) { + return _VecMat_New( + rval, + ); + } + + late final _VecMat_NewPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('VecMat_New'); + late final _VecMat_New = _VecMat_NewPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer VecMat_NewFromPointer( + ffi.Pointer mats, + int length, + ffi.Pointer rval, + ) { + return _VecMat_NewFromPointer( + mats, + length, + rval, + ); + } + + late final _VecMat_NewFromPointerPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Int, + ffi.Pointer)>>('VecMat_NewFromPointer'); + late final _VecMat_NewFromPointer = _VecMat_NewFromPointerPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, ffi.Pointer)>(); + + ffi.Pointer VecMat_NewFromVec( + VecMat vec, + ffi.Pointer rval, + ) { + return _VecMat_NewFromVec( + vec, + rval, + ); + } + + late final _VecMat_NewFromVecPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecMat, ffi.Pointer)>>('VecMat_NewFromVec'); + late final _VecMat_NewFromVec = _VecMat_NewFromVecPtr.asFunction< + ffi.Pointer Function(VecMat, ffi.Pointer)>(); + + ffi.Pointer VecMat_Size( + VecMat vec, + ffi.Pointer rval, + ) { + return _VecMat_Size( + vec, + rval, + ); + } + + late final _VecMat_SizePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecMat, ffi.Pointer)>>('VecMat_Size'); + late final _VecMat_Size = _VecMat_SizePtr.asFunction< + ffi.Pointer Function(VecMat, ffi.Pointer)>(); + + ffi.Pointer VecPoint2f_Append( + VecPoint2f vec, + Point2f p, + ) { + return _VecPoint2f_Append( + vec, + p, + ); + } + + late final _VecPoint2f_AppendPtr = _lookup< + ffi + .NativeFunction Function(VecPoint2f, Point2f)>>( + 'VecPoint2f_Append'); + late final _VecPoint2f_Append = _VecPoint2f_AppendPtr.asFunction< + ffi.Pointer Function(VecPoint2f, Point2f)>(); + + ffi.Pointer VecPoint2f_At( + VecPoint2f vec, + int idx, + ffi.Pointer rval, + ) { + return _VecPoint2f_At( + vec, + idx, + rval, + ); + } + + late final _VecPoint2f_AtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPoint2f, ffi.Int, ffi.Pointer)>>('VecPoint2f_At'); + late final _VecPoint2f_At = _VecPoint2f_AtPtr.asFunction< + ffi.Pointer Function(VecPoint2f, int, ffi.Pointer)>(); + + void VecPoint2f_Close( + VecPoint2fPtr vec, + ) { + return _VecPoint2f_Close( + vec, + ); + } + + late final _VecPoint2f_ClosePtr = + _lookup>( + 'VecPoint2f_Close'); + late final _VecPoint2f_Close = + _VecPoint2f_ClosePtr.asFunction(); + + ffi.Pointer VecPoint2f_New( + ffi.Pointer rval, + ) { + return _VecPoint2f_New( + rval, + ); + } + + late final _VecPoint2f_NewPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('VecPoint2f_New'); + late final _VecPoint2f_New = _VecPoint2f_NewPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer VecPoint2f_NewFromMat( + Mat mat, + ffi.Pointer rval, + ) { + return _VecPoint2f_NewFromMat( + mat, + rval, + ); + } + + late final _VecPoint2f_NewFromMatPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, ffi.Pointer)>>('VecPoint2f_NewFromMat'); + late final _VecPoint2f_NewFromMat = _VecPoint2f_NewFromMatPtr.asFunction< + ffi.Pointer Function(Mat, ffi.Pointer)>(); + + ffi.Pointer VecPoint2f_NewFromPointer( + ffi.Pointer pts, + int length, + ffi.Pointer rval, + ) { + return _VecPoint2f_NewFromPointer( + pts, + length, + rval, + ); + } + + late final _VecPoint2f_NewFromPointerPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Int, + ffi.Pointer)>>('VecPoint2f_NewFromPointer'); + late final _VecPoint2f_NewFromPointer = + _VecPoint2f_NewFromPointerPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, ffi.Pointer)>(); + + ffi.Pointer VecPoint2f_NewFromVec( + VecPoint2f vec, + ffi.Pointer rval, + ) { + return _VecPoint2f_NewFromVec( + vec, + rval, + ); + } + + late final _VecPoint2f_NewFromVecPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPoint2f, ffi.Pointer)>>('VecPoint2f_NewFromVec'); + late final _VecPoint2f_NewFromVec = _VecPoint2f_NewFromVecPtr.asFunction< + ffi.Pointer Function(VecPoint2f, ffi.Pointer)>(); + + ffi.Pointer VecPoint2f_Size( + VecPoint2f vec, + ffi.Pointer rval, + ) { + return _VecPoint2f_Size( + vec, + rval, + ); + } + + late final _VecPoint2f_SizePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPoint2f, ffi.Pointer)>>('VecPoint2f_Size'); + late final _VecPoint2f_Size = _VecPoint2f_SizePtr.asFunction< + ffi.Pointer Function(VecPoint2f, ffi.Pointer)>(); + + ffi.Pointer VecPoint3f_Append( + VecPoint3f vec, + Point3f point, + ) { + return _VecPoint3f_Append( + vec, + point, + ); + } + + late final _VecPoint3f_AppendPtr = _lookup< + ffi + .NativeFunction Function(VecPoint3f, Point3f)>>( + 'VecPoint3f_Append'); + late final _VecPoint3f_Append = _VecPoint3f_AppendPtr.asFunction< + ffi.Pointer Function(VecPoint3f, Point3f)>(); + + ffi.Pointer VecPoint3f_At( + VecPoint3f vec, + int idx, + ffi.Pointer rval, + ) { + return _VecPoint3f_At( + vec, + idx, + rval, + ); + } + + late final _VecPoint3f_AtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPoint3f, ffi.Int, ffi.Pointer)>>('VecPoint3f_At'); + late final _VecPoint3f_At = _VecPoint3f_AtPtr.asFunction< + ffi.Pointer Function(VecPoint3f, int, ffi.Pointer)>(); + + void VecPoint3f_Close( + VecPoint3fPtr vec, + ) { + return _VecPoint3f_Close( + vec, + ); + } + + late final _VecPoint3f_ClosePtr = + _lookup>( + 'VecPoint3f_Close'); + late final _VecPoint3f_Close = + _VecPoint3f_ClosePtr.asFunction(); + + ffi.Pointer VecPoint3f_New( + ffi.Pointer rval, + ) { + return _VecPoint3f_New( + rval, + ); + } + + late final _VecPoint3f_NewPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('VecPoint3f_New'); + late final _VecPoint3f_New = _VecPoint3f_NewPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer VecPoint3f_NewFromMat( + Mat mat, + ffi.Pointer rval, + ) { + return _VecPoint3f_NewFromMat( + mat, + rval, + ); + } + + late final _VecPoint3f_NewFromMatPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, ffi.Pointer)>>('VecPoint3f_NewFromMat'); + late final _VecPoint3f_NewFromMat = _VecPoint3f_NewFromMatPtr.asFunction< + ffi.Pointer Function(Mat, ffi.Pointer)>(); + + ffi.Pointer VecPoint3f_NewFromPointer( + ffi.Pointer points, + int length, + ffi.Pointer rval, + ) { + return _VecPoint3f_NewFromPointer( + points, + length, + rval, + ); + } + + late final _VecPoint3f_NewFromPointerPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Int, + ffi.Pointer)>>('VecPoint3f_NewFromPointer'); + late final _VecPoint3f_NewFromPointer = + _VecPoint3f_NewFromPointerPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, ffi.Pointer)>(); + + ffi.Pointer VecPoint3f_NewFromVec( + VecPoint3f vec, + ffi.Pointer rval, + ) { + return _VecPoint3f_NewFromVec( + vec, + rval, + ); + } + + late final _VecPoint3f_NewFromVecPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPoint3f, ffi.Pointer)>>('VecPoint3f_NewFromVec'); + late final _VecPoint3f_NewFromVec = _VecPoint3f_NewFromVecPtr.asFunction< + ffi.Pointer Function(VecPoint3f, ffi.Pointer)>(); + + ffi.Pointer VecPoint3f_Size( + VecPoint3f vec, + ffi.Pointer rval, + ) { + return _VecPoint3f_Size( + vec, + rval, + ); + } + + late final _VecPoint3f_SizePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPoint3f, ffi.Pointer)>>('VecPoint3f_Size'); + late final _VecPoint3f_Size = _VecPoint3f_SizePtr.asFunction< + ffi.Pointer Function(VecPoint3f, ffi.Pointer)>(); + + ffi.Pointer VecPoint_Append( + VecPoint vec, + Point p, + ) { + return _VecPoint_Append( + vec, + p, + ); + } + + late final _VecPoint_AppendPtr = _lookup< + ffi.NativeFunction Function(VecPoint, Point)>>( + 'VecPoint_Append'); + late final _VecPoint_Append = _VecPoint_AppendPtr.asFunction< + ffi.Pointer Function(VecPoint, Point)>(); + + ffi.Pointer VecPoint_At( + VecPoint vec, + int idx, + ffi.Pointer rval, + ) { + return _VecPoint_At( + vec, + idx, + rval, + ); + } + + late final _VecPoint_AtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPoint, ffi.Int, ffi.Pointer)>>('VecPoint_At'); + late final _VecPoint_At = _VecPoint_AtPtr.asFunction< + ffi.Pointer Function(VecPoint, int, ffi.Pointer)>(); + + void VecPoint_Close( + VecPointPtr vec, + ) { + return _VecPoint_Close( + vec, + ); + } + + late final _VecPoint_ClosePtr = + _lookup>( + 'VecPoint_Close'); + late final _VecPoint_Close = + _VecPoint_ClosePtr.asFunction(); + + ffi.Pointer VecPoint_New( + ffi.Pointer rval, + ) { + return _VecPoint_New( + rval, + ); + } + + late final _VecPoint_NewPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('VecPoint_New'); + late final _VecPoint_New = _VecPoint_NewPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer VecPoint_NewFromMat( + Mat mat, + ffi.Pointer rval, + ) { + return _VecPoint_NewFromMat( + mat, + rval, + ); + } + + late final _VecPoint_NewFromMatPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, ffi.Pointer)>>('VecPoint_NewFromMat'); + late final _VecPoint_NewFromMat = _VecPoint_NewFromMatPtr.asFunction< + ffi.Pointer Function(Mat, ffi.Pointer)>(); + + /// Copy from a pointer + ffi.Pointer VecPoint_NewFromPointer( + ffi.Pointer points, + int length, + ffi.Pointer rval, + ) { + return _VecPoint_NewFromPointer( + points, + length, + rval, + ); + } + + late final _VecPoint_NewFromPointerPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Int, + ffi.Pointer)>>('VecPoint_NewFromPointer'); + late final _VecPoint_NewFromPointer = _VecPoint_NewFromPointerPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, ffi.Pointer)>(); + + ffi.Pointer VecPoint_NewFromVec( + VecPoint vec, + ffi.Pointer rval, + ) { + return _VecPoint_NewFromVec( + vec, + rval, + ); + } + + late final _VecPoint_NewFromVecPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPoint, ffi.Pointer)>>('VecPoint_NewFromVec'); + late final _VecPoint_NewFromVec = _VecPoint_NewFromVecPtr.asFunction< + ffi.Pointer Function(VecPoint, ffi.Pointer)>(); + + ffi.Pointer VecPoint_Size( + VecPoint vec, + ffi.Pointer rval, + ) { + return _VecPoint_Size( + vec, + rval, + ); + } + + late final _VecPoint_SizePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPoint, ffi.Pointer)>>('VecPoint_Size'); + late final _VecPoint_Size = _VecPoint_SizePtr.asFunction< + ffi.Pointer Function(VecPoint, ffi.Pointer)>(); + + ffi.Pointer VecPrim_Append( + VecPrim vec, + Prim p, + ) { + return _VecPrim_Append( + vec, + p, + ); + } + + late final _VecPrim_AppendPtr = _lookup< + ffi.NativeFunction Function(VecPrim, Prim)>>( + 'VecPrim_Append'); + late final _VecPrim_Append = _VecPrim_AppendPtr.asFunction< + ffi.Pointer Function(VecPrim, Prim)>(); + + ffi.Pointer VecPrim_At( + VecPrim vec, + int idx, + ffi.Pointer rval, + ) { + return _VecPrim_At( + vec, + idx, + rval, + ); + } + + late final _VecPrim_AtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPrim, ffi.Int, ffi.Pointer)>>('VecPrim_At'); + late final _VecPrim_At = _VecPrim_AtPtr.asFunction< + ffi.Pointer Function(VecPrim, int, ffi.Pointer)>(); + + void VecPrim_Close( + VecPrimPtr vec, + ) { + return _VecPrim_Close( + vec, + ); + } + + late final _VecPrim_ClosePtr = + _lookup>( + 'VecPrim_Close'); + late final _VecPrim_Close = + _VecPrim_ClosePtr.asFunction(); + + ffi.Pointer VecPrim_New( + ffi.Pointer rval, + ) { + return _VecPrim_New( + rval, + ); + } + + late final _VecPrim_NewPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('VecPrim_New'); + late final _VecPrim_New = _VecPrim_NewPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer VecPrim_NewFromPointer( + ffi.Pointer points, + int length, + ffi.Pointer rval, + ) { + return _VecPrim_NewFromPointer( + points, + length, + rval, + ); + } + + late final _VecPrim_NewFromPointerPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Int, + ffi.Pointer)>>('VecPrim_NewFromPointer'); + late final _VecPrim_NewFromPointer = _VecPrim_NewFromPointerPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, ffi.Pointer)>(); + + ffi.Pointer VecPrim_NewFromVec( + VecPrim vec, + ffi.Pointer rval, + ) { + return _VecPrim_NewFromVec( + vec, + rval, + ); + } + + late final _VecPrim_NewFromVecPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPrim, ffi.Pointer)>>('VecPrim_NewFromVec'); + late final _VecPrim_NewFromVec = _VecPrim_NewFromVecPtr.asFunction< + ffi.Pointer Function(VecPrim, ffi.Pointer)>(); + + ffi.Pointer VecPrim_Size( + VecPrim vec, + ffi.Pointer rval, + ) { + return _VecPrim_Size( + vec, + rval, + ); + } + + late final _VecPrim_SizePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecPrim, ffi.Pointer)>>('VecPrim_Size'); + late final _VecPrim_Size = _VecPrim_SizePtr.asFunction< + ffi.Pointer Function(VecPrim, ffi.Pointer)>(); + + ffi.Pointer VecRect_Append( + VecRect vec, + Rect rect, + ) { + return _VecRect_Append( + vec, + rect, + ); + } + + late final _VecRect_AppendPtr = _lookup< + ffi.NativeFunction Function(VecRect, Rect)>>( + 'VecRect_Append'); + late final _VecRect_Append = _VecRect_AppendPtr.asFunction< + ffi.Pointer Function(VecRect, Rect)>(); + + ffi.Pointer VecRect_At( + VecRect vec, + int idx, + ffi.Pointer rval, + ) { + return _VecRect_At( + vec, + idx, + rval, + ); + } + + late final _VecRect_AtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecRect, ffi.Int, ffi.Pointer)>>('VecRect_At'); + late final _VecRect_At = _VecRect_AtPtr.asFunction< + ffi.Pointer Function(VecRect, int, ffi.Pointer)>(); + + void VecRect_Close( + VecRectPtr vec, + ) { + return _VecRect_Close( + vec, + ); + } + + late final _VecRect_ClosePtr = + _lookup>( + 'VecRect_Close'); + late final _VecRect_Close = + _VecRect_ClosePtr.asFunction(); + + ffi.Pointer VecRect_New( + ffi.Pointer rval, + ) { + return _VecRect_New( + rval, + ); + } + + late final _VecRect_NewPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('VecRect_New'); + late final _VecRect_New = _VecRect_NewPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer VecRect_NewFromPointer( + ffi.Pointer rects, + int length, + ffi.Pointer rval, + ) { + return _VecRect_NewFromPointer( + rects, + length, + rval, + ); + } + + late final _VecRect_NewFromPointerPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Int, + ffi.Pointer)>>('VecRect_NewFromPointer'); + late final _VecRect_NewFromPointer = _VecRect_NewFromPointerPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, ffi.Pointer)>(); + + ffi.Pointer VecRect_NewFromVec( + VecRect vec, + ffi.Pointer rval, + ) { + return _VecRect_NewFromVec( + vec, + rval, + ); + } + + late final _VecRect_NewFromVecPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecRect, ffi.Pointer)>>('VecRect_NewFromVec'); + late final _VecRect_NewFromVec = _VecRect_NewFromVecPtr.asFunction< + ffi.Pointer Function(VecRect, ffi.Pointer)>(); + + ffi.Pointer VecRect_Size( + VecRect vec, + ffi.Pointer rval, + ) { + return _VecRect_Size( + vec, + rval, + ); + } + + late final _VecRect_SizePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecRect, ffi.Pointer)>>('VecRect_Size'); + late final _VecRect_Size = _VecRect_SizePtr.asFunction< + ffi.Pointer Function(VecRect, ffi.Pointer)>(); + + ffi.Pointer VecUChar_Append( + VecUChar vec, + int i, + ) { + return _VecUChar_Append( + vec, + i, + ); + } + + late final _VecUChar_AppendPtr = _lookup< + ffi.NativeFunction Function(VecUChar, uchar)>>( + 'VecUChar_Append'); + late final _VecUChar_Append = _VecUChar_AppendPtr.asFunction< + ffi.Pointer Function(VecUChar, int)>(); + + ffi.Pointer VecUChar_At( + VecUChar vec, + int idx, + ffi.Pointer rval, + ) { + return _VecUChar_At( + vec, + idx, + rval, + ); + } + + late final _VecUChar_AtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecUChar, ffi.Int, ffi.Pointer)>>('VecUChar_At'); + late final _VecUChar_At = _VecUChar_AtPtr.asFunction< + ffi.Pointer Function(VecUChar, int, ffi.Pointer)>(); + + ffi.Pointer VecUChar_AtNoBoundCheck( + VecUChar vec, + int idx, + ffi.Pointer rval, + ) { + return _VecUChar_AtNoBoundCheck( + vec, + idx, + rval, + ); + } + + late final _VecUChar_AtNoBoundCheckPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecUChar, ffi.Int, + ffi.Pointer)>>('VecUChar_AtNoBoundCheck'); + late final _VecUChar_AtNoBoundCheck = _VecUChar_AtNoBoundCheckPtr.asFunction< + ffi.Pointer Function(VecUChar, int, ffi.Pointer)>(); + + void VecUChar_Close( + VecUCharPtr vec, + ) { + return _VecUChar_Close( + vec, + ); + } + + late final _VecUChar_ClosePtr = + _lookup>( + 'VecUChar_Close'); + late final _VecUChar_Close = + _VecUChar_ClosePtr.asFunction(); + + ffi.Pointer VecUChar_Data( + VecUChar vec, + ffi.Pointer> rval, + ) { + return _VecUChar_Data( + vec, + rval, + ); + } + + late final _VecUChar_DataPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecUChar, ffi.Pointer>)>>('VecUChar_Data'); + late final _VecUChar_Data = _VecUChar_DataPtr.asFunction< + ffi.Pointer Function( + VecUChar, ffi.Pointer>)>(); + + ffi.Pointer VecUChar_New( + ffi.Pointer rval, + ) { + return _VecUChar_New( + rval, + ); + } + + late final _VecUChar_NewPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('VecUChar_New'); + late final _VecUChar_New = _VecUChar_NewPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer VecUChar_NewFromPointer( + ffi.Pointer p, + int length, + ffi.Pointer rval, + ) { + return _VecUChar_NewFromPointer( + p, + length, + rval, + ); + } + + late final _VecUChar_NewFromPointerPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Int, + ffi.Pointer)>>('VecUChar_NewFromPointer'); + late final _VecUChar_NewFromPointer = _VecUChar_NewFromPointerPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, ffi.Pointer)>(); + + ffi.Pointer VecUChar_NewFromVec( + VecUChar vec, + ffi.Pointer rval, + ) { + return _VecUChar_NewFromVec( + vec, + rval, + ); + } + + late final _VecUChar_NewFromVecPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecUChar, ffi.Pointer)>>('VecUChar_NewFromVec'); + late final _VecUChar_NewFromVec = _VecUChar_NewFromVecPtr.asFunction< + ffi.Pointer Function(VecUChar, ffi.Pointer)>(); + + ffi.Pointer VecUChar_Size( + VecUChar vec, + ffi.Pointer rval, + ) { + return _VecUChar_Size( + vec, + rval, + ); + } + + late final _VecUChar_SizePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecUChar, ffi.Pointer)>>('VecUChar_Size'); + late final _VecUChar_Size = _VecUChar_SizePtr.asFunction< + ffi.Pointer Function(VecUChar, ffi.Pointer)>(); + + ffi.Pointer VecVec4f_Append( + VecVec4f vec, + Vec4f v, + ) { + return _VecVec4f_Append( + vec, + v, + ); + } + + late final _VecVec4f_AppendPtr = _lookup< + ffi.NativeFunction Function(VecVec4f, Vec4f)>>( + 'VecVec4f_Append'); + late final _VecVec4f_Append = _VecVec4f_AppendPtr.asFunction< + ffi.Pointer Function(VecVec4f, Vec4f)>(); + + ffi.Pointer VecVec4f_At( + VecVec4f vec, + int idx, + ffi.Pointer rval, + ) { + return _VecVec4f_At( + vec, + idx, + rval, + ); + } + + late final _VecVec4f_AtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecVec4f, ffi.Int, ffi.Pointer)>>('VecVec4f_At'); + late final _VecVec4f_At = _VecVec4f_AtPtr.asFunction< + ffi.Pointer Function(VecVec4f, int, ffi.Pointer)>(); + + void VecVec4f_Close( + VecVec4fPtr vec, + ) { + return _VecVec4f_Close( + vec, + ); + } + + late final _VecVec4f_ClosePtr = + _lookup>( + 'VecVec4f_Close'); + late final _VecVec4f_Close = + _VecVec4f_ClosePtr.asFunction(); + + ffi.Pointer VecVec4f_New( + ffi.Pointer rval, + ) { + return _VecVec4f_New( + rval, + ); + } + + late final _VecVec4f_NewPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('VecVec4f_New'); + late final _VecVec4f_New = _VecVec4f_NewPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer VecVec4f_NewFromPointer( + ffi.Pointer data, + int length, + ffi.Pointer rval, + ) { + return _VecVec4f_NewFromPointer( + data, + length, + rval, + ); + } + + late final _VecVec4f_NewFromPointerPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Int, + ffi.Pointer)>>('VecVec4f_NewFromPointer'); + late final _VecVec4f_NewFromPointer = _VecVec4f_NewFromPointerPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, ffi.Pointer)>(); + + ffi.Pointer VecVec4f_Size( + VecVec4f vec, + ffi.Pointer rval, + ) { + return _VecVec4f_Size( + vec, + rval, + ); + } + + late final _VecVec4f_SizePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecVec4f, ffi.Pointer)>>('VecVec4f_Size'); + late final _VecVec4f_Size = _VecVec4f_SizePtr.asFunction< + ffi.Pointer Function(VecVec4f, ffi.Pointer)>(); + + ffi.Pointer VecVec4i_Append( + VecVec4i vec, + Vec4i v, + ) { + return _VecVec4i_Append( + vec, + v, + ); + } + + late final _VecVec4i_AppendPtr = _lookup< + ffi.NativeFunction Function(VecVec4i, Vec4i)>>( + 'VecVec4i_Append'); + late final _VecVec4i_Append = _VecVec4i_AppendPtr.asFunction< + ffi.Pointer Function(VecVec4i, Vec4i)>(); + + ffi.Pointer VecVec4i_At( + VecVec4i vec, + int idx, + ffi.Pointer rval, + ) { + return _VecVec4i_At( + vec, + idx, + rval, + ); + } + + late final _VecVec4i_AtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecVec4i, ffi.Int, ffi.Pointer)>>('VecVec4i_At'); + late final _VecVec4i_At = _VecVec4i_AtPtr.asFunction< + ffi.Pointer Function(VecVec4i, int, ffi.Pointer)>(); + + void VecVec4i_Close( + VecVec4iPtr vec, + ) { + return _VecVec4i_Close( + vec, + ); + } + + late final _VecVec4i_ClosePtr = + _lookup>( + 'VecVec4i_Close'); + late final _VecVec4i_Close = + _VecVec4i_ClosePtr.asFunction(); + + ffi.Pointer VecVec4i_New( + ffi.Pointer rval, + ) { + return _VecVec4i_New( + rval, + ); + } + + late final _VecVec4i_NewPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('VecVec4i_New'); + late final _VecVec4i_New = _VecVec4i_NewPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer VecVec4i_NewFromPointer( + ffi.Pointer data, + int length, + ffi.Pointer rval, + ) { + return _VecVec4i_NewFromPointer( + data, + length, + rval, + ); + } + + late final _VecVec4i_NewFromPointerPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Int, + ffi.Pointer)>>('VecVec4i_NewFromPointer'); + late final _VecVec4i_NewFromPointer = _VecVec4i_NewFromPointerPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, ffi.Pointer)>(); + + ffi.Pointer VecVec4i_Size( + VecVec4i vec, + ffi.Pointer rval, + ) { + return _VecVec4i_Size( + vec, + rval, + ); + } + + late final _VecVec4i_SizePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecVec4i, ffi.Pointer)>>('VecVec4i_Size'); + late final _VecVec4i_Size = _VecVec4i_SizePtr.asFunction< + ffi.Pointer Function(VecVec4i, ffi.Pointer)>(); + + ffi.Pointer VecVec6f_Append( + VecVec6f vec, + Vec6f v, + ) { + return _VecVec6f_Append( + vec, + v, + ); + } + + late final _VecVec6f_AppendPtr = _lookup< + ffi.NativeFunction Function(VecVec6f, Vec6f)>>( + 'VecVec6f_Append'); + late final _VecVec6f_Append = _VecVec6f_AppendPtr.asFunction< + ffi.Pointer Function(VecVec6f, Vec6f)>(); + + ffi.Pointer VecVec6f_At( + VecVec6f vec, + int idx, + ffi.Pointer rval, + ) { + return _VecVec6f_At( + vec, + idx, + rval, + ); + } + + late final _VecVec6f_AtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecVec6f, ffi.Int, ffi.Pointer)>>('VecVec6f_At'); + late final _VecVec6f_At = _VecVec6f_AtPtr.asFunction< + ffi.Pointer Function(VecVec6f, int, ffi.Pointer)>(); + + void VecVec6f_Close( + VecVec6fPtr vec, + ) { + return _VecVec6f_Close( + vec, + ); + } + + late final _VecVec6f_ClosePtr = + _lookup>( + 'VecVec6f_Close'); + late final _VecVec6f_Close = + _VecVec6f_ClosePtr.asFunction(); + + ffi.Pointer VecVec6f_New( + ffi.Pointer rval, + ) { + return _VecVec6f_New( + rval, + ); + } + + late final _VecVec6f_NewPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('VecVec6f_New'); + late final _VecVec6f_New = _VecVec6f_NewPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer VecVec6f_NewFromPointer( + ffi.Pointer data, + int length, + ffi.Pointer rval, + ) { + return _VecVec6f_NewFromPointer( + data, + length, + rval, + ); + } + + late final _VecVec6f_NewFromPointerPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Int, + ffi.Pointer)>>('VecVec6f_NewFromPointer'); + late final _VecVec6f_NewFromPointer = _VecVec6f_NewFromPointerPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, ffi.Pointer)>(); + + ffi.Pointer VecVec6f_Size( + VecVec6f vec, + ffi.Pointer rval, + ) { + return _VecVec6f_Size( + vec, + rval, + ); + } + + late final _VecVec6f_SizePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecVec6f, ffi.Pointer)>>('VecVec6f_Size'); + late final _VecVec6f_Size = _VecVec6f_SizePtr.asFunction< + ffi.Pointer Function(VecVec6f, ffi.Pointer)>(); + + ffi.Pointer VecVecChar_Append( + VecVecChar vec, + VecChar v, + ) { + return _VecVecChar_Append( + vec, + v, + ); + } + + late final _VecVecChar_AppendPtr = _lookup< + ffi + .NativeFunction Function(VecVecChar, VecChar)>>( + 'VecVecChar_Append'); + late final _VecVecChar_Append = _VecVecChar_AppendPtr.asFunction< + ffi.Pointer Function(VecVecChar, VecChar)>(); + + ffi.Pointer VecVecChar_Append_Str( + VecVecChar vec, + ffi.Pointer str, + ) { + return _VecVecChar_Append_Str( + vec, + str, + ); + } + + late final _VecVecChar_Append_StrPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecVecChar, ffi.Pointer)>>('VecVecChar_Append_Str'); + late final _VecVecChar_Append_Str = _VecVecChar_Append_StrPtr.asFunction< + ffi.Pointer Function(VecVecChar, ffi.Pointer)>(); + + ffi.Pointer VecVecChar_At( + VecVecChar vec, + int idx, + ffi.Pointer rval, + ) { + return _VecVecChar_At( + vec, + idx, + rval, + ); + } + + late final _VecVecChar_AtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecVecChar, ffi.Int, ffi.Pointer)>>('VecVecChar_At'); + late final _VecVecChar_At = _VecVecChar_AtPtr.asFunction< + ffi.Pointer Function(VecVecChar, int, ffi.Pointer)>(); + + ffi.Pointer VecVecChar_At_Str( + VecVecChar vec, + int idx, + ffi.Pointer> rval, + ffi.Pointer length, + ) { + return _VecVecChar_At_Str( + vec, + idx, + rval, + length, + ); + } + + late final _VecVecChar_At_StrPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecVecChar, + ffi.Int, + ffi.Pointer>, + ffi.Pointer)>>('VecVecChar_At_Str'); + late final _VecVecChar_At_Str = _VecVecChar_At_StrPtr.asFunction< + ffi.Pointer Function(VecVecChar, int, + ffi.Pointer>, ffi.Pointer)>(); + + void VecVecChar_Close( + VecVecCharPtr vec, + ) { + return _VecVecChar_Close( + vec, + ); + } + + late final _VecVecChar_ClosePtr = + _lookup>( + 'VecVecChar_Close'); + late final _VecVecChar_Close = + _VecVecChar_ClosePtr.asFunction(); + + ffi.Pointer VecVecChar_New( + ffi.Pointer rval, + ) { + return _VecVecChar_New( + rval, + ); + } + + late final _VecVecChar_NewPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('VecVecChar_New'); + late final _VecVecChar_New = _VecVecChar_NewPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer VecVecChar_NewFromVec( + VecVecChar vec, + ffi.Pointer rval, + ) { + return _VecVecChar_NewFromVec( + vec, + rval, + ); + } + + late final _VecVecChar_NewFromVecPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecVecChar, ffi.Pointer)>>('VecVecChar_NewFromVec'); + late final _VecVecChar_NewFromVec = _VecVecChar_NewFromVecPtr.asFunction< + ffi.Pointer Function(VecVecChar, ffi.Pointer)>(); + + ffi.Pointer VecVecChar_Size( + VecVecChar vec, + ffi.Pointer rval, + ) { + return _VecVecChar_Size( + vec, + rval, + ); + } + + late final _VecVecChar_SizePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecVecChar, ffi.Pointer)>>('VecVecChar_Size'); + late final _VecVecChar_Size = _VecVecChar_SizePtr.asFunction< + ffi.Pointer Function(VecVecChar, ffi.Pointer)>(); + + ffi.Pointer VecVecDMatch_Append( + VecVecDMatch vec, + VecDMatch dm, + ) { + return _VecVecDMatch_Append( + vec, + dm, + ); + } + + late final _VecVecDMatch_AppendPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecVecDMatch, VecDMatch)>>('VecVecDMatch_Append'); + late final _VecVecDMatch_Append = _VecVecDMatch_AppendPtr.asFunction< + ffi.Pointer Function(VecVecDMatch, VecDMatch)>(); + + ffi.Pointer VecVecDMatch_At( + VecVecDMatch vec, + int idx, + ffi.Pointer rval, + ) { + return _VecVecDMatch_At( + vec, + idx, + rval, + ); + } + + late final _VecVecDMatch_AtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecVecDMatch, ffi.Int, + ffi.Pointer)>>('VecVecDMatch_At'); + late final _VecVecDMatch_At = _VecVecDMatch_AtPtr.asFunction< + ffi.Pointer Function( + VecVecDMatch, int, ffi.Pointer)>(); + + void VecVecDMatch_Close( + VecVecDMatchPtr vec, + ) { + return _VecVecDMatch_Close( + vec, + ); + } + + late final _VecVecDMatch_ClosePtr = + _lookup>( + 'VecVecDMatch_Close'); + late final _VecVecDMatch_Close = + _VecVecDMatch_ClosePtr.asFunction(); + + ffi.Pointer VecVecDMatch_Data( + VecVecDMatch vec, + ffi.Pointer> rval, + ) { + return _VecVecDMatch_Data( + vec, + rval, + ); + } + + late final _VecVecDMatch_DataPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecVecDMatch, + ffi.Pointer>)>>('VecVecDMatch_Data'); + late final _VecVecDMatch_Data = _VecVecDMatch_DataPtr.asFunction< + ffi.Pointer Function( + VecVecDMatch, ffi.Pointer>)>(); + + ffi.Pointer VecVecDMatch_New( + ffi.Pointer rval, + ) { + return _VecVecDMatch_New( + rval, + ); + } + + late final _VecVecDMatch_NewPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('VecVecDMatch_New'); + late final _VecVecDMatch_New = _VecVecDMatch_NewPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer VecVecDMatch_NewFromPointer( + ffi.Pointer matches, + int length, + ffi.Pointer rval, + ) { + return _VecVecDMatch_NewFromPointer( + matches, + length, + rval, + ); + } + + late final _VecVecDMatch_NewFromPointerPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Int, + ffi.Pointer)>>('VecVecDMatch_NewFromPointer'); + late final _VecVecDMatch_NewFromPointer = + _VecVecDMatch_NewFromPointerPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, ffi.Pointer)>(); + + ffi.Pointer VecVecDMatch_NewFromVec( + VecVecDMatch vec, + ffi.Pointer rval, + ) { + return _VecVecDMatch_NewFromVec( + vec, + rval, + ); + } + + late final _VecVecDMatch_NewFromVecPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecVecDMatch, + ffi.Pointer)>>('VecVecDMatch_NewFromVec'); + late final _VecVecDMatch_NewFromVec = _VecVecDMatch_NewFromVecPtr.asFunction< + ffi.Pointer Function( + VecVecDMatch, ffi.Pointer)>(); + + ffi.Pointer VecVecDMatch_Size( + VecVecDMatch vec, + ffi.Pointer rval, + ) { + return _VecVecDMatch_Size( + vec, + rval, + ); + } + + late final _VecVecDMatch_SizePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecVecDMatch, ffi.Pointer)>>('VecVecDMatch_Size'); + late final _VecVecDMatch_Size = _VecVecDMatch_SizePtr.asFunction< + ffi.Pointer Function(VecVecDMatch, ffi.Pointer)>(); + + ffi.Pointer VecVecPoint2f_Append( + VecVecPoint2f vec, + VecPoint2f pv, + ) { + return _VecVecPoint2f_Append( + vec, + pv, + ); + } + + late final _VecVecPoint2f_AppendPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecVecPoint2f, VecPoint2f)>>('VecVecPoint2f_Append'); + late final _VecVecPoint2f_Append = _VecVecPoint2f_AppendPtr.asFunction< + ffi.Pointer Function(VecVecPoint2f, VecPoint2f)>(); + + ffi.Pointer VecVecPoint2f_At( + VecVecPoint2f vec, + int idx, + ffi.Pointer rval, + ) { + return _VecVecPoint2f_At( + vec, + idx, + rval, + ); + } + + late final _VecVecPoint2f_AtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecVecPoint2f, ffi.Int, + ffi.Pointer)>>('VecVecPoint2f_At'); + late final _VecVecPoint2f_At = _VecVecPoint2f_AtPtr.asFunction< + ffi.Pointer Function( + VecVecPoint2f, int, ffi.Pointer)>(); + + void VecVecPoint2f_Close( + VecVecPoint2fPtr vec, + ) { + return _VecVecPoint2f_Close( + vec, + ); + } + + late final _VecVecPoint2f_ClosePtr = + _lookup>( + 'VecVecPoint2f_Close'); + late final _VecVecPoint2f_Close = + _VecVecPoint2f_ClosePtr.asFunction(); + + ffi.Pointer VecVecPoint2f_New( + ffi.Pointer rval, + ) { + return _VecVecPoint2f_New( + rval, + ); + } + + late final _VecVecPoint2f_NewPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('VecVecPoint2f_New'); + late final _VecVecPoint2f_New = _VecVecPoint2f_NewPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer VecVecPoint2f_NewFromPointer( + ffi.Pointer points, + int length, + ffi.Pointer rval, + ) { + return _VecVecPoint2f_NewFromPointer( + points, + length, + rval, + ); + } + + late final _VecVecPoint2f_NewFromPointerPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Int, + ffi.Pointer)>>('VecVecPoint2f_NewFromPointer'); + late final _VecVecPoint2f_NewFromPointer = + _VecVecPoint2f_NewFromPointerPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, ffi.Pointer)>(); + + ffi.Pointer VecVecPoint2f_NewFromVec( + VecVecPoint2f vec, + ffi.Pointer rval, + ) { + return _VecVecPoint2f_NewFromVec( + vec, + rval, + ); + } + + late final _VecVecPoint2f_NewFromVecPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecVecPoint2f, + ffi.Pointer)>>('VecVecPoint2f_NewFromVec'); + late final _VecVecPoint2f_NewFromVec = + _VecVecPoint2f_NewFromVecPtr.asFunction< + ffi.Pointer Function( + VecVecPoint2f, ffi.Pointer)>(); + + ffi.Pointer VecVecPoint2f_Size( + VecVecPoint2f vec, + ffi.Pointer rval, + ) { + return _VecVecPoint2f_Size( + vec, + rval, + ); + } + + late final _VecVecPoint2f_SizePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecVecPoint2f, ffi.Pointer)>>('VecVecPoint2f_Size'); + late final _VecVecPoint2f_Size = _VecVecPoint2f_SizePtr.asFunction< + ffi.Pointer Function(VecVecPoint2f, ffi.Pointer)>(); + + ffi.Pointer VecVecPoint3f_Append( + VecVecPoint3f vec, + VecPoint3f pv, + ) { + return _VecVecPoint3f_Append( + vec, + pv, + ); + } + + late final _VecVecPoint3f_AppendPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecVecPoint3f, VecPoint3f)>>('VecVecPoint3f_Append'); + late final _VecVecPoint3f_Append = _VecVecPoint3f_AppendPtr.asFunction< + ffi.Pointer Function(VecVecPoint3f, VecPoint3f)>(); + + ffi.Pointer VecVecPoint3f_At( + VecVecPoint3f vec, + int idx, + ffi.Pointer rval, + ) { + return _VecVecPoint3f_At( + vec, + idx, + rval, + ); + } + + late final _VecVecPoint3f_AtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecVecPoint3f, ffi.Int, + ffi.Pointer)>>('VecVecPoint3f_At'); + late final _VecVecPoint3f_At = _VecVecPoint3f_AtPtr.asFunction< + ffi.Pointer Function( + VecVecPoint3f, int, ffi.Pointer)>(); + + void VecVecPoint3f_Close( + VecVecPoint3fPtr vec, + ) { + return _VecVecPoint3f_Close( + vec, + ); + } + + late final _VecVecPoint3f_ClosePtr = + _lookup>( + 'VecVecPoint3f_Close'); + late final _VecVecPoint3f_Close = + _VecVecPoint3f_ClosePtr.asFunction(); + + ffi.Pointer VecVecPoint3f_New( + ffi.Pointer rval, + ) { + return _VecVecPoint3f_New( + rval, + ); + } + + late final _VecVecPoint3f_NewPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('VecVecPoint3f_New'); + late final _VecVecPoint3f_New = _VecVecPoint3f_NewPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer VecVecPoint3f_NewFromPointer( + ffi.Pointer points, + int length, + ffi.Pointer rval, + ) { + return _VecVecPoint3f_NewFromPointer( + points, + length, + rval, + ); + } + + late final _VecVecPoint3f_NewFromPointerPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Int, + ffi.Pointer)>>('VecVecPoint3f_NewFromPointer'); + late final _VecVecPoint3f_NewFromPointer = + _VecVecPoint3f_NewFromPointerPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, ffi.Pointer)>(); + + ffi.Pointer VecVecPoint3f_NewFromVec( + VecVecPoint3f vec, + ffi.Pointer rval, + ) { + return _VecVecPoint3f_NewFromVec( + vec, + rval, + ); + } + + late final _VecVecPoint3f_NewFromVecPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecVecPoint3f, + ffi.Pointer)>>('VecVecPoint3f_NewFromVec'); + late final _VecVecPoint3f_NewFromVec = + _VecVecPoint3f_NewFromVecPtr.asFunction< + ffi.Pointer Function( + VecVecPoint3f, ffi.Pointer)>(); + + ffi.Pointer VecVecPoint3f_Size( + VecVecPoint3f vec, + ffi.Pointer rval, + ) { + return _VecVecPoint3f_Size( + vec, + rval, + ); + } + + late final _VecVecPoint3f_SizePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecVecPoint3f, ffi.Pointer)>>('VecVecPoint3f_Size'); + late final _VecVecPoint3f_Size = _VecVecPoint3f_SizePtr.asFunction< + ffi.Pointer Function(VecVecPoint3f, ffi.Pointer)>(); + + ffi.Pointer VecVecPoint_Append( + VecVecPoint vec, + VecPoint pv, + ) { + return _VecVecPoint_Append( + vec, + pv, + ); + } + + late final _VecVecPoint_AppendPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecVecPoint, VecPoint)>>('VecVecPoint_Append'); + late final _VecVecPoint_Append = _VecVecPoint_AppendPtr.asFunction< + ffi.Pointer Function(VecVecPoint, VecPoint)>(); + + ffi.Pointer VecVecPoint_At( + VecVecPoint vec, + int idx, + ffi.Pointer rval, + ) { + return _VecVecPoint_At( + vec, + idx, + rval, + ); + } + + late final _VecVecPoint_AtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecVecPoint, ffi.Int, ffi.Pointer)>>('VecVecPoint_At'); + late final _VecVecPoint_At = _VecVecPoint_AtPtr.asFunction< + ffi.Pointer Function( + VecVecPoint, int, ffi.Pointer)>(); + + void VecVecPoint_Close( + VecVecPointPtr vec, + ) { + return _VecVecPoint_Close( + vec, + ); + } + + late final _VecVecPoint_ClosePtr = + _lookup>( + 'VecVecPoint_Close'); + late final _VecVecPoint_Close = + _VecVecPoint_ClosePtr.asFunction(); + + ffi.Pointer VecVecPoint_New( + ffi.Pointer rval, + ) { + return _VecVecPoint_New( + rval, + ); + } + + late final _VecVecPoint_NewPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('VecVecPoint_New'); + late final _VecVecPoint_New = _VecVecPoint_NewPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer VecVecPoint_NewFromPointer( + ffi.Pointer points, + int length, + ffi.Pointer rval, + ) { + return _VecVecPoint_NewFromPointer( + points, + length, + rval, + ); + } + + late final _VecVecPoint_NewFromPointerPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Int, + ffi.Pointer)>>('VecVecPoint_NewFromPointer'); + late final _VecVecPoint_NewFromPointer = + _VecVecPoint_NewFromPointerPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, ffi.Pointer)>(); + + ffi.Pointer VecVecPoint_NewFromVec( + VecVecPoint vec, + ffi.Pointer rval, + ) { + return _VecVecPoint_NewFromVec( + vec, + rval, + ); + } + + late final _VecVecPoint_NewFromVecPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecVecPoint, + ffi.Pointer)>>('VecVecPoint_NewFromVec'); + late final _VecVecPoint_NewFromVec = _VecVecPoint_NewFromVecPtr.asFunction< + ffi.Pointer Function(VecVecPoint, ffi.Pointer)>(); + + ffi.Pointer VecVecPoint_Size( + VecVecPoint vec, + ffi.Pointer rval, + ) { + return _VecVecPoint_Size( + vec, + rval, + ); + } + + late final _VecVecPoint_SizePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecVecPoint, ffi.Pointer)>>('VecVecPoint_Size'); + late final _VecVecPoint_Size = _VecVecPoint_SizePtr.asFunction< + ffi.Pointer Function(VecVecPoint, ffi.Pointer)>(); + + void VideoCapture_Close( + VideoCapturePtr self, + ) { + return _VideoCapture_Close( + self, + ); + } + + late final _VideoCapture_ClosePtr = + _lookup>( + 'VideoCapture_Close'); + late final _VideoCapture_Close = + _VideoCapture_ClosePtr.asFunction(); + + ffi.Pointer VideoCapture_Get( + VideoCapture self, + int prop, + ffi.Pointer rval, + ) { + return _VideoCapture_Get( + self, + prop, + rval, + ); + } + + late final _VideoCapture_GetPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VideoCapture, ffi.Int, + ffi.Pointer)>>('VideoCapture_Get'); + late final _VideoCapture_Get = _VideoCapture_GetPtr.asFunction< + 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, + ) { + return _VideoCapture_Grab( + self, + skip, + ); + } + + late final _VideoCapture_GrabPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VideoCapture, ffi.Int)>>('VideoCapture_Grab'); + 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( + 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, + callback, + ); + } + + late final _VideoCapture_IsOpened_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + 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, + ) { + return _VideoCapture_New( + rval, + ); + } + + late final _VideoCapture_NewPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('VideoCapture_New'); + late final _VideoCapture_New = _VideoCapture_NewPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer VideoCapture_NewFromFile( + ffi.Pointer filename, + int apiPreference, + ffi.Pointer rval, + ) { + return _VideoCapture_NewFromFile( + filename, + apiPreference, + rval, + ); + } + + late final _VideoCapture_NewFromFilePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Int, + ffi.Pointer)>>('VideoCapture_NewFromFile'); + late final _VideoCapture_NewFromFile = + _VideoCapture_NewFromFilePtr.asFunction< + 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, + ffi.Pointer rval, + ) { + return _VideoCapture_NewFromIndex( + index, + apiPreference, + rval, + ); + } + + late final _VideoCapture_NewFromIndexPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Int, ffi.Int, + ffi.Pointer)>>('VideoCapture_NewFromIndex'); + late final _VideoCapture_NewFromIndex = + _VideoCapture_NewFromIndexPtr.asFunction< + 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, + ffi.Pointer rval, + ) { + return _VideoCapture_Open( + self, + uri, + rval, + ); + } + + late final _VideoCapture_OpenPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VideoCapture, ffi.Pointer, + ffi.Pointer)>>('VideoCapture_Open'); + late final _VideoCapture_Open = _VideoCapture_OpenPtr.asFunction< + ffi.Pointer Function( + VideoCapture, ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer VideoCapture_OpenDevice( + VideoCapture self, + int device, + ffi.Pointer rval, + ) { + return _VideoCapture_OpenDevice( + self, + device, + rval, + ); + } + + late final _VideoCapture_OpenDevicePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VideoCapture, ffi.Int, + ffi.Pointer)>>('VideoCapture_OpenDevice'); + late final _VideoCapture_OpenDevice = _VideoCapture_OpenDevicePtr.asFunction< + ffi.Pointer Function( + VideoCapture, int, ffi.Pointer)>(); + + ffi.Pointer VideoCapture_OpenDeviceWithAPI( + VideoCapture self, + int device, + int apiPreference, + ffi.Pointer rval, + ) { + return _VideoCapture_OpenDeviceWithAPI( + self, + device, + apiPreference, + rval, + ); + } + + late final _VideoCapture_OpenDeviceWithAPIPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VideoCapture, ffi.Int, ffi.Int, + ffi.Pointer)>>('VideoCapture_OpenDeviceWithAPI'); + late final _VideoCapture_OpenDeviceWithAPI = + _VideoCapture_OpenDeviceWithAPIPtr.asFunction< + 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, + int apiPreference, + ffi.Pointer rval, + ) { + return _VideoCapture_OpenWithAPI( + self, + uri, + apiPreference, + rval, + ); + } + + late final _VideoCapture_OpenWithAPIPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VideoCapture, ffi.Pointer, + ffi.Int, ffi.Pointer)>>('VideoCapture_OpenWithAPI'); + late final _VideoCapture_OpenWithAPI = + _VideoCapture_OpenWithAPIPtr.asFunction< + 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, + ffi.Pointer rval, + ) { + return _VideoCapture_Read( + self, + buf, + rval, + ); + } + + late final _VideoCapture_ReadPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VideoCapture, Mat, ffi.Pointer)>>('VideoCapture_Read'); + late final _VideoCapture_Read = _VideoCapture_ReadPtr.asFunction< + 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, + ) { + return _VideoCapture_Release( + self, + ); + } + + late final _VideoCapture_ReleasePtr = + _lookup Function(VideoCapture)>>( + 'VideoCapture_Release'); + 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, + double param, + ) { + return _VideoCapture_Set( + self, + prop, + param, + ); + } + + late final _VideoCapture_SetPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VideoCapture, ffi.Int, ffi.Double)>>('VideoCapture_Set'); + 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, + ) { + return _VideoWriter_Close( + self, + ); + } + + late final _VideoWriter_ClosePtr = + _lookup>( + 'VideoWriter_Close'); + late final _VideoWriter_Close = + _VideoWriter_ClosePtr.asFunction(); + + ffi.Pointer VideoWriter_Fourcc( + int c1, + int c2, + int c3, + int c4, + ffi.Pointer rval, + ) { + return _VideoWriter_Fourcc( + c1, + c2, + c3, + c4, + rval, + ); + } + + late final _VideoWriter_FourccPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Char, ffi.Char, ffi.Char, ffi.Char, + ffi.Pointer)>>('VideoWriter_Fourcc'); + late final _VideoWriter_Fourcc = _VideoWriter_FourccPtr.asFunction< + 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, + ) { + return _VideoWriter_IsOpened( + self, + rval, + ); + } + + late final _VideoWriter_IsOpenedPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VideoWriter, ffi.Pointer)>>('VideoWriter_IsOpened'); + 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, + ) { + return _VideoWriter_New( + rval, + ); + } + + late final _VideoWriter_NewPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('VideoWriter_New'); + 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, + ffi.Pointer codec, + double fps, + int width, + int height, + bool isColor, + ) { + return _VideoWriter_Open( + self, + name, + codec, + fps, + width, + height, + isColor, + ); + } + + late final _VideoWriter_OpenPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VideoWriter, + ffi.Pointer, + ffi.Pointer, + ffi.Double, + ffi.Int, + ffi.Int, + ffi.Bool)>>('VideoWriter_Open'); + late final _VideoWriter_Open = _VideoWriter_OpenPtr.asFunction< + 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, + ) { + return _VideoWriter_Release( + self, + ); + } + + late final _VideoWriter_ReleasePtr = + _lookup Function(VideoWriter)>>( + 'VideoWriter_Release'); + 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, + ) { + return _VideoWriter_Write( + self, + img, + ); + } + + late final _VideoWriter_WritePtr = _lookup< + ffi.NativeFunction Function(VideoWriter, Mat)>>( + 'VideoWriter_Write'); + 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, + Mat rot_mat, + Size dsize, + ) { + return _WarpAffine( + src, + dst, + rot_mat, + dsize, + ); + } + + late final _WarpAffinePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, Mat, Size)>>('WarpAffine'); + late final _WarpAffine = _WarpAffinePtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, Size)>(); + + ffi.Pointer WarpAffineWithParams( + Mat src, + Mat dst, + Mat rot_mat, + Size dsize, + int flags, + int borderMode, + Scalar borderValue, + ) { + return _WarpAffineWithParams( + src, + dst, + rot_mat, + dsize, + flags, + borderMode, + borderValue, + ); + } + + late final _WarpAffineWithParamsPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, Mat, Size, ffi.Int, ffi.Int, + Scalar)>>('WarpAffineWithParams'); + late final _WarpAffineWithParams = _WarpAffineWithParamsPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, Size, int, int, Scalar)>(); + + ffi.Pointer WarpAffineWithParams_Async( + Mat src, + Mat rot_mat, + Size dsize, + int flags, + int borderMode, + Scalar borderValue, + CvCallback_1 callback, + ) { + return _WarpAffineWithParams_Async( + src, + rot_mat, + dsize, + flags, + borderMode, + borderValue, + callback, + ); + } + + late final _WarpAffineWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, Size, ffi.Int, ffi.Int, + Scalar, CvCallback_1)>>('WarpAffineWithParams_Async'); + late final _WarpAffineWithParams_Async = + _WarpAffineWithParams_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, Size, int, int, Scalar, CvCallback_1)>(); + + ffi.Pointer WarpAffine_Async( + Mat src, + Mat rot_mat, + Size dsize, + CvCallback_1 callback, + ) { + return _WarpAffine_Async( + src, + rot_mat, + dsize, + callback, + ); + } + + late final _WarpAffine_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, Size, CvCallback_1)>>('WarpAffine_Async'); + late final _WarpAffine_Async = _WarpAffine_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Size, CvCallback_1)>(); + + ffi.Pointer WarpPerspective( + Mat src, + Mat dst, + Mat m, + Size dsize, + ) { + return _WarpPerspective( + src, + dst, + m, + dsize, + ); + } + + late final _WarpPerspectivePtr = _lookup< + ffi + .NativeFunction Function(Mat, Mat, Mat, Size)>>( + 'WarpPerspective'); + late final _WarpPerspective = _WarpPerspectivePtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, Size)>(); + + ffi.Pointer WarpPerspectiveWithParams( + Mat src, + Mat dst, + Mat rot_mat, + Size dsize, + int flags, + int borderMode, + Scalar borderValue, + ) { + return _WarpPerspectiveWithParams( + src, + dst, + rot_mat, + dsize, + flags, + borderMode, + borderValue, + ); + } + + late final _WarpPerspectiveWithParamsPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, Mat, Size, ffi.Int, ffi.Int, + Scalar)>>('WarpPerspectiveWithParams'); + late final _WarpPerspectiveWithParams = + _WarpPerspectiveWithParamsPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, Mat, Size, int, int, Scalar)>(); + + ffi.Pointer WarpPerspectiveWithParams_Async( + Mat src, + Mat rot_mat, + Size dsize, + int flags, + int borderMode, + Scalar borderValue, + CvCallback_1 callback, + ) { + return _WarpPerspectiveWithParams_Async( + src, + rot_mat, + dsize, + flags, + borderMode, + borderValue, + callback, + ); + } + + late final _WarpPerspectiveWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, Size, ffi.Int, ffi.Int, + Scalar, CvCallback_1)>>('WarpPerspectiveWithParams_Async'); + late final _WarpPerspectiveWithParams_Async = + _WarpPerspectiveWithParams_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, Size, int, int, Scalar, CvCallback_1)>(); + + ffi.Pointer WarpPerspective_Async( + Mat src, + Mat m, + Size dsize, + CvCallback_1 callback, + ) { + return _WarpPerspective_Async( + src, + m, + dsize, + callback, + ); + } + + late final _WarpPerspective_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, Size, CvCallback_1)>>('WarpPerspective_Async'); + late final _WarpPerspective_Async = _WarpPerspective_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Size, CvCallback_1)>(); + + ffi.Pointer Watershed( + Mat image, + Mat markers, + ) { + return _Watershed( + image, + markers, + ); + } + + late final _WatershedPtr = + _lookup Function(Mat, Mat)>>( + 'Watershed'); + late final _Watershed = + _WatershedPtr.asFunction Function(Mat, Mat)>(); + + ffi.Pointer Watershed_Async( + Mat image, + Mat markers, + CvCallback_0 callback, + ) { + return _Watershed_Async( + image, + markers, + callback, + ); + } + + late final _Watershed_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, CvCallback_0)>>('Watershed_Async'); + late final _Watershed_Async = _Watershed_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, CvCallback_0)>(); + + void WeChatQRCode_Close( + WeChatQRCodePtr self, + ) { + return _WeChatQRCode_Close( + self, + ); + } + + late final _WeChatQRCode_ClosePtr = + _lookup>( + 'WeChatQRCode_Close'); + late final _WeChatQRCode_Close = + _WeChatQRCode_ClosePtr.asFunction(); + + ffi.Pointer WeChatQRCode_DetectAndDecode( + ffi.Pointer self, + Mat img, + ffi.Pointer points, + ffi.Pointer rval, + ) { + return _WeChatQRCode_DetectAndDecode( + self, + img, + points, + rval, + ); + } + + late final _WeChatQRCode_DetectAndDecodePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + Mat, + ffi.Pointer, + ffi.Pointer)>>('WeChatQRCode_DetectAndDecode'); + late final _WeChatQRCode_DetectAndDecode = + _WeChatQRCode_DetectAndDecodePtr.asFunction< + ffi.Pointer Function(ffi.Pointer, Mat, + ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer WeChatQRCode_GetScaleFactor( + ffi.Pointer self, + ffi.Pointer rval, + ) { + return _WeChatQRCode_GetScaleFactor( + self, + rval, + ); + } + + late final _WeChatQRCode_GetScaleFactorPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer)>>('WeChatQRCode_GetScaleFactor'); + late final _WeChatQRCode_GetScaleFactor = + _WeChatQRCode_GetScaleFactorPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer WeChatQRCode_New( + ffi.Pointer qrcode, + ) { + return _WeChatQRCode_New( + qrcode, + ); + } + + late final _WeChatQRCode_NewPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('WeChatQRCode_New'); + late final _WeChatQRCode_New = _WeChatQRCode_NewPtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer WeChatQRCode_NewWithParams( + ffi.Pointer detector_prototxt_path, + ffi.Pointer detector_caffe_model_path, + ffi.Pointer super_resolution_prototxt_path, + ffi.Pointer super_resolution_caffe_model_path, + ffi.Pointer qrcode, + ) { + return _WeChatQRCode_NewWithParams( + detector_prototxt_path, + detector_caffe_model_path, + super_resolution_prototxt_path, + super_resolution_caffe_model_path, + qrcode, + ); + } + + late final _WeChatQRCode_NewWithParamsPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>('WeChatQRCode_NewWithParams'); + late final _WeChatQRCode_NewWithParams = + _WeChatQRCode_NewWithParamsPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(); + + ffi.Pointer WeChatQRCode_SetScaleFactor( + ffi.Pointer self, + double scale_factor, + ) { + return _WeChatQRCode_SetScaleFactor( + self, + scale_factor, + ); + } + + late final _WeChatQRCode_SetScaleFactorPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Float)>>('WeChatQRCode_SetScaleFactor'); + late final _WeChatQRCode_SetScaleFactor = + _WeChatQRCode_SetScaleFactorPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, double)>(); + + void Window_Close( + ffi.Pointer winname, + ) { + return _Window_Close( + winname, + ); + } + + late final _Window_ClosePtr = + _lookup)>>( + 'Window_Close'); + late final _Window_Close = + _Window_ClosePtr.asFunction)>(); + + ffi.Pointer Window_GetProperty( + ffi.Pointer winname, + int flag, + ffi.Pointer rval, + ) { + return _Window_GetProperty( + winname, + flag, + rval, + ); + } + + late final _Window_GetPropertyPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Int, + ffi.Pointer)>>('Window_GetProperty'); + late final _Window_GetProperty = _Window_GetPropertyPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, ffi.Pointer)>(); + + ffi.Pointer Window_IMShow( + ffi.Pointer winname, + Mat mat, + ) { + return _Window_IMShow( + winname, + mat, + ); + } + + late final _Window_IMShowPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, Mat)>>('Window_IMShow'); + late final _Window_IMShow = _Window_IMShowPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, Mat)>(); + + ffi.Pointer Window_Move( + ffi.Pointer winname, + int x, + int y, + ) { + return _Window_Move( + winname, + x, + y, + ); + } + + late final _Window_MovePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Int, ffi.Int)>>('Window_Move'); + late final _Window_Move = _Window_MovePtr.asFunction< + ffi.Pointer Function(ffi.Pointer, int, int)>(); + + ffi.Pointer Window_New( + ffi.Pointer winname, + int flags, + ) { + return _Window_New( + winname, + flags, + ); + } + + late final _Window_NewPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Int)>>('Window_New'); + late final _Window_New = _Window_NewPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, int)>(); + + ffi.Pointer Window_Resize( + ffi.Pointer winname, + int width, + int height, + ) { + return _Window_Resize( + winname, + width, + height, + ); + } + + late final _Window_ResizePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Int, ffi.Int)>>('Window_Resize'); + late final _Window_Resize = _Window_ResizePtr.asFunction< + ffi.Pointer Function(ffi.Pointer, int, int)>(); + + ffi.Pointer Window_SelectROI( + ffi.Pointer winname, + Mat img, + ffi.Pointer rval, + ) { + return _Window_SelectROI( + winname, + img, + rval, + ); + } + + late final _Window_SelectROIPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, Mat, + ffi.Pointer)>>('Window_SelectROI'); + late final _Window_SelectROI = _Window_SelectROIPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, Mat, ffi.Pointer)>(); + + ffi.Pointer Window_SelectROIs( + ffi.Pointer winname, + Mat img, + ffi.Pointer rval, + ) { + return _Window_SelectROIs( + winname, + img, + rval, + ); + } + + late final _Window_SelectROIsPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, Mat, + ffi.Pointer)>>('Window_SelectROIs'); + late final _Window_SelectROIs = _Window_SelectROIsPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, Mat, ffi.Pointer)>(); + + ffi.Pointer Window_SetProperty( + ffi.Pointer winname, + int flag, + double value, + ) { + return _Window_SetProperty( + winname, + flag, + value, + ); + } + + late final _Window_SetPropertyPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Int, + ffi.Double)>>('Window_SetProperty'); + late final _Window_SetProperty = _Window_SetPropertyPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, int, double)>(); + + ffi.Pointer Window_SetTitle( + ffi.Pointer winname, + ffi.Pointer title, + ) { + return _Window_SetTitle( + winname, + title, + ); + } + + late final _Window_SetTitlePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer)>>('Window_SetTitle'); + late final _Window_SetTitle = _Window_SetTitlePtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer Window_WaitKey( + int delay, + ffi.Pointer rval, + ) { + return _Window_WaitKey( + delay, + rval, + ); + } + + late final _Window_WaitKeyPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Int, ffi.Pointer)>>('Window_WaitKey'); + late final _Window_WaitKey = _Window_WaitKeyPtr.asFunction< + ffi.Pointer Function(int, ffi.Pointer)>(); + + ffi.Pointer Zeros( + int rows, + int cols, + int type, + ffi.Pointer rval, + ) { + return _Zeros( + rows, + cols, + type, + rval, + ); + } + + late final _ZerosPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Int, ffi.Int, ffi.Int, ffi.Pointer)>>('Zeros'); + late final _Zeros = _ZerosPtr.asFunction< + ffi.Pointer Function(int, int, int, ffi.Pointer)>(); + + ffi.Pointer averageHashCompare( + Mat a, + Mat b, + ffi.Pointer rval, + ) { + return _averageHashCompare( + a, + b, + rval, + ); + } + + late final _averageHashComparePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, ffi.Pointer)>>('averageHashCompare'); + late final _averageHashCompare = _averageHashComparePtr.asFunction< + ffi.Pointer Function(Mat, Mat, ffi.Pointer)>(); + + ffi.Pointer averageHashCompute( + Mat inputArr, + Mat outputArr, + ) { + return _averageHashCompute( + inputArr, + outputArr, + ); + } + + late final _averageHashComputePtr = + _lookup Function(Mat, Mat)>>( + 'averageHashCompute'); + late final _averageHashCompute = _averageHashComputePtr + .asFunction Function(Mat, Mat)>(); + + ffi.Pointer blockMeanHashCompare( + Mat a, + Mat b, + int mode, + ffi.Pointer rval, + ) { + return _blockMeanHashCompare( + a, + b, + mode, + rval, + ); + } + + late final _blockMeanHashComparePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, ffi.Int, + ffi.Pointer)>>('blockMeanHashCompare'); + late final _blockMeanHashCompare = _blockMeanHashComparePtr.asFunction< + ffi.Pointer Function(Mat, Mat, int, ffi.Pointer)>(); + + ffi.Pointer blockMeanHashCompute( + Mat inputArr, + Mat outputArr, + int mode, + ) { + return _blockMeanHashCompute( + inputArr, + outputArr, + mode, + ); + } + + late final _blockMeanHashComputePtr = _lookup< + ffi + .NativeFunction Function(Mat, Mat, ffi.Int)>>( + 'blockMeanHashCompute'); + late final _blockMeanHashCompute = _blockMeanHashComputePtr + .asFunction Function(Mat, Mat, int)>(); + + ffi.Pointer calibrateCamera_Async( + VecVecPoint3f objectPoints, + VecVecPoint2f imagePoints, + Size imageSize, + Mat cameraMatrix, + Mat distCoeffs, + int flag, + TermCriteria criteria, + CvCallback_5 callback, + ) { + return _calibrateCamera_Async( + objectPoints, + imagePoints, + imageSize, + cameraMatrix, + distCoeffs, + flag, + criteria, + callback, + ); + } + + late final _calibrateCamera_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecVecPoint3f, + VecVecPoint2f, + Size, + Mat, + Mat, + ffi.Int, + TermCriteria, + CvCallback_5)>>('calibrateCamera_Async'); + late final _calibrateCamera_Async = _calibrateCamera_AsyncPtr.asFunction< + ffi.Pointer Function(VecVecPoint3f, VecVecPoint2f, Size, Mat, + Mat, int, TermCriteria, CvCallback_5)>(); + + ffi.Pointer colorMomentHashCompare( + Mat a, + Mat b, + ffi.Pointer rval, + ) { + return _colorMomentHashCompare( + a, + b, + rval, + ); + } + + late final _colorMomentHashComparePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, ffi.Pointer)>>('colorMomentHashCompare'); + late final _colorMomentHashCompare = _colorMomentHashComparePtr.asFunction< + ffi.Pointer Function(Mat, Mat, ffi.Pointer)>(); + + ffi.Pointer colorMomentHashCompute( + Mat inputArr, + Mat outputArr, + ) { + return _colorMomentHashCompute( + inputArr, + outputArr, + ); + } + + late final _colorMomentHashComputePtr = + _lookup Function(Mat, Mat)>>( + 'colorMomentHashCompute'); + late final _colorMomentHashCompute = _colorMomentHashComputePtr + .asFunction Function(Mat, Mat)>(); + + ffi.Pointer core_AbsDiff_Async( + Mat src1, + Mat src2, + CvCallback_1 callback, + ) { + return _core_AbsDiff_Async( + src1, + src2, + callback, + ); + } + + late final _core_AbsDiff_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, CvCallback_1)>>('core_AbsDiff_Async'); + late final _core_AbsDiff_Async = _core_AbsDiff_AsyncPtr + .asFunction Function(Mat, Mat, CvCallback_1)>(); + + ffi.Pointer core_AddWeighted_Async( + Mat src1, + double alpha, + Mat src2, + double beta, + double gamma, + int dtype, + CvCallback_1 callback, + ) { + return _core_AddWeighted_Async( + src1, + alpha, + src2, + beta, + gamma, + dtype, + callback, + ); + } + + late final _core_AddWeighted_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, ffi.Double, Mat, ffi.Double, + ffi.Double, ffi.Int, CvCallback_1)>>('core_AddWeighted_Async'); + late final _core_AddWeighted_Async = _core_AddWeighted_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, double, Mat, double, double, int, CvCallback_1)>(); + + ffi.Pointer core_Add_Async( + Mat src1, + Mat src2, + Mat mask, + int dtype, + CvCallback_1 callback, + ) { + return _core_Add_Async( + src1, + src2, + mask, + dtype, + callback, + ); + } + + late final _core_Add_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, Mat, ffi.Int, CvCallback_1)>>('core_Add_Async'); + late final _core_Add_Async = _core_Add_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, int, CvCallback_1)>(); + + ffi.Pointer core_BatchDistance_Async( + Mat src1, + Mat src2, + int dtype, + int normType, + int K, + Mat mask, + int update, + bool crosscheck, + CvCallback_2 callback, ) { - return _Subdiv2D_GetEdge( - self, - edge, - nextEdgeType, - rval, + return _core_BatchDistance_Async( + src1, + src2, + dtype, + normType, + K, + mask, + update, + crosscheck, + callback, ); } - late final _Subdiv2D_GetEdgePtr = _lookup< + late final _core_BatchDistance_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Subdiv2D, ffi.Int, ffi.Int, - ffi.Pointer)>>('Subdiv2D_GetEdge'); - late final _Subdiv2D_GetEdge = _Subdiv2D_GetEdgePtr.asFunction< - ffi.Pointer Function( - Subdiv2D, int, int, ffi.Pointer)>(); + ffi.Pointer Function( + Mat, + Mat, + ffi.Int, + ffi.Int, + ffi.Int, + Mat, + ffi.Int, + ffi.Bool, + CvCallback_2)>>('core_BatchDistance_Async'); + late final _core_BatchDistance_Async = + _core_BatchDistance_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, int, int, int, Mat, int, bool, CvCallback_2)>(); - ffi.Pointer Subdiv2D_GetEdgeList( - Subdiv2D self, - ffi.Pointer> rval, - ffi.Pointer size, + ffi.Pointer core_BitwiseAndWithMask_Async( + Mat src1, + Mat src2, + Mat mask, + CvCallback_1 callback, ) { - return _Subdiv2D_GetEdgeList( - self, - rval, - size, + return _core_BitwiseAndWithMask_Async( + src1, + src2, + mask, + callback, ); } - late final _Subdiv2D_GetEdgeListPtr = _lookup< + late final _core_BitwiseAndWithMask_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - Subdiv2D, - ffi.Pointer>, - ffi.Pointer)>>('Subdiv2D_GetEdgeList'); - late final _Subdiv2D_GetEdgeList = _Subdiv2D_GetEdgeListPtr.asFunction< - ffi.Pointer Function( - Subdiv2D, ffi.Pointer>, ffi.Pointer)>(); + Mat, Mat, Mat, CvCallback_1)>>('core_BitwiseAndWithMask_Async'); + late final _core_BitwiseAndWithMask_Async = + _core_BitwiseAndWithMask_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, CvCallback_1)>(); - ffi.Pointer Subdiv2D_GetLeadingEdgeList( - Subdiv2D self, - ffi.Pointer leadingEdgeList, + ffi.Pointer core_BitwiseAnd_Async( + Mat src1, + Mat src2, + CvCallback_1 callback, ) { - return _Subdiv2D_GetLeadingEdgeList( - self, - leadingEdgeList, + return _core_BitwiseAnd_Async( + src1, + src2, + callback, ); } - late final _Subdiv2D_GetLeadingEdgeListPtr = _lookup< + late final _core_BitwiseAnd_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - Subdiv2D, ffi.Pointer)>>('Subdiv2D_GetLeadingEdgeList'); - late final _Subdiv2D_GetLeadingEdgeList = - _Subdiv2D_GetLeadingEdgeListPtr.asFunction< - ffi.Pointer Function(Subdiv2D, ffi.Pointer)>(); + Mat, Mat, CvCallback_1)>>('core_BitwiseAnd_Async'); + late final _core_BitwiseAnd_Async = _core_BitwiseAnd_AsyncPtr + .asFunction Function(Mat, Mat, CvCallback_1)>(); - ffi.Pointer Subdiv2D_GetTriangleList( - Subdiv2D self, - ffi.Pointer> rval, - ffi.Pointer size, + ffi.Pointer core_BitwiseNotWithMask_Async( + Mat src1, + Mat mask, + CvCallback_1 callback, ) { - return _Subdiv2D_GetTriangleList( - self, - rval, - size, + return _core_BitwiseNotWithMask_Async( + src1, + mask, + callback, ); } - late final _Subdiv2D_GetTriangleListPtr = _lookup< + late final _core_BitwiseNotWithMask_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - Subdiv2D, - ffi.Pointer>, - ffi.Pointer)>>('Subdiv2D_GetTriangleList'); - late final _Subdiv2D_GetTriangleList = - _Subdiv2D_GetTriangleListPtr.asFunction< - ffi.Pointer Function(Subdiv2D, - ffi.Pointer>, ffi.Pointer)>(); + Mat, Mat, CvCallback_1)>>('core_BitwiseNotWithMask_Async'); + late final _core_BitwiseNotWithMask_Async = _core_BitwiseNotWithMask_AsyncPtr + .asFunction Function(Mat, Mat, CvCallback_1)>(); - ffi.Pointer Subdiv2D_GetVertex( - Subdiv2D self, - int vertex, - ffi.Pointer firstEdge, - ffi.Pointer rval, + ffi.Pointer core_BitwiseNot_Async( + Mat src1, + CvCallback_1 callback, ) { - return _Subdiv2D_GetVertex( - self, - vertex, - firstEdge, - rval, + return _core_BitwiseNot_Async( + src1, + callback, ); } - late final _Subdiv2D_GetVertexPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - Subdiv2D, - ffi.Int, - ffi.Pointer, - ffi.Pointer)>>('Subdiv2D_GetVertex'); - late final _Subdiv2D_GetVertex = _Subdiv2D_GetVertexPtr.asFunction< - ffi.Pointer Function( - Subdiv2D, int, ffi.Pointer, ffi.Pointer)>(); + late final _core_BitwiseNot_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Mat, CvCallback_1)>>( + 'core_BitwiseNot_Async'); + late final _core_BitwiseNot_Async = _core_BitwiseNot_AsyncPtr + .asFunction Function(Mat, CvCallback_1)>(); - ffi.Pointer Subdiv2D_GetVoronoiFacetList( - Subdiv2D self, - VecInt idx, - ffi.Pointer facetList, - ffi.Pointer facetCenters, + ffi.Pointer core_BitwiseOrWithMask_Async( + Mat src1, + Mat src2, + Mat mask, + CvCallback_1 callback, ) { - return _Subdiv2D_GetVoronoiFacetList( - self, - idx, - facetList, - facetCenters, + return _core_BitwiseOrWithMask_Async( + src1, + src2, + mask, + callback, ); } - late final _Subdiv2D_GetVoronoiFacetListPtr = _lookup< + late final _core_BitwiseOrWithMask_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - Subdiv2D, - VecInt, - ffi.Pointer, - ffi.Pointer)>>('Subdiv2D_GetVoronoiFacetList'); - late final _Subdiv2D_GetVoronoiFacetList = - _Subdiv2D_GetVoronoiFacetListPtr.asFunction< - ffi.Pointer Function(Subdiv2D, VecInt, - ffi.Pointer, ffi.Pointer)>(); + Mat, Mat, Mat, CvCallback_1)>>('core_BitwiseOrWithMask_Async'); + late final _core_BitwiseOrWithMask_Async = + _core_BitwiseOrWithMask_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, CvCallback_1)>(); - ffi.Pointer Subdiv2D_InitDelaunay( - Subdiv2D self, - Rect rect, + ffi.Pointer core_BitwiseOr_Async( + Mat src1, + Mat src2, + CvCallback_1 callback, ) { - return _Subdiv2D_InitDelaunay( - self, - rect, + return _core_BitwiseOr_Async( + src1, + src2, + callback, ); } - late final _Subdiv2D_InitDelaunayPtr = _lookup< - ffi.NativeFunction Function(Subdiv2D, Rect)>>( - 'Subdiv2D_InitDelaunay'); - late final _Subdiv2D_InitDelaunay = _Subdiv2D_InitDelaunayPtr.asFunction< - ffi.Pointer Function(Subdiv2D, Rect)>(); + late final _core_BitwiseOr_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, CvCallback_1)>>('core_BitwiseOr_Async'); + late final _core_BitwiseOr_Async = _core_BitwiseOr_AsyncPtr + .asFunction Function(Mat, Mat, CvCallback_1)>(); - ffi.Pointer Subdiv2D_Insert( - Subdiv2D self, - Point2f pt, - ffi.Pointer rval, + ffi.Pointer core_BitwiseXorWithMask_Async( + Mat src1, + Mat src2, + Mat mask, + CvCallback_1 callback, ) { - return _Subdiv2D_Insert( - self, - pt, - rval, + return _core_BitwiseXorWithMask_Async( + src1, + src2, + mask, + callback, ); } - late final _Subdiv2D_InsertPtr = _lookup< + late final _core_BitwiseXorWithMask_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - Subdiv2D, Point2f, ffi.Pointer)>>('Subdiv2D_Insert'); - late final _Subdiv2D_Insert = _Subdiv2D_InsertPtr.asFunction< - ffi.Pointer Function( - Subdiv2D, Point2f, ffi.Pointer)>(); + Mat, Mat, Mat, CvCallback_1)>>('core_BitwiseXorWithMask_Async'); + late final _core_BitwiseXorWithMask_Async = + _core_BitwiseXorWithMask_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, CvCallback_1)>(); - ffi.Pointer Subdiv2D_InsertVec( - Subdiv2D self, - VecPoint2f ptvec, + ffi.Pointer core_BitwiseXor_Async( + Mat src1, + Mat src2, + CvCallback_1 callback, ) { - return _Subdiv2D_InsertVec( - self, - ptvec, + return _core_BitwiseXor_Async( + src1, + src2, + callback, ); } - late final _Subdiv2D_InsertVecPtr = _lookup< + late final _core_BitwiseXor_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - Subdiv2D, VecPoint2f)>>('Subdiv2D_InsertVec'); - late final _Subdiv2D_InsertVec = _Subdiv2D_InsertVecPtr.asFunction< - ffi.Pointer Function(Subdiv2D, VecPoint2f)>(); + Mat, Mat, CvCallback_1)>>('core_BitwiseXor_Async'); + late final _core_BitwiseXor_Async = _core_BitwiseXor_AsyncPtr + .asFunction Function(Mat, Mat, CvCallback_1)>(); - ffi.Pointer Subdiv2D_Locate( - Subdiv2D self, - Point2f pt, - ffi.Pointer edge, - ffi.Pointer vertex, - ffi.Pointer rval, + ffi.Pointer core_BorderInterpolate_Async( + int p, + int len, + int borderType, + CvCallback_1 callback, ) { - return _Subdiv2D_Locate( - self, - pt, - edge, - vertex, - rval, + return _core_BorderInterpolate_Async( + p, + len, + borderType, + callback, ); } - late final _Subdiv2D_LocatePtr = _lookup< + late final _core_BorderInterpolate_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - Subdiv2D, - Point2f, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>('Subdiv2D_Locate'); - late final _Subdiv2D_Locate = _Subdiv2D_LocatePtr.asFunction< - ffi.Pointer Function(Subdiv2D, Point2f, ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); + ffi.Pointer Function(ffi.Int, ffi.Int, ffi.Int, + CvCallback_1)>>('core_BorderInterpolate_Async'); + late final _core_BorderInterpolate_Async = + _core_BorderInterpolate_AsyncPtr.asFunction< + ffi.Pointer Function(int, int, int, CvCallback_1)>(); - ffi.Pointer Subdiv2D_NewEmpty( - ffi.Pointer rval, + ffi.Pointer core_CalcCovarMatrix_Async( + Mat samples, + Mat mean, + int flags, + int ctype, + CvCallback_1 callback, ) { - return _Subdiv2D_NewEmpty( - rval, + return _core_CalcCovarMatrix_Async( + samples, + mean, + flags, + ctype, + callback, ); } - late final _Subdiv2D_NewEmptyPtr = _lookup< + late final _core_CalcCovarMatrix_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>>('Subdiv2D_NewEmpty'); - late final _Subdiv2D_NewEmpty = _Subdiv2D_NewEmptyPtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + ffi.Pointer Function(Mat, Mat, ffi.Int, ffi.Int, + CvCallback_1)>>('core_CalcCovarMatrix_Async'); + late final _core_CalcCovarMatrix_Async = + _core_CalcCovarMatrix_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, int, int, CvCallback_1)>(); - ffi.Pointer Subdiv2D_NewWithRect( - Rect rect, - ffi.Pointer rval, + ffi.Pointer core_CartToPolar_Async( + Mat x, + Mat y, + bool angleInDegrees, + CvCallback_2 callback, ) { - return _Subdiv2D_NewWithRect( - rect, - rval, + return _core_CartToPolar_Async( + x, + y, + angleInDegrees, + callback, ); } - late final _Subdiv2D_NewWithRectPtr = _lookup< + late final _core_CartToPolar_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - Rect, ffi.Pointer)>>('Subdiv2D_NewWithRect'); - late final _Subdiv2D_NewWithRect = _Subdiv2D_NewWithRectPtr.asFunction< - ffi.Pointer Function(Rect, ffi.Pointer)>(); + Mat, Mat, ffi.Bool, CvCallback_2)>>('core_CartToPolar_Async'); + late final _core_CartToPolar_Async = _core_CartToPolar_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, bool, CvCallback_2)>(); - ffi.Pointer Subdiv2D_NextEdge( - Subdiv2D self, - int edge, - ffi.Pointer rval, + ffi.Pointer core_CheckRange_Async( + Mat self, + bool quiet, + double minVal, + double maxVal, + CvCallback_2 callback, ) { - return _Subdiv2D_NextEdge( + return _core_CheckRange_Async( self, - edge, - rval, + quiet, + minVal, + maxVal, + callback, ); } - late final _Subdiv2D_NextEdgePtr = _lookup< + late final _core_CheckRange_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - Subdiv2D, ffi.Int, ffi.Pointer)>>('Subdiv2D_NextEdge'); - late final _Subdiv2D_NextEdge = _Subdiv2D_NextEdgePtr.asFunction< - ffi.Pointer Function(Subdiv2D, int, ffi.Pointer)>(); + ffi.Pointer Function(Mat, ffi.Bool, ffi.Double, ffi.Double, + CvCallback_2)>>('core_CheckRange_Async'); + late final _core_CheckRange_Async = _core_CheckRange_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, bool, double, double, CvCallback_2)>(); - ffi.Pointer Subdiv2D_RotateEdge( - Subdiv2D self, - int edge, - int rotate, - ffi.Pointer rval, + ffi.Pointer core_Compare_Async( + Mat src1, + Mat src2, + int ct, + CvCallback_1 callback, ) { - return _Subdiv2D_RotateEdge( - self, - edge, - rotate, - rval, + return _core_Compare_Async( + src1, + src2, + ct, + callback, ); } - late final _Subdiv2D_RotateEdgePtr = _lookup< + late final _core_Compare_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Subdiv2D, ffi.Int, ffi.Int, - ffi.Pointer)>>('Subdiv2D_RotateEdge'); - late final _Subdiv2D_RotateEdge = _Subdiv2D_RotateEdgePtr.asFunction< - ffi.Pointer Function( - Subdiv2D, int, int, ffi.Pointer)>(); + ffi.Pointer Function( + Mat, Mat, ffi.Int, CvCallback_1)>>('core_Compare_Async'); + late final _core_Compare_Async = _core_Compare_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, int, CvCallback_1)>(); - ffi.Pointer Subdiv2D_SymEdge( - Subdiv2D self, - int edge, - ffi.Pointer rval, + ffi.Pointer core_CompleteSymm_Async( + Mat self, + bool lowerToUpper, + CvCallback_0 callback, ) { - return _Subdiv2D_SymEdge( + return _core_CompleteSymm_Async( self, - edge, - rval, + lowerToUpper, + callback, ); } - late final _Subdiv2D_SymEdgePtr = _lookup< + late final _core_CompleteSymm_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - Subdiv2D, ffi.Int, ffi.Pointer)>>('Subdiv2D_SymEdge'); - late final _Subdiv2D_SymEdge = _Subdiv2D_SymEdgePtr.asFunction< - ffi.Pointer Function(Subdiv2D, int, ffi.Pointer)>(); + Mat, ffi.Bool, CvCallback_0)>>('core_CompleteSymm_Async'); + late final _core_CompleteSymm_Async = _core_CompleteSymm_AsyncPtr + .asFunction Function(Mat, bool, CvCallback_0)>(); - ffi.Pointer TextureFlattening( + ffi.Pointer core_ConvertScaleAbs_Async( Mat src, - Mat mask, - Mat dst, - double low_threshold, - double high_threshold, - int kernel_size, + double alpha, + double beta, + CvCallback_1 callback, ) { - return _TextureFlattening( + return _core_ConvertScaleAbs_Async( src, - mask, - dst, - low_threshold, - high_threshold, - kernel_size, + alpha, + beta, + callback, ); } - late final _TextureFlatteningPtr = _lookup< + late final _core_ConvertScaleAbs_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Mat, Mat, Mat, ffi.Float, ffi.Float, - ffi.Int)>>('TextureFlattening'); - late final _TextureFlattening = _TextureFlatteningPtr.asFunction< - ffi.Pointer Function(Mat, Mat, Mat, double, double, int)>(); - - ffi.Pointer TheRNG( - ffi.Pointer rval, - ) { - return _TheRNG( - rval, - ); - } - - late final _TheRNGPtr = _lookup< - ffi.NativeFunction Function(ffi.Pointer)>>( - 'TheRNG'); - late final _TheRNG = - _TheRNGPtr.asFunction Function(ffi.Pointer)>(); + ffi.Pointer Function(Mat, ffi.Double, ffi.Double, + CvCallback_1)>>('core_ConvertScaleAbs_Async'); + late final _core_ConvertScaleAbs_Async = + _core_ConvertScaleAbs_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, double, double, CvCallback_1)>(); - ffi.Pointer Threshold( + ffi.Pointer core_CopyMakeBorder_Async( Mat src, - Mat dst, - double thresh, - double maxvalue, - int typ, - ffi.Pointer rval, + int top, + int bottom, + int left, + int right, + int borderType, + Scalar value, + CvCallback_1 callback, ) { - return _Threshold( + return _core_CopyMakeBorder_Async( src, - dst, - thresh, - maxvalue, - typ, - rval, + top, + bottom, + left, + right, + borderType, + value, + callback, ); } - late final _ThresholdPtr = _lookup< + late final _core_CopyMakeBorder_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Mat, Mat, ffi.Double, ffi.Double, - ffi.Int, ffi.Pointer)>>('Threshold'); - late final _Threshold = _ThresholdPtr.asFunction< - ffi.Pointer Function( - Mat, Mat, double, double, int, ffi.Pointer)>(); + ffi.Pointer Function( + Mat, + ffi.Int, + ffi.Int, + ffi.Int, + ffi.Int, + ffi.Int, + Scalar, + CvCallback_1)>>('core_CopyMakeBorder_Async'); + late final _core_CopyMakeBorder_Async = + _core_CopyMakeBorder_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, int, int, int, int, int, Scalar, CvCallback_1)>(); - ffi.Pointer Trackbar_Create( - ffi.Pointer winname, - ffi.Pointer trackname, - int max, + ffi.Pointer core_CountNonZero_Async( + Mat src, + CvCallback_1 callback, ) { - return _Trackbar_Create( - winname, - trackname, - max, + return _core_CountNonZero_Async( + src, + callback, ); } - late final _Trackbar_CreatePtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Int)>>('Trackbar_Create'); - late final _Trackbar_Create = _Trackbar_CreatePtr.asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer, int)>(); + late final _core_CountNonZero_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Mat, CvCallback_1)>>( + 'core_CountNonZero_Async'); + late final _core_CountNonZero_Async = _core_CountNonZero_AsyncPtr + .asFunction Function(Mat, CvCallback_1)>(); - ffi.Pointer Trackbar_CreateWithValue( - ffi.Pointer winname, - ffi.Pointer trackname, - ffi.Pointer value, - int max, + ffi.Pointer core_DCT_Async( + Mat src, + int flags, + CvCallback_1 callback, ) { - return _Trackbar_CreateWithValue( - winname, - trackname, - value, - max, + return _core_DCT_Async( + src, + flags, + callback, ); } - late final _Trackbar_CreateWithValuePtr = _lookup< + late final _core_DCT_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Int)>>('Trackbar_CreateWithValue'); - late final _Trackbar_CreateWithValue = - _Trackbar_CreateWithValuePtr.asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer, int)>(); + Mat, ffi.Int, CvCallback_1)>>('core_DCT_Async'); + late final _core_DCT_Async = _core_DCT_AsyncPtr + .asFunction Function(Mat, int, CvCallback_1)>(); - ffi.Pointer Trackbar_GetPos( - ffi.Pointer winname, - ffi.Pointer trackname, - ffi.Pointer rval, + ffi.Pointer core_DFT_Async( + Mat self, + int flags, + int nonzeroRows, + CvCallback_1 callback, ) { - return _Trackbar_GetPos( - winname, - trackname, - rval, + return _core_DFT_Async( + self, + flags, + nonzeroRows, + callback, ); } - late final _Trackbar_GetPosPtr = _lookup< + late final _core_DFT_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>>('Trackbar_GetPos'); - late final _Trackbar_GetPos = _Trackbar_GetPosPtr.asFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Pointer)>(); + ffi.Pointer Function( + Mat, ffi.Int, ffi.Int, CvCallback_1)>>('core_DFT_Async'); + late final _core_DFT_Async = _core_DFT_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, int, CvCallback_1)>(); - ffi.Pointer Trackbar_SetMax( - ffi.Pointer winname, - ffi.Pointer trackname, - int pos, + ffi.Pointer core_Determinant_Async( + Mat self, + CvCallback_1 callback, ) { - return _Trackbar_SetMax( - winname, - trackname, - pos, + return _core_Determinant_Async( + self, + callback, ); } - late final _Trackbar_SetMaxPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Int)>>('Trackbar_SetMax'); - late final _Trackbar_SetMax = _Trackbar_SetMaxPtr.asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer, int)>(); + late final _core_Determinant_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Mat, CvCallback_1)>>( + 'core_Determinant_Async'); + late final _core_Determinant_Async = _core_Determinant_AsyncPtr + .asFunction Function(Mat, CvCallback_1)>(); - ffi.Pointer Trackbar_SetMin( - ffi.Pointer winname, - ffi.Pointer trackname, - int pos, + ffi.Pointer core_Divide_Async( + Mat src1, + Mat src2, + double scale, + int dtype, + CvCallback_1 callback, ) { - return _Trackbar_SetMin( - winname, - trackname, - pos, + return _core_Divide_Async( + src1, + src2, + scale, + dtype, + callback, ); } - late final _Trackbar_SetMinPtr = _lookup< + late final _core_Divide_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Int)>>('Trackbar_SetMin'); - late final _Trackbar_SetMin = _Trackbar_SetMinPtr.asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer, int)>(); - - ffi.Pointer Trackbar_SetPos( - ffi.Pointer winname, - ffi.Pointer trackname, - int pos, - ) { - return _Trackbar_SetPos( - winname, - trackname, - pos, + ffi.Pointer Function(Mat, Mat, ffi.Double, ffi.Int, + CvCallback_1)>>('core_Divide_Async'); + late final _core_Divide_Async = _core_Divide_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, double, int, CvCallback_1)>(); + + ffi.Pointer core_EigenNonSymmetric_Async( + Mat src, + CvCallback_2 callback, + ) { + return _core_EigenNonSymmetric_Async( + src, + callback, ); } - late final _Trackbar_SetPosPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Int)>>('Trackbar_SetPos'); - late final _Trackbar_SetPos = _Trackbar_SetPosPtr.asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer, int)>(); + late final _core_EigenNonSymmetric_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Mat, CvCallback_2)>>( + 'core_EigenNonSymmetric_Async'); + late final _core_EigenNonSymmetric_Async = _core_EigenNonSymmetric_AsyncPtr + .asFunction Function(Mat, CvCallback_2)>(); - void TrackerMIL_Close( - TrackerMILPtr self, + ffi.Pointer core_Eigen_Async( + Mat src, + CvCallback_3 callback, ) { - return _TrackerMIL_Close( - self, + return _core_Eigen_Async( + src, + callback, ); } - late final _TrackerMIL_ClosePtr = - _lookup>( - 'TrackerMIL_Close'); - late final _TrackerMIL_Close = - _TrackerMIL_ClosePtr.asFunction(); + late final _core_Eigen_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Mat, CvCallback_3)>>( + 'core_Eigen_Async'); + late final _core_Eigen_Async = _core_Eigen_AsyncPtr + .asFunction Function(Mat, CvCallback_3)>(); - ffi.Pointer TrackerMIL_Create( - ffi.Pointer rval, + ffi.Pointer core_Exp_Async( + Mat src, + CvCallback_1 callback, ) { - return _TrackerMIL_Create( - rval, + return _core_Exp_Async( + src, + callback, ); } - late final _TrackerMIL_CreatePtr = _lookup< + late final _core_Exp_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>>('TrackerMIL_Create'); - late final _TrackerMIL_Create = _TrackerMIL_CreatePtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + ffi.Pointer Function(Mat, CvCallback_1)>>('core_Exp_Async'); + late final _core_Exp_Async = _core_Exp_AsyncPtr + .asFunction Function(Mat, CvCallback_1)>(); - ffi.Pointer TrackerMIL_Init( - TrackerMIL self, - Mat image, - Rect bbox, + ffi.Pointer core_ExtractChannel_Async( + Mat src, + int coi, + CvCallback_1 callback, ) { - return _TrackerMIL_Init( - self, - image, - bbox, + return _core_ExtractChannel_Async( + src, + coi, + callback, ); } - late final _TrackerMIL_InitPtr = _lookup< + late final _core_ExtractChannel_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - TrackerMIL, Mat, Rect)>>('TrackerMIL_Init'); - late final _TrackerMIL_Init = _TrackerMIL_InitPtr.asFunction< - ffi.Pointer Function(TrackerMIL, Mat, Rect)>(); + Mat, ffi.Int, CvCallback_1)>>('core_ExtractChannel_Async'); + late final _core_ExtractChannel_Async = _core_ExtractChannel_AsyncPtr + .asFunction Function(Mat, int, CvCallback_1)>(); - ffi.Pointer TrackerMIL_Update( - TrackerMIL self, - Mat image, - ffi.Pointer boundingBox, - ffi.Pointer rval, + ffi.Pointer core_FindNonZero_Async( + Mat src, + CvCallback_1 callback, ) { - return _TrackerMIL_Update( - self, - image, - boundingBox, - rval, + return _core_FindNonZero_Async( + src, + callback, ); } - late final _TrackerMIL_UpdatePtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(TrackerMIL, Mat, ffi.Pointer, - ffi.Pointer)>>('TrackerMIL_Update'); - late final _TrackerMIL_Update = _TrackerMIL_UpdatePtr.asFunction< - ffi.Pointer Function( - TrackerMIL, Mat, ffi.Pointer, ffi.Pointer)>(); + late final _core_FindNonZero_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Mat, CvCallback_1)>>( + 'core_FindNonZero_Async'); + late final _core_FindNonZero_Async = _core_FindNonZero_AsyncPtr + .asFunction Function(Mat, CvCallback_1)>(); - ffi.Pointer Undistort( + ffi.Pointer core_Flip_Async( Mat src, - Mat dst, - Mat cameraMatrix, - Mat distCoeffs, - Mat newCameraMatrix, + int flipCode, + CvCallback_1 callback, ) { - return _Undistort( + return _core_Flip_Async( src, - dst, - cameraMatrix, - distCoeffs, - newCameraMatrix, + flipCode, + callback, ); } - late final _UndistortPtr = _lookup< + late final _core_Flip_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - Mat, Mat, Mat, Mat, Mat)>>('Undistort'); - late final _Undistort = _UndistortPtr.asFunction< - ffi.Pointer Function(Mat, Mat, Mat, Mat, Mat)>(); + Mat, ffi.Int, CvCallback_1)>>('core_Flip_Async'); + late final _core_Flip_Async = _core_Flip_AsyncPtr + .asFunction Function(Mat, int, CvCallback_1)>(); - ffi.Pointer UndistortPoints( - Mat distorted, - Mat undistorted, - Mat k, - Mat d, - Mat r, - Mat p, - TermCriteria criteria, + ffi.Pointer core_Gemm_Async( + Mat src1, + Mat src2, + double alpha, + Mat src3, + double beta, + int flags, + CvCallback_1 callback, ) { - return _UndistortPoints( - distorted, - undistorted, - k, - d, - r, - p, - criteria, + return _core_Gemm_Async( + src1, + src2, + alpha, + src3, + beta, + flags, + callback, ); } - late final _UndistortPointsPtr = _lookup< + late final _core_Gemm_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - Mat, Mat, Mat, Mat, Mat, Mat, TermCriteria)>>('UndistortPoints'); - late final _UndistortPoints = _UndistortPointsPtr.asFunction< + ffi.Pointer Function(Mat, Mat, ffi.Double, Mat, ffi.Double, + ffi.Int, CvCallback_1)>>('core_Gemm_Async'); + late final _core_Gemm_Async = _core_Gemm_AsyncPtr.asFunction< ffi.Pointer Function( - Mat, Mat, Mat, Mat, Mat, Mat, TermCriteria)>(); + Mat, Mat, double, Mat, double, int, CvCallback_1)>(); - ffi.Pointer VecChar_Append( - VecChar vec, - int i, + ffi.Pointer core_GetOptimalDFTSize_Async( + int vecsize, + CvCallback_1 callback, ) { - return _VecChar_Append( - vec, - i, + return _core_GetOptimalDFTSize_Async( + vecsize, + callback, ); } - late final _VecChar_AppendPtr = _lookup< + late final _core_GetOptimalDFTSize_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(VecChar, ffi.Char)>>('VecChar_Append'); - late final _VecChar_Append = _VecChar_AppendPtr.asFunction< - ffi.Pointer Function(VecChar, int)>(); + ffi.Pointer Function( + ffi.Int, CvCallback_1)>>('core_GetOptimalDFTSize_Async'); + late final _core_GetOptimalDFTSize_Async = _core_GetOptimalDFTSize_AsyncPtr + .asFunction Function(int, CvCallback_1)>(); - ffi.Pointer VecChar_At( - VecChar vec, - int idx, - ffi.Pointer rval, + ffi.Pointer core_Hconcat_Async( + Mat src1, + Mat src2, + CvCallback_1 callback, ) { - return _VecChar_At( - vec, - idx, - rval, + return _core_Hconcat_Async( + src1, + src2, + callback, ); } - late final _VecChar_AtPtr = _lookup< + late final _core_Hconcat_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecChar, ffi.Int, ffi.Pointer)>>('VecChar_At'); - late final _VecChar_At = _VecChar_AtPtr.asFunction< - ffi.Pointer Function(VecChar, int, ffi.Pointer)>(); + Mat, Mat, CvCallback_1)>>('core_Hconcat_Async'); + late final _core_Hconcat_Async = _core_Hconcat_AsyncPtr + .asFunction Function(Mat, Mat, CvCallback_1)>(); - void VecChar_Close( - VecCharPtr vec, + ffi.Pointer core_Idct_Async( + Mat src, + int flags, + CvCallback_1 callback, ) { - return _VecChar_Close( - vec, + return _core_Idct_Async( + src, + flags, + callback, ); } - late final _VecChar_ClosePtr = - _lookup>( - 'VecChar_Close'); - late final _VecChar_Close = - _VecChar_ClosePtr.asFunction(); + late final _core_Idct_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, ffi.Int, CvCallback_1)>>('core_Idct_Async'); + late final _core_Idct_Async = _core_Idct_AsyncPtr + .asFunction Function(Mat, int, CvCallback_1)>(); - ffi.Pointer VecChar_Data( - VecChar vec, - ffi.Pointer> rval, + ffi.Pointer core_Idft_Async( + Mat src, + int flags, + int nonzeroRows, + CvCallback_1 callback, ) { - return _VecChar_Data( - vec, - rval, + return _core_Idft_Async( + src, + flags, + nonzeroRows, + callback, ); } - late final _VecChar_DataPtr = _lookup< + late final _core_Idft_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecChar, ffi.Pointer>)>>('VecChar_Data'); - late final _VecChar_Data = _VecChar_DataPtr.asFunction< - ffi.Pointer Function( - VecChar, ffi.Pointer>)>(); + Mat, ffi.Int, ffi.Int, CvCallback_1)>>('core_Idft_Async'); + late final _core_Idft_Async = _core_Idft_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, int, CvCallback_1)>(); - ffi.Pointer VecChar_New( - ffi.Pointer rval, + ffi.Pointer core_InRangeWithScalar_Async( + Mat src, + Scalar lowerb, + Scalar upperb, + CvCallback_1 callback, ) { - return _VecChar_New( - rval, + return _core_InRangeWithScalar_Async( + src, + lowerb, + upperb, + callback, ); } - late final _VecChar_NewPtr = _lookup< + late final _core_InRangeWithScalar_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer)>>('VecChar_New'); - late final _VecChar_New = _VecChar_NewPtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + ffi.Pointer Function(Mat, Scalar, Scalar, + CvCallback_1)>>('core_InRangeWithScalar_Async'); + late final _core_InRangeWithScalar_Async = + _core_InRangeWithScalar_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Scalar, Scalar, CvCallback_1)>(); - ffi.Pointer VecChar_NewFromPointer( - ffi.Pointer p, - int length, - ffi.Pointer rval, + ffi.Pointer core_InRange_Async( + Mat src, + Mat lowerb, + Mat upperb, + CvCallback_1 callback, ) { - return _VecChar_NewFromPointer( - p, - length, - rval, + return _core_InRange_Async( + src, + lowerb, + upperb, + callback, ); } - late final _VecChar_NewFromPointerPtr = _lookup< + late final _core_InRange_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, ffi.Int, - ffi.Pointer)>>('VecChar_NewFromPointer'); - late final _VecChar_NewFromPointer = _VecChar_NewFromPointerPtr.asFunction< - ffi.Pointer Function( - ffi.Pointer, int, ffi.Pointer)>(); + ffi.Pointer Function( + Mat, Mat, Mat, CvCallback_1)>>('core_InRange_Async'); + late final _core_InRange_Async = _core_InRange_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, CvCallback_1)>(); - ffi.Pointer VecChar_NewFromVec( - VecChar vec, - ffi.Pointer rval, + ffi.Pointer core_InsertChannel_Async( + Mat src, + Mat dst, + int coi, + CvCallback_0 callback, ) { - return _VecChar_NewFromVec( - vec, - rval, + return _core_InsertChannel_Async( + src, + dst, + coi, + callback, ); } - late final _VecChar_NewFromVecPtr = _lookup< + late final _core_InsertChannel_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecChar, ffi.Pointer)>>('VecChar_NewFromVec'); - late final _VecChar_NewFromVec = _VecChar_NewFromVecPtr.asFunction< - ffi.Pointer Function(VecChar, ffi.Pointer)>(); + Mat, Mat, ffi.Int, CvCallback_0)>>('core_InsertChannel_Async'); + late final _core_InsertChannel_Async = + _core_InsertChannel_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, int, CvCallback_0)>(); - ffi.Pointer VecChar_Size( - VecChar vec, - ffi.Pointer rval, + ffi.Pointer core_Invert_Async( + Mat src, + int flags, + CvCallback_2 callback, ) { - return _VecChar_Size( - vec, - rval, + return _core_Invert_Async( + src, + flags, + callback, ); } - late final _VecChar_SizePtr = _lookup< + late final _core_Invert_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecChar, ffi.Pointer)>>('VecChar_Size'); - late final _VecChar_Size = _VecChar_SizePtr.asFunction< - ffi.Pointer Function(VecChar, ffi.Pointer)>(); + Mat, ffi.Int, CvCallback_2)>>('core_Invert_Async'); + late final _core_Invert_Async = _core_Invert_AsyncPtr + .asFunction Function(Mat, int, CvCallback_2)>(); - ffi.Pointer VecChar_ToString( - VecChar vec, - ffi.Pointer> rval, - ffi.Pointer length, + ffi.Pointer core_KMeans_Async( + Mat data, + int k, + Mat bestLabels, + TermCriteria criteria, + int attempts, + int flags, + CvCallback_2 callback, ) { - return _VecChar_ToString( - vec, - rval, - length, + return _core_KMeans_Async( + data, + k, + bestLabels, + criteria, + attempts, + flags, + callback, ); } - late final _VecChar_ToStringPtr = _lookup< + late final _core_KMeans_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - VecChar, - ffi.Pointer>, - ffi.Pointer)>>('VecChar_ToString'); - late final _VecChar_ToString = _VecChar_ToStringPtr.asFunction< + ffi.Pointer Function(Mat, ffi.Int, Mat, TermCriteria, + ffi.Int, ffi.Int, CvCallback_2)>>('core_KMeans_Async'); + late final _core_KMeans_Async = _core_KMeans_AsyncPtr.asFunction< ffi.Pointer Function( - VecChar, ffi.Pointer>, ffi.Pointer)>(); + Mat, int, Mat, TermCriteria, int, int, CvCallback_2)>(); - ffi.Pointer VecDMatch_Append( - VecDMatch vec, - DMatch dm, + ffi.Pointer core_KMeans_Points_Async( + VecPoint2f pts, + int k, + Mat bestLabels, + TermCriteria criteria, + int attempts, + int flags, + CvCallback_2 callback, ) { - return _VecDMatch_Append( - vec, - dm, + return _core_KMeans_Points_Async( + pts, + k, + bestLabels, + criteria, + attempts, + flags, + callback, ); } - late final _VecDMatch_AppendPtr = _lookup< - ffi - .NativeFunction Function(VecDMatch, DMatch)>>( - 'VecDMatch_Append'); - late final _VecDMatch_Append = _VecDMatch_AppendPtr.asFunction< - ffi.Pointer Function(VecDMatch, DMatch)>(); + late final _core_KMeans_Points_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecPoint2f, ffi.Int, Mat, TermCriteria, + ffi.Int, ffi.Int, CvCallback_2)>>('core_KMeans_Points_Async'); + late final _core_KMeans_Points_Async = + _core_KMeans_Points_AsyncPtr.asFunction< + ffi.Pointer Function( + VecPoint2f, int, Mat, TermCriteria, int, int, CvCallback_2)>(); - ffi.Pointer VecDMatch_At( - VecDMatch vec, - int idx, - ffi.Pointer rval, + ffi.Pointer core_LUT_Async( + Mat src, + Mat lut, + CvCallback_1 callback, ) { - return _VecDMatch_At( - vec, - idx, - rval, + return _core_LUT_Async( + src, + lut, + callback, ); } - late final _VecDMatch_AtPtr = _lookup< + late final _core_LUT_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecDMatch, ffi.Int, ffi.Pointer)>>('VecDMatch_At'); - late final _VecDMatch_At = _VecDMatch_AtPtr.asFunction< - ffi.Pointer Function(VecDMatch, int, ffi.Pointer)>(); + Mat, Mat, CvCallback_1)>>('core_LUT_Async'); + late final _core_LUT_Async = _core_LUT_AsyncPtr + .asFunction Function(Mat, Mat, CvCallback_1)>(); - void VecDMatch_Close( - VecDMatchPtr vec, + ffi.Pointer core_Log_Async( + Mat src, + CvCallback_1 callback, ) { - return _VecDMatch_Close( - vec, + return _core_Log_Async( + src, + callback, ); } - late final _VecDMatch_ClosePtr = - _lookup>( - 'VecDMatch_Close'); - late final _VecDMatch_Close = - _VecDMatch_ClosePtr.asFunction(); + late final _core_Log_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, CvCallback_1)>>('core_Log_Async'); + late final _core_Log_Async = _core_Log_AsyncPtr + .asFunction Function(Mat, CvCallback_1)>(); - ffi.Pointer VecDMatch_New( - ffi.Pointer rval, + ffi.Pointer core_Magnitude_Async( + Mat x, + Mat y, + CvCallback_1 callback, ) { - return _VecDMatch_New( - rval, + return _core_Magnitude_Async( + x, + y, + callback, ); } - late final _VecDMatch_NewPtr = _lookup< + late final _core_Magnitude_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer)>>('VecDMatch_New'); - late final _VecDMatch_New = _VecDMatch_NewPtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + Mat, Mat, CvCallback_1)>>('core_Magnitude_Async'); + late final _core_Magnitude_Async = _core_Magnitude_AsyncPtr + .asFunction Function(Mat, Mat, CvCallback_1)>(); - ffi.Pointer VecDMatch_NewFromPointer( - ffi.Pointer matches, - int length, - ffi.Pointer rval, + ffi.Pointer core_Max_Async( + Mat src1, + Mat src2, + CvCallback_1 callback, ) { - return _VecDMatch_NewFromPointer( - matches, - length, - rval, + return _core_Max_Async( + src1, + src2, + callback, ); } - late final _VecDMatch_NewFromPointerPtr = _lookup< + late final _core_Max_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, ffi.Int, - ffi.Pointer)>>('VecDMatch_NewFromPointer'); - late final _VecDMatch_NewFromPointer = - _VecDMatch_NewFromPointerPtr.asFunction< ffi.Pointer Function( - ffi.Pointer, int, ffi.Pointer)>(); + Mat, Mat, CvCallback_1)>>('core_Max_Async'); + late final _core_Max_Async = _core_Max_AsyncPtr + .asFunction Function(Mat, Mat, CvCallback_1)>(); - ffi.Pointer VecDMatch_NewFromVec( - VecDMatch vec, - ffi.Pointer rval, + ffi.Pointer core_MeanStdDevWithMask_Async( + Mat src, + Mat mask, + CvCallback_2 callback, ) { - return _VecDMatch_NewFromVec( - vec, - rval, + return _core_MeanStdDevWithMask_Async( + src, + mask, + callback, ); } - late final _VecDMatch_NewFromVecPtr = _lookup< + late final _core_MeanStdDevWithMask_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecDMatch, ffi.Pointer)>>('VecDMatch_NewFromVec'); - late final _VecDMatch_NewFromVec = _VecDMatch_NewFromVecPtr.asFunction< - ffi.Pointer Function(VecDMatch, ffi.Pointer)>(); + Mat, Mat, CvCallback_2)>>('core_MeanStdDevWithMask_Async'); + late final _core_MeanStdDevWithMask_Async = _core_MeanStdDevWithMask_AsyncPtr + .asFunction Function(Mat, Mat, CvCallback_2)>(); - ffi.Pointer VecDMatch_Size( - VecDMatch vec, - ffi.Pointer rval, + ffi.Pointer core_MeanStdDev_Async( + Mat src, + CvCallback_2 callback, ) { - return _VecDMatch_Size( - vec, - rval, + return _core_MeanStdDev_Async( + src, + callback, ); } - late final _VecDMatch_SizePtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - VecDMatch, ffi.Pointer)>>('VecDMatch_Size'); - late final _VecDMatch_Size = _VecDMatch_SizePtr.asFunction< - ffi.Pointer Function(VecDMatch, ffi.Pointer)>(); + late final _core_MeanStdDev_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Mat, CvCallback_2)>>( + 'core_MeanStdDev_Async'); + late final _core_MeanStdDev_Async = _core_MeanStdDev_AsyncPtr + .asFunction Function(Mat, CvCallback_2)>(); - ffi.Pointer VecDouble_Append( - VecDouble vec, - double d, + ffi.Pointer core_MeanWithMask_Async( + Mat self, + Mat mask, + CvCallback_1 callback, ) { - return _VecDouble_Append( - vec, - d, + return _core_MeanWithMask_Async( + self, + mask, + callback, ); } - late final _VecDouble_AppendPtr = _lookup< + late final _core_MeanWithMask_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecDouble, ffi.Double)>>('VecDouble_Append'); - late final _VecDouble_Append = _VecDouble_AppendPtr.asFunction< - ffi.Pointer Function(VecDouble, double)>(); + Mat, Mat, CvCallback_1)>>('core_MeanWithMask_Async'); + late final _core_MeanWithMask_Async = _core_MeanWithMask_AsyncPtr + .asFunction Function(Mat, Mat, CvCallback_1)>(); - ffi.Pointer VecDouble_At( - VecDouble vec, - int idx, - ffi.Pointer rval, + ffi.Pointer core_Mean_Async( + Mat self, + CvCallback_1 callback, ) { - return _VecDouble_At( - vec, - idx, - rval, + return _core_Mean_Async( + self, + callback, ); } - late final _VecDouble_AtPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - VecDouble, ffi.Int, ffi.Pointer)>>('VecDouble_At'); - late final _VecDouble_At = _VecDouble_AtPtr.asFunction< - ffi.Pointer Function( - VecDouble, int, ffi.Pointer)>(); + late final _core_Mean_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Mat, CvCallback_1)>>( + 'core_Mean_Async'); + late final _core_Mean_Async = _core_Mean_AsyncPtr + .asFunction Function(Mat, CvCallback_1)>(); - void VecDouble_Close( - VecDoublePtr vec, + ffi.Pointer core_Merge_Async( + VecMat mats, + CvCallback_1 callback, ) { - return _VecDouble_Close( - vec, + return _core_Merge_Async( + mats, + callback, ); } - late final _VecDouble_ClosePtr = - _lookup>( - 'VecDouble_Close'); - late final _VecDouble_Close = - _VecDouble_ClosePtr.asFunction(); + late final _core_Merge_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecMat, CvCallback_1)>>('core_Merge_Async'); + late final _core_Merge_Async = _core_Merge_AsyncPtr + .asFunction Function(VecMat, CvCallback_1)>(); - ffi.Pointer VecDouble_Data( - VecDouble vec, - ffi.Pointer> rval, + ffi.Pointer core_MinMaxIdx_Async( + Mat self, + CvCallback_4 callback, ) { - return _VecDouble_Data( - vec, - rval, + return _core_MinMaxIdx_Async( + self, + callback, ); } - late final _VecDouble_DataPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(VecDouble, - ffi.Pointer>)>>('VecDouble_Data'); - late final _VecDouble_Data = _VecDouble_DataPtr.asFunction< - ffi.Pointer Function( - VecDouble, ffi.Pointer>)>(); + late final _core_MinMaxIdx_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Mat, CvCallback_4)>>( + 'core_MinMaxIdx_Async'); + late final _core_MinMaxIdx_Async = _core_MinMaxIdx_AsyncPtr + .asFunction Function(Mat, CvCallback_4)>(); - ffi.Pointer VecDouble_New( - ffi.Pointer rval, + ffi.Pointer core_MinMaxIdx_Mask_Async( + Mat self, + Mat mask, + CvCallback_4 callback, ) { - return _VecDouble_New( - rval, + return _core_MinMaxIdx_Mask_Async( + self, + mask, + callback, ); } - late final _VecDouble_NewPtr = _lookup< + late final _core_MinMaxIdx_Mask_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer)>>('VecDouble_New'); - late final _VecDouble_New = _VecDouble_NewPtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + Mat, Mat, CvCallback_4)>>('core_MinMaxIdx_Mask_Async'); + late final _core_MinMaxIdx_Mask_Async = _core_MinMaxIdx_Mask_AsyncPtr + .asFunction Function(Mat, Mat, CvCallback_4)>(); - ffi.Pointer VecDouble_NewFromPointer( - ffi.Pointer p, - int length, - ffi.Pointer rval, + ffi.Pointer core_MinMaxLoc_Async( + Mat self, + CvCallback_4 callback, ) { - return _VecDouble_NewFromPointer( - p, - length, - rval, + return _core_MinMaxLoc_Async( + self, + callback, ); } - late final _VecDouble_NewFromPointerPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, ffi.Int, - ffi.Pointer)>>('VecDouble_NewFromPointer'); - late final _VecDouble_NewFromPointer = - _VecDouble_NewFromPointerPtr.asFunction< - ffi.Pointer Function( - ffi.Pointer, int, ffi.Pointer)>(); + late final _core_MinMaxLoc_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Mat, CvCallback_4)>>( + 'core_MinMaxLoc_Async'); + late final _core_MinMaxLoc_Async = _core_MinMaxLoc_AsyncPtr + .asFunction Function(Mat, CvCallback_4)>(); - ffi.Pointer VecDouble_NewFromVec( - VecDouble vec, - ffi.Pointer rval, - ) { - return _VecDouble_NewFromVec( - vec, - rval, + ffi.Pointer core_MinMaxLoc_Mask_Async( + Mat self, + Mat mask, + CvCallback_4 callback, + ) { + return _core_MinMaxLoc_Mask_Async( + self, + mask, + callback, ); } - late final _VecDouble_NewFromVecPtr = _lookup< + late final _core_MinMaxLoc_Mask_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecDouble, ffi.Pointer)>>('VecDouble_NewFromVec'); - late final _VecDouble_NewFromVec = _VecDouble_NewFromVecPtr.asFunction< - ffi.Pointer Function(VecDouble, ffi.Pointer)>(); + Mat, Mat, CvCallback_4)>>('core_MinMaxLoc_Mask_Async'); + late final _core_MinMaxLoc_Mask_Async = _core_MinMaxLoc_Mask_AsyncPtr + .asFunction Function(Mat, Mat, CvCallback_4)>(); - ffi.Pointer VecDouble_Size( - VecDouble vec, - ffi.Pointer rval, + ffi.Pointer core_Min_Async( + Mat src1, + Mat src2, + CvCallback_1 callback, ) { - return _VecDouble_Size( - vec, - rval, + return _core_Min_Async( + src1, + src2, + callback, ); } - late final _VecDouble_SizePtr = _lookup< + late final _core_Min_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecDouble, ffi.Pointer)>>('VecDouble_Size'); - late final _VecDouble_Size = _VecDouble_SizePtr.asFunction< - ffi.Pointer Function(VecDouble, ffi.Pointer)>(); + Mat, Mat, CvCallback_1)>>('core_Min_Async'); + late final _core_Min_Async = _core_Min_AsyncPtr + .asFunction Function(Mat, Mat, CvCallback_1)>(); - ffi.Pointer VecFloat_Append( - VecFloat vec, - double f, + ffi.Pointer core_MixChannels_Async( + VecMat src, + VecMat dst, + VecInt fromTo, + CvCallback_0 callback, ) { - return _VecFloat_Append( - vec, - f, + return _core_MixChannels_Async( + src, + dst, + fromTo, + callback, ); } - late final _VecFloat_AppendPtr = _lookup< - ffi - .NativeFunction Function(VecFloat, ffi.Float)>>( - 'VecFloat_Append'); - late final _VecFloat_Append = _VecFloat_AppendPtr.asFunction< - ffi.Pointer Function(VecFloat, double)>(); + late final _core_MixChannels_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + VecMat, VecMat, VecInt, CvCallback_0)>>('core_MixChannels_Async'); + late final _core_MixChannels_Async = _core_MixChannels_AsyncPtr.asFunction< + ffi.Pointer Function(VecMat, VecMat, VecInt, CvCallback_0)>(); - ffi.Pointer VecFloat_At( - VecFloat vec, - int idx, - ffi.Pointer rval, + ffi.Pointer core_MulSpectrums_Async( + Mat a, + Mat b, + int flags, + bool conjB, + CvCallback_1 callback, ) { - return _VecFloat_At( - vec, - idx, - rval, + return _core_MulSpectrums_Async( + a, + b, + flags, + conjB, + callback, ); } - late final _VecFloat_AtPtr = _lookup< + late final _core_MulSpectrums_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - VecFloat, ffi.Int, ffi.Pointer)>>('VecFloat_At'); - late final _VecFloat_At = _VecFloat_AtPtr.asFunction< - ffi.Pointer Function(VecFloat, int, ffi.Pointer)>(); + ffi.Pointer Function(Mat, Mat, ffi.Int, ffi.Bool, + CvCallback_1)>>('core_MulSpectrums_Async'); + late final _core_MulSpectrums_Async = _core_MulSpectrums_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, int, bool, CvCallback_1)>(); - void VecFloat_Close( - VecFloatPtr vec, + ffi.Pointer core_MultiplyWithParams_Async( + Mat src1, + Mat src2, + double scale, + int dtype, + CvCallback_1 callback, ) { - return _VecFloat_Close( - vec, + return _core_MultiplyWithParams_Async( + src1, + src2, + scale, + dtype, + callback, ); } - late final _VecFloat_ClosePtr = - _lookup>( - 'VecFloat_Close'); - late final _VecFloat_Close = - _VecFloat_ClosePtr.asFunction(); + late final _core_MultiplyWithParams_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, ffi.Double, ffi.Int, + CvCallback_1)>>('core_MultiplyWithParams_Async'); + late final _core_MultiplyWithParams_Async = + _core_MultiplyWithParams_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, double, int, CvCallback_1)>(); - ffi.Pointer VecFloat_Data( - VecFloat vec, - ffi.Pointer> rval, + ffi.Pointer core_Multiply_Async( + Mat src1, + Mat src2, + CvCallback_1 callback, ) { - return _VecFloat_Data( - vec, - rval, + return _core_Multiply_Async( + src1, + src2, + callback, ); } - late final _VecFloat_DataPtr = _lookup< + late final _core_Multiply_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecFloat, ffi.Pointer>)>>('VecFloat_Data'); - late final _VecFloat_Data = _VecFloat_DataPtr.asFunction< - ffi.Pointer Function( - VecFloat, ffi.Pointer>)>(); + Mat, Mat, CvCallback_1)>>('core_Multiply_Async'); + late final _core_Multiply_Async = _core_Multiply_AsyncPtr + .asFunction Function(Mat, Mat, CvCallback_1)>(); - ffi.Pointer VecFloat_New( - ffi.Pointer rval, + ffi.Pointer core_NormWithMats_Async( + Mat src1, + Mat src2, + int normType, + CvCallback_1 callback, ) { - return _VecFloat_New( - rval, + return _core_NormWithMats_Async( + src1, + src2, + normType, + callback, ); } - late final _VecFloat_NewPtr = _lookup< + late final _core_NormWithMats_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer)>>('VecFloat_New'); - late final _VecFloat_New = _VecFloat_NewPtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + Mat, Mat, ffi.Int, CvCallback_1)>>('core_NormWithMats_Async'); + late final _core_NormWithMats_Async = _core_NormWithMats_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, int, CvCallback_1)>(); - ffi.Pointer VecFloat_NewFromPointer( - ffi.Pointer p, - int length, - ffi.Pointer rval, + ffi.Pointer core_Norm_Async( + Mat src1, + int normType, + CvCallback_1 callback, ) { - return _VecFloat_NewFromPointer( - p, - length, - rval, + return _core_Norm_Async( + src1, + normType, + callback, ); } - late final _VecFloat_NewFromPointerPtr = _lookup< + late final _core_Norm_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, ffi.Int, - ffi.Pointer)>>('VecFloat_NewFromPointer'); - late final _VecFloat_NewFromPointer = _VecFloat_NewFromPointerPtr.asFunction< - ffi.Pointer Function( - ffi.Pointer, int, ffi.Pointer)>(); + ffi.Pointer Function( + Mat, ffi.Int, CvCallback_1)>>('core_Norm_Async'); + late final _core_Norm_Async = _core_Norm_AsyncPtr + .asFunction Function(Mat, int, CvCallback_1)>(); - ffi.Pointer VecFloat_NewFromVec( - VecFloat vec, - ffi.Pointer rval, + ffi.Pointer core_Norm_Mask_Async( + Mat src1, + int normType, + Mat mask, + CvCallback_1 callback, ) { - return _VecFloat_NewFromVec( - vec, - rval, + return _core_Norm_Mask_Async( + src1, + normType, + mask, + callback, ); } - late final _VecFloat_NewFromVecPtr = _lookup< + late final _core_Norm_Mask_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecFloat, ffi.Pointer)>>('VecFloat_NewFromVec'); - late final _VecFloat_NewFromVec = _VecFloat_NewFromVecPtr.asFunction< - ffi.Pointer Function(VecFloat, ffi.Pointer)>(); + Mat, ffi.Int, Mat, CvCallback_1)>>('core_Norm_Mask_Async'); + late final _core_Norm_Mask_Async = _core_Norm_Mask_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, Mat, CvCallback_1)>(); - ffi.Pointer VecFloat_Size( - VecFloat vec, - ffi.Pointer rval, + ffi.Pointer core_Normalize_Async( + Mat src, + Mat dst, + double alpha, + double beta, + int typ, + int dtype, + CvCallback_0 callback, ) { - return _VecFloat_Size( - vec, - rval, + return _core_Normalize_Async( + src, + dst, + alpha, + beta, + typ, + dtype, + callback, ); } - late final _VecFloat_SizePtr = _lookup< + late final _core_Normalize_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - VecFloat, ffi.Pointer)>>('VecFloat_Size'); - late final _VecFloat_Size = _VecFloat_SizePtr.asFunction< - ffi.Pointer Function(VecFloat, ffi.Pointer)>(); + ffi.Pointer Function(Mat, Mat, ffi.Double, ffi.Double, + ffi.Int, ffi.Int, CvCallback_0)>>('core_Normalize_Async'); + late final _core_Normalize_Async = _core_Normalize_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, double, double, int, int, CvCallback_0)>(); - ffi.Pointer VecInt_Append( - VecInt vec, - int i, + ffi.Pointer core_Normalize_Mask_Async( + Mat src, + Mat dst, + double alpha, + double beta, + int typ, + int dtype, + Mat mask, + CvCallback_0 callback, ) { - return _VecInt_Append( - vec, - i, + return _core_Normalize_Mask_Async( + src, + dst, + alpha, + beta, + typ, + dtype, + mask, + callback, ); } - late final _VecInt_AppendPtr = _lookup< - ffi.NativeFunction Function(VecInt, ffi.Int)>>( - 'VecInt_Append'); - late final _VecInt_Append = _VecInt_AppendPtr.asFunction< - ffi.Pointer Function(VecInt, int)>(); + late final _core_Normalize_Mask_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, + Mat, + ffi.Double, + ffi.Double, + ffi.Int, + ffi.Int, + Mat, + CvCallback_0)>>('core_Normalize_Mask_Async'); + late final _core_Normalize_Mask_Async = + _core_Normalize_Mask_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, double, double, int, int, Mat, CvCallback_0)>(); - ffi.Pointer VecInt_At( - VecInt vec, - int idx, - ffi.Pointer rval, + ffi.Pointer core_PCABackProject_Async( + Mat src, + Mat mean, + Mat eigenvectors, + CvCallback_1 callback, ) { - return _VecInt_At( - vec, - idx, - rval, + return _core_PCABackProject_Async( + src, + mean, + eigenvectors, + callback, ); } - late final _VecInt_AtPtr = _lookup< + late final _core_PCABackProject_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecInt, ffi.Int, ffi.Pointer)>>('VecInt_At'); - late final _VecInt_At = _VecInt_AtPtr.asFunction< - ffi.Pointer Function(VecInt, int, ffi.Pointer)>(); + Mat, Mat, Mat, CvCallback_1)>>('core_PCABackProject_Async'); + late final _core_PCABackProject_Async = + _core_PCABackProject_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, CvCallback_1)>(); - ffi.Pointer VecInt_AtNoBoundCheck( - VecInt vec, - int idx, - ffi.Pointer rval, + ffi.Pointer core_PCACompute_1_Async( + Mat src, + Mat mean, + int maxComponents, + CvCallback_1 callback, ) { - return _VecInt_AtNoBoundCheck( - vec, - idx, - rval, + return _core_PCACompute_1_Async( + src, + mean, + maxComponents, + callback, ); } - late final _VecInt_AtNoBoundCheckPtr = _lookup< + late final _core_PCACompute_1_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecInt, ffi.Int, ffi.Pointer)>>('VecInt_AtNoBoundCheck'); - late final _VecInt_AtNoBoundCheck = _VecInt_AtNoBoundCheckPtr.asFunction< - ffi.Pointer Function(VecInt, int, ffi.Pointer)>(); + Mat, Mat, ffi.Int, CvCallback_1)>>('core_PCACompute_1_Async'); + late final _core_PCACompute_1_Async = _core_PCACompute_1_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, int, CvCallback_1)>(); - void VecInt_Close( - VecIntPtr vec, + ffi.Pointer core_PCACompute_2_Async( + Mat src, + Mat mean, + double retainedVariance, + CvCallback_2 callback, ) { - return _VecInt_Close( - vec, + return _core_PCACompute_2_Async( + src, + mean, + retainedVariance, + callback, ); } - late final _VecInt_ClosePtr = - _lookup>('VecInt_Close'); - late final _VecInt_Close = - _VecInt_ClosePtr.asFunction(); + late final _core_PCACompute_2_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, ffi.Double, CvCallback_2)>>('core_PCACompute_2_Async'); + late final _core_PCACompute_2_Async = _core_PCACompute_2_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, double, CvCallback_2)>(); - ffi.Pointer VecInt_Data( - VecInt vec, - ffi.Pointer> rval, + ffi.Pointer core_PCACompute_3_Async( + Mat src, + Mat mean, + double retainedVariance, + CvCallback_1 callback, ) { - return _VecInt_Data( - vec, - rval, + return _core_PCACompute_3_Async( + src, + mean, + retainedVariance, + callback, ); } - late final _VecInt_DataPtr = _lookup< + late final _core_PCACompute_3_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecInt, ffi.Pointer>)>>('VecInt_Data'); - late final _VecInt_Data = _VecInt_DataPtr.asFunction< - ffi.Pointer Function( - VecInt, ffi.Pointer>)>(); + Mat, Mat, ffi.Double, CvCallback_1)>>('core_PCACompute_3_Async'); + late final _core_PCACompute_3_Async = _core_PCACompute_3_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, double, CvCallback_1)>(); - ffi.Pointer VecInt_New( - ffi.Pointer rval, + ffi.Pointer core_PCACompute_Async( + Mat src, + Mat mean, + int maxComponents, + CvCallback_2 callback, ) { - return _VecInt_New( - rval, + return _core_PCACompute_Async( + src, + mean, + maxComponents, + callback, ); } - late final _VecInt_NewPtr = _lookup< + late final _core_PCACompute_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer)>>('VecInt_New'); - late final _VecInt_New = _VecInt_NewPtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + ffi.Pointer Function( + Mat, Mat, ffi.Int, CvCallback_2)>>('core_PCACompute_Async'); + late final _core_PCACompute_Async = _core_PCACompute_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, int, CvCallback_2)>(); - /// Copy from a pointer - ffi.Pointer VecInt_NewFromPointer( - ffi.Pointer p, - int length, - ffi.Pointer rval, + ffi.Pointer core_PCAProject_Async( + Mat src, + Mat mean, + Mat eigenvectors, + CvCallback_1 callback, ) { - return _VecInt_NewFromPointer( - p, - length, - rval, + return _core_PCAProject_Async( + src, + mean, + eigenvectors, + callback, ); } - late final _VecInt_NewFromPointerPtr = _lookup< + late final _core_PCAProject_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, ffi.Int, - ffi.Pointer)>>('VecInt_NewFromPointer'); - late final _VecInt_NewFromPointer = _VecInt_NewFromPointerPtr.asFunction< - ffi.Pointer Function( - ffi.Pointer, int, ffi.Pointer)>(); + ffi.Pointer Function( + Mat, Mat, Mat, CvCallback_1)>>('core_PCAProject_Async'); + late final _core_PCAProject_Async = _core_PCAProject_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, CvCallback_1)>(); - ffi.Pointer VecInt_NewFromVec( - VecInt vec, - ffi.Pointer rval, + ffi.Pointer core_PatchNaNs_Async( + Mat self, + double val, + CvCallback_0 callback, ) { - return _VecInt_NewFromVec( - vec, - rval, + return _core_PatchNaNs_Async( + self, + val, + callback, ); } - late final _VecInt_NewFromVecPtr = _lookup< + late final _core_PatchNaNs_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecInt, ffi.Pointer)>>('VecInt_NewFromVec'); - late final _VecInt_NewFromVec = _VecInt_NewFromVecPtr.asFunction< - ffi.Pointer Function(VecInt, ffi.Pointer)>(); + Mat, ffi.Double, CvCallback_0)>>('core_PatchNaNs_Async'); + late final _core_PatchNaNs_Async = _core_PatchNaNs_AsyncPtr + .asFunction Function(Mat, double, CvCallback_0)>(); - ffi.Pointer VecInt_Size( - VecInt vec, - ffi.Pointer rval, + ffi.Pointer core_PerspectiveTransform_Async( + Mat src, + Mat tm, + CvCallback_1 callback, ) { - return _VecInt_Size( - vec, - rval, + return _core_PerspectiveTransform_Async( + src, + tm, + callback, ); } - late final _VecInt_SizePtr = _lookup< + late final _core_PerspectiveTransform_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecInt, ffi.Pointer)>>('VecInt_Size'); - late final _VecInt_Size = _VecInt_SizePtr.asFunction< - ffi.Pointer Function(VecInt, ffi.Pointer)>(); + Mat, Mat, CvCallback_1)>>('core_PerspectiveTransform_Async'); + late final _core_PerspectiveTransform_Async = + _core_PerspectiveTransform_AsyncPtr + .asFunction Function(Mat, Mat, CvCallback_1)>(); - ffi.Pointer VecKeyPoint_Append( - VecKeyPoint vec, - KeyPoint kp, + ffi.Pointer core_Phase_Async( + Mat x, + Mat y, + bool angleInDegrees, + CvCallback_1 callback, ) { - return _VecKeyPoint_Append( - vec, - kp, + return _core_Phase_Async( + x, + y, + angleInDegrees, + callback, ); } - late final _VecKeyPoint_AppendPtr = _lookup< + late final _core_Phase_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecKeyPoint, KeyPoint)>>('VecKeyPoint_Append'); - late final _VecKeyPoint_Append = _VecKeyPoint_AppendPtr.asFunction< - ffi.Pointer Function(VecKeyPoint, KeyPoint)>(); + Mat, Mat, ffi.Bool, CvCallback_1)>>('core_Phase_Async'); + late final _core_Phase_Async = _core_Phase_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, bool, CvCallback_1)>(); - ffi.Pointer VecKeyPoint_At( - VecKeyPoint vec, - int idx, - ffi.Pointer rval, + ffi.Pointer core_PolarToCart_Async( + Mat magnitude, + Mat degree, + bool angleInDegrees, + CvCallback_2 callback, ) { - return _VecKeyPoint_At( - vec, - idx, - rval, + return _core_PolarToCart_Async( + magnitude, + degree, + angleInDegrees, + callback, ); } - late final _VecKeyPoint_AtPtr = _lookup< + late final _core_PolarToCart_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecKeyPoint, ffi.Int, ffi.Pointer)>>('VecKeyPoint_At'); - late final _VecKeyPoint_At = _VecKeyPoint_AtPtr.asFunction< - ffi.Pointer Function( - VecKeyPoint, int, ffi.Pointer)>(); + Mat, Mat, ffi.Bool, CvCallback_2)>>('core_PolarToCart_Async'); + late final _core_PolarToCart_Async = _core_PolarToCart_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, bool, CvCallback_2)>(); - void VecKeyPoint_Close( - VecKeyPointPtr vec, + ffi.Pointer core_Pow_Async( + Mat src, + double power, + CvCallback_1 callback, ) { - return _VecKeyPoint_Close( - vec, + return _core_Pow_Async( + src, + power, + callback, ); } - late final _VecKeyPoint_ClosePtr = - _lookup>( - 'VecKeyPoint_Close'); - late final _VecKeyPoint_Close = - _VecKeyPoint_ClosePtr.asFunction(); + late final _core_Pow_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, ffi.Double, CvCallback_1)>>('core_Pow_Async'); + late final _core_Pow_Async = _core_Pow_AsyncPtr + .asFunction Function(Mat, double, CvCallback_1)>(); - ffi.Pointer VecKeyPoint_New( - ffi.Pointer rval, + ffi.Pointer core_ReduceArgMax_Async( + Mat src, + int axis, + bool lastIndex, + CvCallback_1 callback, ) { - return _VecKeyPoint_New( - rval, + return _core_ReduceArgMax_Async( + src, + axis, + lastIndex, + callback, ); } - late final _VecKeyPoint_NewPtr = _lookup< + late final _core_ReduceArgMax_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>>('VecKeyPoint_New'); - late final _VecKeyPoint_New = _VecKeyPoint_NewPtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + ffi.Pointer Function(Mat, ffi.Int, ffi.Bool, + CvCallback_1)>>('core_ReduceArgMax_Async'); + late final _core_ReduceArgMax_Async = _core_ReduceArgMax_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, bool, CvCallback_1)>(); - ffi.Pointer VecKeyPoint_NewFromPointer( - ffi.Pointer keypoints, - int length, - ffi.Pointer rval, + ffi.Pointer core_ReduceArgMin_Async( + Mat src, + int axis, + bool lastIndex, + CvCallback_1 callback, ) { - return _VecKeyPoint_NewFromPointer( - keypoints, - length, - rval, + return _core_ReduceArgMin_Async( + src, + axis, + lastIndex, + callback, ); } - late final _VecKeyPoint_NewFromPointerPtr = _lookup< + late final _core_ReduceArgMin_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, ffi.Int, - ffi.Pointer)>>('VecKeyPoint_NewFromPointer'); - late final _VecKeyPoint_NewFromPointer = - _VecKeyPoint_NewFromPointerPtr.asFunction< - ffi.Pointer Function( - ffi.Pointer, int, ffi.Pointer)>(); + ffi.Pointer Function(Mat, ffi.Int, ffi.Bool, + CvCallback_1)>>('core_ReduceArgMin_Async'); + late final _core_ReduceArgMin_Async = _core_ReduceArgMin_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, bool, CvCallback_1)>(); - ffi.Pointer VecKeyPoint_NewFromVec( - VecKeyPoint vec, - ffi.Pointer rval, + ffi.Pointer core_Reduce_Async( + Mat src, + int dim, + int rType, + int dType, + CvCallback_1 callback, ) { - return _VecKeyPoint_NewFromVec( - vec, - rval, + return _core_Reduce_Async( + src, + dim, + rType, + dType, + callback, ); } - late final _VecKeyPoint_NewFromVecPtr = _lookup< + late final _core_Reduce_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(VecKeyPoint, - ffi.Pointer)>>('VecKeyPoint_NewFromVec'); - late final _VecKeyPoint_NewFromVec = _VecKeyPoint_NewFromVecPtr.asFunction< - ffi.Pointer Function(VecKeyPoint, ffi.Pointer)>(); + ffi.Pointer Function(Mat, ffi.Int, ffi.Int, ffi.Int, + CvCallback_1)>>('core_Reduce_Async'); + late final _core_Reduce_Async = _core_Reduce_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, int, int, CvCallback_1)>(); - ffi.Pointer VecKeyPoint_Size( - VecKeyPoint vec, - ffi.Pointer rval, + ffi.Pointer core_Repeat_Async( + Mat src, + int nY, + int nX, + CvCallback_1 callback, ) { - return _VecKeyPoint_Size( - vec, - rval, + return _core_Repeat_Async( + src, + nY, + nX, + callback, ); } - late final _VecKeyPoint_SizePtr = _lookup< + late final _core_Repeat_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecKeyPoint, ffi.Pointer)>>('VecKeyPoint_Size'); - late final _VecKeyPoint_Size = _VecKeyPoint_SizePtr.asFunction< - ffi.Pointer Function(VecKeyPoint, ffi.Pointer)>(); + Mat, ffi.Int, ffi.Int, CvCallback_1)>>('core_Repeat_Async'); + late final _core_Repeat_Async = _core_Repeat_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, int, CvCallback_1)>(); - ffi.Pointer VecMat_Append( - VecMat vec, - Mat mat, + ffi.Pointer core_Rotate_Async( + Mat src, + int rotateCode, + CvCallback_1 callback, ) { - return _VecMat_Append( - vec, - mat, + return _core_Rotate_Async( + src, + rotateCode, + callback, ); } - late final _VecMat_AppendPtr = - _lookup Function(VecMat, Mat)>>( - 'VecMat_Append'); - late final _VecMat_Append = _VecMat_AppendPtr.asFunction< - ffi.Pointer Function(VecMat, Mat)>(); + late final _core_Rotate_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, ffi.Int, CvCallback_1)>>('core_Rotate_Async'); + late final _core_Rotate_Async = _core_Rotate_AsyncPtr + .asFunction Function(Mat, int, CvCallback_1)>(); - ffi.Pointer VecMat_At( - VecMat vec, - int i, - ffi.Pointer rval, - ) { - return _VecMat_At( - vec, - i, - rval, + ffi.Pointer core_ScaleAdd_Async( + Mat src1, + double alpha, + Mat src2, + CvCallback_1 callback, + ) { + return _core_ScaleAdd_Async( + src1, + alpha, + src2, + callback, ); } - late final _VecMat_AtPtr = _lookup< + late final _core_ScaleAdd_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecMat, ffi.Int, ffi.Pointer)>>('VecMat_At'); - late final _VecMat_At = _VecMat_AtPtr.asFunction< - ffi.Pointer Function(VecMat, int, ffi.Pointer)>(); + Mat, ffi.Double, Mat, CvCallback_1)>>('core_ScaleAdd_Async'); + late final _core_ScaleAdd_Async = _core_ScaleAdd_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, double, Mat, CvCallback_1)>(); - void VecMat_Close( - VecMatPtr vec, + ffi.Pointer core_SetIdentity_Async( + Mat src, + Scalar scalar, + CvCallback_0 callback, ) { - return _VecMat_Close( - vec, + return _core_SetIdentity_Async( + src, + scalar, + callback, ); } - late final _VecMat_ClosePtr = - _lookup>('VecMat_Close'); - late final _VecMat_Close = - _VecMat_ClosePtr.asFunction(); + late final _core_SetIdentity_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Scalar, CvCallback_0)>>('core_SetIdentity_Async'); + late final _core_SetIdentity_Async = _core_SetIdentity_AsyncPtr + .asFunction Function(Mat, Scalar, CvCallback_0)>(); - ffi.Pointer VecMat_New( - ffi.Pointer rval, + ffi.Pointer core_SolveCubic_Async( + Mat coeffs, + CvCallback_2 callback, ) { - return _VecMat_New( - rval, + return _core_SolveCubic_Async( + coeffs, + callback, ); } - late final _VecMat_NewPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer)>>('VecMat_New'); - late final _VecMat_New = _VecMat_NewPtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + late final _core_SolveCubic_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Mat, CvCallback_2)>>( + 'core_SolveCubic_Async'); + late final _core_SolveCubic_Async = _core_SolveCubic_AsyncPtr + .asFunction Function(Mat, CvCallback_2)>(); - ffi.Pointer VecMat_NewFromPointer( - ffi.Pointer mats, - int length, - ffi.Pointer rval, + ffi.Pointer core_SolvePoly_Async( + Mat coeffs, + int maxIters, + CvCallback_2 callback, ) { - return _VecMat_NewFromPointer( - mats, - length, - rval, + return _core_SolvePoly_Async( + coeffs, + maxIters, + callback, ); } - late final _VecMat_NewFromPointerPtr = _lookup< + late final _core_SolvePoly_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, ffi.Int, - ffi.Pointer)>>('VecMat_NewFromPointer'); - late final _VecMat_NewFromPointer = _VecMat_NewFromPointerPtr.asFunction< - ffi.Pointer Function( - ffi.Pointer, int, ffi.Pointer)>(); + ffi.Pointer Function( + Mat, ffi.Int, CvCallback_2)>>('core_SolvePoly_Async'); + late final _core_SolvePoly_Async = _core_SolvePoly_AsyncPtr + .asFunction Function(Mat, int, CvCallback_2)>(); - ffi.Pointer VecMat_NewFromVec( - VecMat vec, - ffi.Pointer rval, + ffi.Pointer core_Solve_Async( + Mat src1, + Mat src2, + int flags, + CvCallback_2 callback, ) { - return _VecMat_NewFromVec( - vec, - rval, + return _core_Solve_Async( + src1, + src2, + flags, + callback, ); } - late final _VecMat_NewFromVecPtr = _lookup< + late final _core_Solve_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecMat, ffi.Pointer)>>('VecMat_NewFromVec'); - late final _VecMat_NewFromVec = _VecMat_NewFromVecPtr.asFunction< - ffi.Pointer Function(VecMat, ffi.Pointer)>(); + Mat, Mat, ffi.Int, CvCallback_2)>>('core_Solve_Async'); + late final _core_Solve_Async = _core_Solve_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, int, CvCallback_2)>(); - ffi.Pointer VecMat_Size( - VecMat vec, - ffi.Pointer rval, + ffi.Pointer core_SortIdx_Async( + Mat src, + int flags, + CvCallback_1 callback, ) { - return _VecMat_Size( - vec, - rval, + return _core_SortIdx_Async( + src, + flags, + callback, ); } - late final _VecMat_SizePtr = _lookup< + late final _core_SortIdx_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecMat, ffi.Pointer)>>('VecMat_Size'); - late final _VecMat_Size = _VecMat_SizePtr.asFunction< - ffi.Pointer Function(VecMat, ffi.Pointer)>(); + Mat, ffi.Int, CvCallback_1)>>('core_SortIdx_Async'); + late final _core_SortIdx_Async = _core_SortIdx_AsyncPtr + .asFunction Function(Mat, int, CvCallback_1)>(); - ffi.Pointer VecPoint2f_Append( - VecPoint2f vec, - Point2f p, + ffi.Pointer core_Sort_Async( + Mat src, + int flags, + CvCallback_1 callback, ) { - return _VecPoint2f_Append( - vec, - p, + return _core_Sort_Async( + src, + flags, + callback, ); } - late final _VecPoint2f_AppendPtr = _lookup< - ffi - .NativeFunction Function(VecPoint2f, Point2f)>>( - 'VecPoint2f_Append'); - late final _VecPoint2f_Append = _VecPoint2f_AppendPtr.asFunction< - ffi.Pointer Function(VecPoint2f, Point2f)>(); + late final _core_Sort_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, ffi.Int, CvCallback_1)>>('core_Sort_Async'); + late final _core_Sort_Async = _core_Sort_AsyncPtr + .asFunction Function(Mat, int, CvCallback_1)>(); - ffi.Pointer VecPoint2f_At( - VecPoint2f vec, - int idx, - ffi.Pointer rval, + ffi.Pointer core_Split_Async( + Mat src, + CvCallback_1 callback, ) { - return _VecPoint2f_At( - vec, - idx, - rval, + return _core_Split_Async( + src, + callback, ); } - late final _VecPoint2f_AtPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - VecPoint2f, ffi.Int, ffi.Pointer)>>('VecPoint2f_At'); - late final _VecPoint2f_At = _VecPoint2f_AtPtr.asFunction< - ffi.Pointer Function(VecPoint2f, int, ffi.Pointer)>(); + late final _core_Split_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Mat, CvCallback_1)>>( + 'core_Split_Async'); + late final _core_Split_Async = _core_Split_AsyncPtr + .asFunction Function(Mat, CvCallback_1)>(); - void VecPoint2f_Close( - VecPoint2fPtr vec, + ffi.Pointer core_Sqrt_Async( + Mat self, + CvCallback_1 callback, ) { - return _VecPoint2f_Close( - vec, + return _core_Sqrt_Async( + self, + callback, ); } - late final _VecPoint2f_ClosePtr = - _lookup>( - 'VecPoint2f_Close'); - late final _VecPoint2f_Close = - _VecPoint2f_ClosePtr.asFunction(); + late final _core_Sqrt_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Mat, CvCallback_1)>>( + 'core_Sqrt_Async'); + late final _core_Sqrt_Async = _core_Sqrt_AsyncPtr + .asFunction Function(Mat, CvCallback_1)>(); - ffi.Pointer VecPoint2f_New( - ffi.Pointer rval, + ffi.Pointer core_Subtract_Async( + Mat src1, + Mat src2, + Mat mask, + int dtype, + CvCallback_1 callback, ) { - return _VecPoint2f_New( - rval, + return _core_Subtract_Async( + src1, + src2, + mask, + dtype, + callback, ); } - late final _VecPoint2f_NewPtr = _lookup< + late final _core_Subtract_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer)>>('VecPoint2f_New'); - late final _VecPoint2f_New = _VecPoint2f_NewPtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + Mat, Mat, Mat, ffi.Int, CvCallback_1)>>('core_Subtract_Async'); + late final _core_Subtract_Async = _core_Subtract_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, int, CvCallback_1)>(); - ffi.Pointer VecPoint2f_NewFromMat( - Mat mat, - ffi.Pointer rval, + ffi.Pointer core_Sum_Async( + Mat src, + CvCallback_1 callback, ) { - return _VecPoint2f_NewFromMat( - mat, - rval, + return _core_Sum_Async( + src, + callback, ); } - late final _VecPoint2f_NewFromMatPtr = _lookup< + late final _core_Sum_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - Mat, ffi.Pointer)>>('VecPoint2f_NewFromMat'); - late final _VecPoint2f_NewFromMat = _VecPoint2f_NewFromMatPtr.asFunction< - ffi.Pointer Function(Mat, ffi.Pointer)>(); + ffi.Pointer Function(Mat, CvCallback_1)>>('core_Sum_Async'); + late final _core_Sum_Async = _core_Sum_AsyncPtr + .asFunction Function(Mat, CvCallback_1)>(); - ffi.Pointer VecPoint2f_NewFromPointer( - ffi.Pointer pts, - int length, - ffi.Pointer rval, + ffi.Pointer core_T_Async( + Mat x, + CvCallback_1 callback, ) { - return _VecPoint2f_NewFromPointer( - pts, - length, - rval, + return _core_T_Async( + x, + callback, ); } - late final _VecPoint2f_NewFromPointerPtr = _lookup< + late final _core_T_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, ffi.Int, - ffi.Pointer)>>('VecPoint2f_NewFromPointer'); - late final _VecPoint2f_NewFromPointer = - _VecPoint2f_NewFromPointerPtr.asFunction< - ffi.Pointer Function( - ffi.Pointer, int, ffi.Pointer)>(); + ffi.Pointer Function(Mat, CvCallback_1)>>('core_T_Async'); + late final _core_T_Async = _core_T_AsyncPtr + .asFunction Function(Mat, CvCallback_1)>(); - ffi.Pointer VecPoint2f_NewFromVec( - VecPoint2f vec, - ffi.Pointer rval, + ffi.Pointer core_Trace_Async( + Mat src, + CvCallback_1 callback, ) { - return _VecPoint2f_NewFromVec( - vec, - rval, + return _core_Trace_Async( + src, + callback, ); } - late final _VecPoint2f_NewFromVecPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - VecPoint2f, ffi.Pointer)>>('VecPoint2f_NewFromVec'); - late final _VecPoint2f_NewFromVec = _VecPoint2f_NewFromVecPtr.asFunction< - ffi.Pointer Function(VecPoint2f, ffi.Pointer)>(); + late final _core_Trace_AsyncPtr = _lookup< + ffi + .NativeFunction Function(Mat, CvCallback_1)>>( + 'core_Trace_Async'); + late final _core_Trace_Async = _core_Trace_AsyncPtr + .asFunction Function(Mat, CvCallback_1)>(); - ffi.Pointer VecPoint2f_Size( - VecPoint2f vec, - ffi.Pointer rval, + ffi.Pointer core_Transform_Async( + Mat src, + Mat tm, + CvCallback_1 callback, ) { - return _VecPoint2f_Size( - vec, - rval, + return _core_Transform_Async( + src, + tm, + callback, ); } - late final _VecPoint2f_SizePtr = _lookup< + late final _core_Transform_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecPoint2f, ffi.Pointer)>>('VecPoint2f_Size'); - late final _VecPoint2f_Size = _VecPoint2f_SizePtr.asFunction< - ffi.Pointer Function(VecPoint2f, ffi.Pointer)>(); + Mat, Mat, CvCallback_1)>>('core_Transform_Async'); + late final _core_Transform_Async = _core_Transform_AsyncPtr + .asFunction Function(Mat, Mat, CvCallback_1)>(); - ffi.Pointer VecPoint3f_Append( - VecPoint3f vec, - Point3f point, + ffi.Pointer core_Transpose_Async( + Mat src, + CvCallback_1 callback, ) { - return _VecPoint3f_Append( - vec, - point, + return _core_Transpose_Async( + src, + callback, ); } - late final _VecPoint3f_AppendPtr = _lookup< + late final _core_Transpose_AsyncPtr = _lookup< ffi - .NativeFunction Function(VecPoint3f, Point3f)>>( - 'VecPoint3f_Append'); - late final _VecPoint3f_Append = _VecPoint3f_AppendPtr.asFunction< - ffi.Pointer Function(VecPoint3f, Point3f)>(); + .NativeFunction Function(Mat, CvCallback_1)>>( + 'core_Transpose_Async'); + late final _core_Transpose_Async = _core_Transpose_AsyncPtr + .asFunction Function(Mat, CvCallback_1)>(); - ffi.Pointer VecPoint3f_At( - VecPoint3f vec, - int idx, - ffi.Pointer rval, + ffi.Pointer core_Vconcat_Async( + Mat src1, + Mat src2, + CvCallback_1 callback, ) { - return _VecPoint3f_At( - vec, - idx, - rval, + return _core_Vconcat_Async( + src1, + src2, + callback, ); } - late final _VecPoint3f_AtPtr = _lookup< + late final _core_Vconcat_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecPoint3f, ffi.Int, ffi.Pointer)>>('VecPoint3f_At'); - late final _VecPoint3f_At = _VecPoint3f_AtPtr.asFunction< - ffi.Pointer Function(VecPoint3f, int, ffi.Pointer)>(); + Mat, Mat, CvCallback_1)>>('core_Vconcat_Async'); + late final _core_Vconcat_Async = _core_Vconcat_AsyncPtr + .asFunction Function(Mat, Mat, CvCallback_1)>(); - void VecPoint3f_Close( - VecPoint3fPtr vec, + ffi.Pointer core_colRange_Async( + Mat self, + int start, + int end, + CvCallback_1 callback, ) { - return _VecPoint3f_Close( - vec, + return _core_colRange_Async( + self, + start, + end, + callback, ); } - late final _VecPoint3f_ClosePtr = - _lookup>( - 'VecPoint3f_Close'); - late final _VecPoint3f_Close = - _VecPoint3f_ClosePtr.asFunction(); + late final _core_colRange_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, ffi.Int, ffi.Int, CvCallback_1)>>('core_colRange_Async'); + late final _core_colRange_Async = _core_colRange_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, int, CvCallback_1)>(); - ffi.Pointer VecPoint3f_New( - ffi.Pointer rval, + ffi.Pointer core_rowRange_Async( + Mat self, + int start, + int end, + CvCallback_1 callback, ) { - return _VecPoint3f_New( - rval, + return _core_rowRange_Async( + self, + start, + end, + callback, ); } - late final _VecPoint3f_NewPtr = _lookup< + late final _core_rowRange_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer)>>('VecPoint3f_New'); - late final _VecPoint3f_New = _VecPoint3f_NewPtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + Mat, ffi.Int, ffi.Int, CvCallback_1)>>('core_rowRange_Async'); + late final _core_rowRange_Async = _core_rowRange_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, int, int, CvCallback_1)>(); - ffi.Pointer VecPoint3f_NewFromMat( - Mat mat, - ffi.Pointer rval, + ffi.Pointer destroyAllWindows() { + return _destroyAllWindows(); + } + + late final _destroyAllWindowsPtr = + _lookup Function()>>( + 'destroyAllWindows'); + late final _destroyAllWindows = + _destroyAllWindowsPtr.asFunction Function()>(); + + ffi.Pointer drawChessboardCorners_Async( + Mat image, + Size patternSize, + bool patternWasFound, + CvCallback_0 callback, ) { - return _VecPoint3f_NewFromMat( - mat, - rval, + return _drawChessboardCorners_Async( + image, + patternSize, + patternWasFound, + callback, ); } - late final _VecPoint3f_NewFromMatPtr = _lookup< + late final _drawChessboardCorners_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - Mat, ffi.Pointer)>>('VecPoint3f_NewFromMat'); - late final _VecPoint3f_NewFromMat = _VecPoint3f_NewFromMatPtr.asFunction< - ffi.Pointer Function(Mat, ffi.Pointer)>(); + ffi.Pointer Function(Mat, Size, ffi.Bool, + CvCallback_0)>>('drawChessboardCorners_Async'); + late final _drawChessboardCorners_Async = + _drawChessboardCorners_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Size, bool, CvCallback_0)>(); - ffi.Pointer VecPoint3f_NewFromPointer( - ffi.Pointer points, - int length, - ffi.Pointer rval, + ffi.Pointer estimateAffine2DWithParams_Async( + VecPoint2f from, + VecPoint2f to, + int method, + double ransacReprojThreshold, + int maxIters, + double confidence, + int refineIters, + CvCallback_2 callback, ) { - return _VecPoint3f_NewFromPointer( - points, - length, - rval, + return _estimateAffine2DWithParams_Async( + from, + to, + method, + ransacReprojThreshold, + maxIters, + confidence, + refineIters, + callback, ); } - late final _VecPoint3f_NewFromPointerPtr = _lookup< + late final _estimateAffine2DWithParams_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, ffi.Int, - ffi.Pointer)>>('VecPoint3f_NewFromPointer'); - late final _VecPoint3f_NewFromPointer = - _VecPoint3f_NewFromPointerPtr.asFunction< ffi.Pointer Function( - ffi.Pointer, int, ffi.Pointer)>(); + VecPoint2f, + VecPoint2f, + ffi.Int, + ffi.Double, + ffi.Size, + ffi.Double, + ffi.Size, + CvCallback_2)>>('estimateAffine2DWithParams_Async'); + late final _estimateAffine2DWithParams_Async = + _estimateAffine2DWithParams_AsyncPtr.asFunction< + ffi.Pointer Function(VecPoint2f, VecPoint2f, int, double, + int, double, int, CvCallback_2)>(); - ffi.Pointer VecPoint3f_NewFromVec( - VecPoint3f vec, - ffi.Pointer rval, + ffi.Pointer estimateAffine2D_Async( + VecPoint2f from, + VecPoint2f to, + CvCallback_1 callback, ) { - return _VecPoint3f_NewFromVec( - vec, - rval, + return _estimateAffine2D_Async( + from, + to, + callback, ); } - late final _VecPoint3f_NewFromVecPtr = _lookup< + late final _estimateAffine2D_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecPoint3f, ffi.Pointer)>>('VecPoint3f_NewFromVec'); - late final _VecPoint3f_NewFromVec = _VecPoint3f_NewFromVecPtr.asFunction< - ffi.Pointer Function(VecPoint3f, ffi.Pointer)>(); + VecPoint2f, VecPoint2f, CvCallback_1)>>('estimateAffine2D_Async'); + late final _estimateAffine2D_Async = _estimateAffine2D_AsyncPtr.asFunction< + ffi.Pointer Function(VecPoint2f, VecPoint2f, CvCallback_1)>(); - ffi.Pointer VecPoint3f_Size( - VecPoint3f vec, - ffi.Pointer rval, + ffi.Pointer estimateAffinePartial2DWithParams_Async( + VecPoint2f from, + VecPoint2f to, + int method, + double ransacReprojThreshold, + int maxIters, + double confidence, + int refineIters, + CvCallback_2 callback, ) { - return _VecPoint3f_Size( - vec, - rval, + return _estimateAffinePartial2DWithParams_Async( + from, + to, + method, + ransacReprojThreshold, + maxIters, + confidence, + refineIters, + callback, ); } - late final _VecPoint3f_SizePtr = _lookup< + late final _estimateAffinePartial2DWithParams_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecPoint3f, ffi.Pointer)>>('VecPoint3f_Size'); - late final _VecPoint3f_Size = _VecPoint3f_SizePtr.asFunction< - ffi.Pointer Function(VecPoint3f, ffi.Pointer)>(); + VecPoint2f, + VecPoint2f, + ffi.Int, + ffi.Double, + ffi.Size, + ffi.Double, + ffi.Size, + CvCallback_2)>>('estimateAffinePartial2DWithParams_Async'); + late final _estimateAffinePartial2DWithParams_Async = + _estimateAffinePartial2DWithParams_AsyncPtr.asFunction< + ffi.Pointer Function(VecPoint2f, VecPoint2f, int, double, + int, double, int, CvCallback_2)>(); - ffi.Pointer VecPoint_Append( - VecPoint vec, - Point p, + ffi.Pointer estimateAffinePartial2D_Async( + VecPoint2f from, + VecPoint2f to, + CvCallback_1 callback, ) { - return _VecPoint_Append( - vec, - p, + return _estimateAffinePartial2D_Async( + from, + to, + callback, ); } - late final _VecPoint_AppendPtr = _lookup< - ffi.NativeFunction Function(VecPoint, Point)>>( - 'VecPoint_Append'); - late final _VecPoint_Append = _VecPoint_AppendPtr.asFunction< - ffi.Pointer Function(VecPoint, Point)>(); + late final _estimateAffinePartial2D_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(VecPoint2f, VecPoint2f, + CvCallback_1)>>('estimateAffinePartial2D_Async'); + late final _estimateAffinePartial2D_Async = + _estimateAffinePartial2D_AsyncPtr.asFunction< + ffi.Pointer Function( + VecPoint2f, VecPoint2f, CvCallback_1)>(); - ffi.Pointer VecPoint_At( - VecPoint vec, - int idx, - ffi.Pointer rval, + ffi.Pointer findChessboardCornersSBWithMeta_Async( + Mat image, + Size patternSize, + int flags, + CvCallback_3 callback, ) { - return _VecPoint_At( - vec, - idx, - rval, + return _findChessboardCornersSBWithMeta_Async( + image, + patternSize, + flags, + callback, ); } - late final _VecPoint_AtPtr = _lookup< + late final _findChessboardCornersSBWithMeta_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - VecPoint, ffi.Int, ffi.Pointer)>>('VecPoint_At'); - late final _VecPoint_At = _VecPoint_AtPtr.asFunction< - ffi.Pointer Function(VecPoint, int, ffi.Pointer)>(); + ffi.Pointer Function(Mat, Size, ffi.Int, + CvCallback_3)>>('findChessboardCornersSBWithMeta_Async'); + late final _findChessboardCornersSBWithMeta_Async = + _findChessboardCornersSBWithMeta_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Size, int, CvCallback_3)>(); - void VecPoint_Close( - VecPointPtr vec, + ffi.Pointer findChessboardCornersSB_Async( + Mat image, + Size patternSize, + int flags, + CvCallback_2 callback, ) { - return _VecPoint_Close( - vec, + return _findChessboardCornersSB_Async( + image, + patternSize, + flags, + callback, ); } - late final _VecPoint_ClosePtr = - _lookup>( - 'VecPoint_Close'); - late final _VecPoint_Close = - _VecPoint_ClosePtr.asFunction(); + late final _findChessboardCornersSB_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Size, ffi.Int, + CvCallback_2)>>('findChessboardCornersSB_Async'); + late final _findChessboardCornersSB_Async = + _findChessboardCornersSB_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Size, int, CvCallback_2)>(); - ffi.Pointer VecPoint_New( - ffi.Pointer rval, + ffi.Pointer findChessboardCorners_Async( + Mat image, + Size patternSize, + int flags, + CvCallback_2 callback, ) { - return _VecPoint_New( - rval, + return _findChessboardCorners_Async( + image, + patternSize, + flags, + callback, ); } - late final _VecPoint_NewPtr = _lookup< + late final _findChessboardCorners_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>>('VecPoint_New'); - late final _VecPoint_New = _VecPoint_NewPtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + ffi.Pointer Function(Mat, Size, ffi.Int, + CvCallback_2)>>('findChessboardCorners_Async'); + late final _findChessboardCorners_Async = + _findChessboardCorners_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Size, int, CvCallback_2)>(); - ffi.Pointer VecPoint_NewFromMat( - Mat mat, - ffi.Pointer rval, + ffi.Pointer + fisheye_estimateNewCameraMatrixForUndistortRectify_Async( + Mat k, + Mat d, + Size imgSize, + Mat r, + double balance, + Size newSize, + double fovScale, + CvCallback_1 p, ) { - return _VecPoint_NewFromMat( - mat, - rval, + return _fisheye_estimateNewCameraMatrixForUndistortRectify_Async( + k, + d, + imgSize, + r, + balance, + newSize, + fovScale, + p, ); } - late final _VecPoint_NewFromMatPtr = _lookup< - ffi.NativeFunction< + late final _fisheye_estimateNewCameraMatrixForUndistortRectify_AsyncPtr = + _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, Size, Mat, + ffi.Double, Size, ffi.Double, CvCallback_1)>>( + 'fisheye_estimateNewCameraMatrixForUndistortRectify_Async'); + late final _fisheye_estimateNewCameraMatrixForUndistortRectify_Async = + _fisheye_estimateNewCameraMatrixForUndistortRectify_AsyncPtr.asFunction< ffi.Pointer Function( - Mat, ffi.Pointer)>>('VecPoint_NewFromMat'); - late final _VecPoint_NewFromMat = _VecPoint_NewFromMatPtr.asFunction< - ffi.Pointer Function(Mat, ffi.Pointer)>(); + Mat, Mat, Size, Mat, double, Size, double, CvCallback_1)>(); - /// Copy from a pointer - ffi.Pointer VecPoint_NewFromPointer( - ffi.Pointer points, - int length, - ffi.Pointer rval, + ffi.Pointer fisheye_undistortImageWithParams_Async( + Mat distorted, + Mat k, + Mat d, + Mat knew, + Size size, + CvCallback_1 callback, ) { - return _VecPoint_NewFromPointer( - points, - length, - rval, + return _fisheye_undistortImageWithParams_Async( + distorted, + k, + d, + knew, + size, + callback, ); } - late final _VecPoint_NewFromPointerPtr = _lookup< + late final _fisheye_undistortImageWithParams_AsyncPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, ffi.Int, - ffi.Pointer)>>('VecPoint_NewFromPointer'); - late final _VecPoint_NewFromPointer = _VecPoint_NewFromPointerPtr.asFunction< - ffi.Pointer Function( - ffi.Pointer, int, ffi.Pointer)>(); + ffi.Pointer Function(Mat, Mat, Mat, Mat, Size, + CvCallback_1)>>('fisheye_undistortImageWithParams_Async'); + late final _fisheye_undistortImageWithParams_Async = + _fisheye_undistortImageWithParams_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, Mat, Mat, Size, CvCallback_1)>(); - ffi.Pointer VecPoint_NewFromVec( - VecPoint vec, - ffi.Pointer rval, + ffi.Pointer fisheye_undistortImage_Async( + Mat distorted, + Mat k, + Mat d, + CvCallback_1 callback, ) { - return _VecPoint_NewFromVec( - vec, - rval, + return _fisheye_undistortImage_Async( + distorted, + k, + d, + callback, ); } - late final _VecPoint_NewFromVecPtr = _lookup< + late final _fisheye_undistortImage_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecPoint, ffi.Pointer)>>('VecPoint_NewFromVec'); - late final _VecPoint_NewFromVec = _VecPoint_NewFromVecPtr.asFunction< - ffi.Pointer Function(VecPoint, ffi.Pointer)>(); + Mat, Mat, Mat, CvCallback_1)>>('fisheye_undistortImage_Async'); + late final _fisheye_undistortImage_Async = + _fisheye_undistortImage_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, CvCallback_1)>(); - ffi.Pointer VecPoint_Size( - VecPoint vec, - ffi.Pointer rval, + ffi.Pointer fisheye_undistortPoints_Async( + Mat distorted, + Mat k, + Mat d, + Mat R, + Mat P, + CvCallback_1 callback, ) { - return _VecPoint_Size( - vec, - rval, + return _fisheye_undistortPoints_Async( + distorted, + k, + d, + R, + P, + callback, ); } - late final _VecPoint_SizePtr = _lookup< + late final _fisheye_undistortPoints_AsyncPtr = _lookup< ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, Mat, Mat, Mat, + CvCallback_1)>>('fisheye_undistortPoints_Async'); + late final _fisheye_undistortPoints_Async = + _fisheye_undistortPoints_AsyncPtr.asFunction< ffi.Pointer Function( - VecPoint, ffi.Pointer)>>('VecPoint_Size'); - late final _VecPoint_Size = _VecPoint_SizePtr.asFunction< - ffi.Pointer Function(VecPoint, ffi.Pointer)>(); + Mat, Mat, Mat, Mat, Mat, CvCallback_1)>(); - ffi.Pointer VecRect_Append( - VecRect vec, - Rect rect, + ffi.Pointer gapi_BGR2Gray( + GMat src, + ffi.Pointer rval, ) { - return _VecRect_Append( - vec, - rect, + return _gapi_BGR2Gray( + src, + rval, ); } - late final _VecRect_AppendPtr = _lookup< - ffi.NativeFunction Function(VecRect, Rect)>>( - 'VecRect_Append'); - late final _VecRect_Append = _VecRect_AppendPtr.asFunction< - ffi.Pointer Function(VecRect, Rect)>(); + late final _gapi_BGR2GrayPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + GMat, ffi.Pointer)>>('gapi_BGR2Gray'); + late final _gapi_BGR2Gray = _gapi_BGR2GrayPtr + .asFunction Function(GMat, ffi.Pointer)>(); - ffi.Pointer VecRect_At( - VecRect vec, - int idx, - ffi.Pointer rval, + ffi.Pointer gapi_BGR2I420( + GMat src, + ffi.Pointer rval, ) { - return _VecRect_At( - vec, - idx, + return _gapi_BGR2I420( + src, rval, ); } - late final _VecRect_AtPtr = _lookup< + late final _gapi_BGR2I420Ptr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecRect, ffi.Int, ffi.Pointer)>>('VecRect_At'); - late final _VecRect_At = _VecRect_AtPtr.asFunction< - ffi.Pointer Function(VecRect, int, ffi.Pointer)>(); + GMat, ffi.Pointer)>>('gapi_BGR2I420'); + late final _gapi_BGR2I420 = _gapi_BGR2I420Ptr + .asFunction Function(GMat, ffi.Pointer)>(); - void VecRect_Close( - VecRectPtr vec, + ffi.Pointer gapi_BGR2LUV( + GMat src, + ffi.Pointer rval, ) { - return _VecRect_Close( - vec, + return _gapi_BGR2LUV( + src, + rval, ); } - late final _VecRect_ClosePtr = - _lookup>( - 'VecRect_Close'); - late final _VecRect_Close = - _VecRect_ClosePtr.asFunction(); + late final _gapi_BGR2LUVPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + GMat, ffi.Pointer)>>('gapi_BGR2LUV'); + late final _gapi_BGR2LUV = _gapi_BGR2LUVPtr + .asFunction Function(GMat, ffi.Pointer)>(); - ffi.Pointer VecRect_New( - ffi.Pointer rval, + ffi.Pointer gapi_BGR2RGB( + GMat src, + ffi.Pointer rval, ) { - return _VecRect_New( + return _gapi_BGR2RGB( + src, rval, ); } - late final _VecRect_NewPtr = _lookup< + late final _gapi_BGR2RGBPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer)>>('VecRect_New'); - late final _VecRect_New = _VecRect_NewPtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + ffi.Pointer Function( + GMat, ffi.Pointer)>>('gapi_BGR2RGB'); + late final _gapi_BGR2RGB = _gapi_BGR2RGBPtr + .asFunction Function(GMat, ffi.Pointer)>(); - ffi.Pointer VecRect_NewFromPointer( - ffi.Pointer rects, - int length, - ffi.Pointer rval, + ffi.Pointer gapi_BGR2YUV( + GMat src, + ffi.Pointer rval, ) { - return _VecRect_NewFromPointer( - rects, - length, + return _gapi_BGR2YUV( + src, rval, ); } - late final _VecRect_NewFromPointerPtr = _lookup< + late final _gapi_BGR2YUVPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, ffi.Int, - ffi.Pointer)>>('VecRect_NewFromPointer'); - late final _VecRect_NewFromPointer = _VecRect_NewFromPointerPtr.asFunction< - ffi.Pointer Function( - ffi.Pointer, int, ffi.Pointer)>(); + ffi.Pointer Function( + GMat, ffi.Pointer)>>('gapi_BGR2YUV'); + late final _gapi_BGR2YUV = _gapi_BGR2YUVPtr + .asFunction Function(GMat, ffi.Pointer)>(); - ffi.Pointer VecRect_NewFromVec( - VecRect vec, - ffi.Pointer rval, + ffi.Pointer gapi_BayerGR2RGB( + GMat src_gr, + ffi.Pointer rval, ) { - return _VecRect_NewFromVec( - vec, + return _gapi_BayerGR2RGB( + src_gr, rval, ); } - late final _VecRect_NewFromVecPtr = _lookup< + late final _gapi_BayerGR2RGBPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecRect, ffi.Pointer)>>('VecRect_NewFromVec'); - late final _VecRect_NewFromVec = _VecRect_NewFromVecPtr.asFunction< - ffi.Pointer Function(VecRect, ffi.Pointer)>(); + GMat, ffi.Pointer)>>('gapi_BayerGR2RGB'); + late final _gapi_BayerGR2RGB = _gapi_BayerGR2RGBPtr + .asFunction Function(GMat, ffi.Pointer)>(); - ffi.Pointer VecRect_Size( - VecRect vec, - ffi.Pointer rval, + ffi.Pointer gapi_Canny( + GMat image, + double threshold1, + double threshold2, + int apertureSize, + bool L2gradient, + ffi.Pointer rval, ) { - return _VecRect_Size( - vec, + return _gapi_Canny( + image, + threshold1, + threshold2, + apertureSize, + L2gradient, rval, ); } - late final _VecRect_SizePtr = _lookup< + late final _gapi_CannyPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - VecRect, ffi.Pointer)>>('VecRect_Size'); - late final _VecRect_Size = _VecRect_SizePtr.asFunction< - ffi.Pointer Function(VecRect, ffi.Pointer)>(); + ffi.Pointer Function(GMat, ffi.Double, ffi.Double, ffi.Int, + ffi.Bool, ffi.Pointer)>>('gapi_Canny'); + late final _gapi_Canny = _gapi_CannyPtr.asFunction< + ffi.Pointer Function( + GMat, double, double, int, bool, ffi.Pointer)>(); - ffi.Pointer VecUChar_Append( - VecUChar vec, - int i, + void gapi_GComputation_Close( + GComputationPtr self, ) { - return _VecUChar_Append( - vec, - i, + return _gapi_GComputation_Close( + self, ); } - late final _VecUChar_AppendPtr = _lookup< - ffi.NativeFunction Function(VecUChar, uchar)>>( - 'VecUChar_Append'); - late final _VecUChar_Append = _VecUChar_AppendPtr.asFunction< - ffi.Pointer Function(VecUChar, int)>(); + late final _gapi_GComputation_ClosePtr = + _lookup>( + 'gapi_GComputation_Close'); + late final _gapi_GComputation_Close = + _gapi_GComputation_ClosePtr.asFunction(); - ffi.Pointer VecUChar_At( - VecUChar vec, - int idx, - ffi.Pointer rval, + ffi.Pointer gapi_GComputation_New( + GMat in1, + GMat out, + ffi.Pointer rval, ) { - return _VecUChar_At( - vec, - idx, + return _gapi_GComputation_New( + in1, + out, rval, ); } - late final _VecUChar_AtPtr = _lookup< + late final _gapi_GComputation_NewPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecUChar, ffi.Int, ffi.Pointer)>>('VecUChar_At'); - late final _VecUChar_At = _VecUChar_AtPtr.asFunction< - ffi.Pointer Function(VecUChar, int, ffi.Pointer)>(); + GMat, GMat, ffi.Pointer)>>('gapi_GComputation_New'); + late final _gapi_GComputation_New = _gapi_GComputation_NewPtr.asFunction< + ffi.Pointer Function(GMat, GMat, ffi.Pointer)>(); - ffi.Pointer VecUChar_AtNoBoundCheck( - VecUChar vec, - int idx, - ffi.Pointer rval, + ffi.Pointer gapi_GComputation_New_1( + GMat in1, + GScalar out, + ffi.Pointer rval, ) { - return _VecUChar_AtNoBoundCheck( - vec, - idx, + return _gapi_GComputation_New_1( + in1, + out, rval, ); } - late final _VecUChar_AtNoBoundCheckPtr = _lookup< + late final _gapi_GComputation_New_1Ptr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(VecUChar, ffi.Int, - ffi.Pointer)>>('VecUChar_AtNoBoundCheck'); - late final _VecUChar_AtNoBoundCheck = _VecUChar_AtNoBoundCheckPtr.asFunction< - ffi.Pointer Function(VecUChar, int, ffi.Pointer)>(); + ffi.Pointer Function(GMat, GScalar, + ffi.Pointer)>>('gapi_GComputation_New_1'); + late final _gapi_GComputation_New_1 = _gapi_GComputation_New_1Ptr.asFunction< + ffi.Pointer Function( + GMat, GScalar, ffi.Pointer)>(); - void VecUChar_Close( - VecUCharPtr vec, + ffi.Pointer gapi_GComputation_New_2( + GMat in1, + GMat in2, + GMat out, + ffi.Pointer rval, ) { - return _VecUChar_Close( - vec, + return _gapi_GComputation_New_2( + in1, + in2, + out, + rval, ); } - late final _VecUChar_ClosePtr = - _lookup>( - 'VecUChar_Close'); - late final _VecUChar_Close = - _VecUChar_ClosePtr.asFunction(); + late final _gapi_GComputation_New_2Ptr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(GMat, GMat, GMat, + ffi.Pointer)>>('gapi_GComputation_New_2'); + late final _gapi_GComputation_New_2 = _gapi_GComputation_New_2Ptr.asFunction< + ffi.Pointer Function( + GMat, GMat, GMat, ffi.Pointer)>(); - ffi.Pointer VecUChar_Data( - VecUChar vec, - ffi.Pointer> rval, + ffi.Pointer gapi_GComputation_New_3( + GMat in1, + GMat in2, + GScalar out, + ffi.Pointer rval, ) { - return _VecUChar_Data( - vec, + return _gapi_GComputation_New_3( + in1, + in2, + out, rval, ); } - late final _VecUChar_DataPtr = _lookup< + late final _gapi_GComputation_New_3Ptr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - VecUChar, ffi.Pointer>)>>('VecUChar_Data'); - late final _VecUChar_Data = _VecUChar_DataPtr.asFunction< + ffi.Pointer Function(GMat, GMat, GScalar, + ffi.Pointer)>>('gapi_GComputation_New_3'); + late final _gapi_GComputation_New_3 = _gapi_GComputation_New_3Ptr.asFunction< ffi.Pointer Function( - VecUChar, ffi.Pointer>)>(); + GMat, GMat, GScalar, ffi.Pointer)>(); - ffi.Pointer VecUChar_New( - ffi.Pointer rval, + ffi.Pointer gapi_GComputation_apply( + GComputation self, + Mat in1, + CvCallback_1 callback, ) { - return _VecUChar_New( - rval, + return _gapi_GComputation_apply( + self, + in1, + callback, ); } - late final _VecUChar_NewPtr = _lookup< + late final _gapi_GComputation_applyPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer)>>('VecUChar_New'); - late final _VecUChar_New = _VecUChar_NewPtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + GComputation, Mat, CvCallback_1)>>('gapi_GComputation_apply'); + late final _gapi_GComputation_apply = _gapi_GComputation_applyPtr.asFunction< + ffi.Pointer Function(GComputation, Mat, CvCallback_1)>(); - ffi.Pointer VecUChar_NewFromPointer( - ffi.Pointer p, - int length, - ffi.Pointer rval, + ffi.Pointer gapi_GComputation_apply_1( + GComputation self, + Mat in1, + ffi.Pointer out, ) { - return _VecUChar_NewFromPointer( - p, - length, - rval, + return _gapi_GComputation_apply_1( + self, + in1, + out, ); } - late final _VecUChar_NewFromPointerPtr = _lookup< + late final _gapi_GComputation_apply_1Ptr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, ffi.Int, - ffi.Pointer)>>('VecUChar_NewFromPointer'); - late final _VecUChar_NewFromPointer = _VecUChar_NewFromPointerPtr.asFunction< - ffi.Pointer Function( - ffi.Pointer, int, ffi.Pointer)>(); + ffi.Pointer Function(GComputation, Mat, + ffi.Pointer)>>('gapi_GComputation_apply_1'); + late final _gapi_GComputation_apply_1 = + _gapi_GComputation_apply_1Ptr.asFunction< + ffi.Pointer Function( + GComputation, Mat, ffi.Pointer)>(); - ffi.Pointer VecUChar_NewFromVec( - VecUChar vec, - ffi.Pointer rval, + ffi.Pointer gapi_GComputation_apply_2( + GComputation self, + Mat in1, + Mat in2, + ffi.Pointer out, ) { - return _VecUChar_NewFromVec( - vec, - rval, + return _gapi_GComputation_apply_2( + self, + in1, + in2, + out, ); } - late final _VecUChar_NewFromVecPtr = _lookup< + late final _gapi_GComputation_apply_2Ptr = _lookup< ffi.NativeFunction< + ffi.Pointer Function(GComputation, Mat, Mat, + ffi.Pointer)>>('gapi_GComputation_apply_2'); + late final _gapi_GComputation_apply_2 = + _gapi_GComputation_apply_2Ptr.asFunction< ffi.Pointer Function( - VecUChar, ffi.Pointer)>>('VecUChar_NewFromVec'); - late final _VecUChar_NewFromVec = _VecUChar_NewFromVecPtr.asFunction< - ffi.Pointer Function(VecUChar, ffi.Pointer)>(); + GComputation, Mat, Mat, ffi.Pointer)>(); - ffi.Pointer VecUChar_Size( - VecUChar vec, - ffi.Pointer rval, + ffi.Pointer gapi_GComputation_apply_3( + GComputation self, + Mat in1, + Mat in2, + ffi.Pointer out, ) { - return _VecUChar_Size( - vec, - rval, + return _gapi_GComputation_apply_3( + self, + in1, + in2, + out, ); } - late final _VecUChar_SizePtr = _lookup< + late final _gapi_GComputation_apply_3Ptr = _lookup< ffi.NativeFunction< + ffi.Pointer Function(GComputation, Mat, Mat, + ffi.Pointer)>>('gapi_GComputation_apply_3'); + late final _gapi_GComputation_apply_3 = + _gapi_GComputation_apply_3Ptr.asFunction< ffi.Pointer Function( - VecUChar, ffi.Pointer)>>('VecUChar_Size'); - late final _VecUChar_Size = _VecUChar_SizePtr.asFunction< - ffi.Pointer Function(VecUChar, ffi.Pointer)>(); + GComputation, Mat, Mat, ffi.Pointer)>(); - ffi.Pointer VecVecChar_Append( - VecVecChar vec, - VecChar v, + void gapi_GMat_Close( + GMatPtr mat, ) { - return _VecVecChar_Append( - vec, - v, + return _gapi_GMat_Close( + mat, + ); + } + + late final _gapi_GMat_ClosePtr = + _lookup>( + 'gapi_GMat_Close'); + late final _gapi_GMat_Close = + _gapi_GMat_ClosePtr.asFunction(); + + ffi.Pointer gapi_GMat_New_Empty( + ffi.Pointer rval, + ) { + return _gapi_GMat_New_Empty( + rval, ); } - late final _VecVecChar_AppendPtr = _lookup< + late final _gapi_GMat_New_EmptyPtr = _lookup< ffi - .NativeFunction Function(VecVecChar, VecChar)>>( - 'VecVecChar_Append'); - late final _VecVecChar_Append = _VecVecChar_AppendPtr.asFunction< - ffi.Pointer Function(VecVecChar, VecChar)>(); + .NativeFunction Function(ffi.Pointer)>>( + 'gapi_GMat_New_Empty'); + late final _gapi_GMat_New_Empty = _gapi_GMat_New_EmptyPtr + .asFunction Function(ffi.Pointer)>(); - ffi.Pointer VecVecChar_Append_Str( - VecVecChar vec, - ffi.Pointer str, + ffi.Pointer gapi_GMat_New_FromMat( + Mat mat, + ffi.Pointer rval, ) { - return _VecVecChar_Append_Str( - vec, - str, + return _gapi_GMat_New_FromMat( + mat, + rval, ); } - late final _VecVecChar_Append_StrPtr = _lookup< + late final _gapi_GMat_New_FromMatPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecVecChar, ffi.Pointer)>>('VecVecChar_Append_Str'); - late final _VecVecChar_Append_Str = _VecVecChar_Append_StrPtr.asFunction< - ffi.Pointer Function(VecVecChar, ffi.Pointer)>(); + Mat, ffi.Pointer)>>('gapi_GMat_New_FromMat'); + late final _gapi_GMat_New_FromMat = _gapi_GMat_New_FromMatPtr + .asFunction Function(Mat, ffi.Pointer)>(); - ffi.Pointer VecVecChar_At( - VecVecChar vec, - int idx, - ffi.Pointer rval, + void gapi_GScalar_Close( + GScalarPtr scalar, ) { - return _VecVecChar_At( - vec, - idx, + return _gapi_GScalar_Close( + scalar, + ); + } + + late final _gapi_GScalar_ClosePtr = + _lookup>( + 'gapi_GScalar_Close'); + late final _gapi_GScalar_Close = + _gapi_GScalar_ClosePtr.asFunction(); + + ffi.Pointer gapi_GScalar_New_Empty( + ffi.Pointer rval, + ) { + return _gapi_GScalar_New_Empty( rval, ); } - late final _VecVecChar_AtPtr = _lookup< + late final _gapi_GScalar_New_EmptyPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecVecChar, ffi.Int, ffi.Pointer)>>('VecVecChar_At'); - late final _VecVecChar_At = _VecVecChar_AtPtr.asFunction< - ffi.Pointer Function(VecVecChar, int, ffi.Pointer)>(); + ffi.Pointer)>>('gapi_GScalar_New_Empty'); + late final _gapi_GScalar_New_Empty = _gapi_GScalar_New_EmptyPtr + .asFunction Function(ffi.Pointer)>(); - ffi.Pointer VecVecChar_At_Str( - VecVecChar vec, - int idx, - ffi.Pointer> rval, - ffi.Pointer length, + ffi.Pointer gapi_GScalar_New_FromDouble( + double v0, + ffi.Pointer rval, ) { - return _VecVecChar_At_Str( - vec, - idx, + return _gapi_GScalar_New_FromDouble( + v0, rval, - length, ); } - late final _VecVecChar_At_StrPtr = _lookup< + late final _gapi_GScalar_New_FromDoublePtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - VecVecChar, - ffi.Int, - ffi.Pointer>, - ffi.Pointer)>>('VecVecChar_At_Str'); - late final _VecVecChar_At_Str = _VecVecChar_At_StrPtr.asFunction< - ffi.Pointer Function(VecVecChar, int, - ffi.Pointer>, ffi.Pointer)>(); + ffi.Pointer Function(ffi.Double, + ffi.Pointer)>>('gapi_GScalar_New_FromDouble'); + late final _gapi_GScalar_New_FromDouble = + _gapi_GScalar_New_FromDoublePtr.asFunction< + ffi.Pointer Function(double, ffi.Pointer)>(); - void VecVecChar_Close( - VecVecCharPtr vec, + ffi.Pointer gapi_GScalar_New_FromScalar( + Scalar scalar, + ffi.Pointer rval, ) { - return _VecVecChar_Close( - vec, + return _gapi_GScalar_New_FromScalar( + scalar, + rval, ); } - late final _VecVecChar_ClosePtr = - _lookup>( - 'VecVecChar_Close'); - late final _VecVecChar_Close = - _VecVecChar_ClosePtr.asFunction(); + late final _gapi_GScalar_New_FromScalarPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Scalar, ffi.Pointer)>>('gapi_GScalar_New_FromScalar'); + late final _gapi_GScalar_New_FromScalar = + _gapi_GScalar_New_FromScalarPtr.asFunction< + ffi.Pointer Function(Scalar, ffi.Pointer)>(); - ffi.Pointer VecVecChar_New( - ffi.Pointer rval, + ffi.Pointer gapi_I4202BGR( + GMat src, + ffi.Pointer rval, ) { - return _VecVecChar_New( + return _gapi_I4202BGR( + src, rval, ); } - late final _VecVecChar_NewPtr = _lookup< + late final _gapi_I4202BGRPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer)>>('VecVecChar_New'); - late final _VecVecChar_New = _VecVecChar_NewPtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + GMat, ffi.Pointer)>>('gapi_I4202BGR'); + late final _gapi_I4202BGR = _gapi_I4202BGRPtr + .asFunction Function(GMat, ffi.Pointer)>(); - ffi.Pointer VecVecChar_NewFromVec( - VecVecChar vec, - ffi.Pointer rval, + ffi.Pointer gapi_I4202RGB( + GMat src, + ffi.Pointer rval, ) { - return _VecVecChar_NewFromVec( - vec, + return _gapi_I4202RGB( + src, rval, ); } - late final _VecVecChar_NewFromVecPtr = _lookup< + late final _gapi_I4202RGBPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecVecChar, ffi.Pointer)>>('VecVecChar_NewFromVec'); - late final _VecVecChar_NewFromVec = _VecVecChar_NewFromVecPtr.asFunction< - ffi.Pointer Function(VecVecChar, ffi.Pointer)>(); + GMat, ffi.Pointer)>>('gapi_I4202RGB'); + late final _gapi_I4202RGB = _gapi_I4202RGBPtr + .asFunction Function(GMat, ffi.Pointer)>(); - ffi.Pointer VecVecChar_Size( - VecVecChar vec, - ffi.Pointer rval, + ffi.Pointer gapi_LUT( + GMat src, + Mat lut, + ffi.Pointer rval, ) { - return _VecVecChar_Size( - vec, + return _gapi_LUT( + src, + lut, rval, ); } - late final _VecVecChar_SizePtr = _lookup< + late final _gapi_LUTPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecVecChar, ffi.Pointer)>>('VecVecChar_Size'); - late final _VecVecChar_Size = _VecVecChar_SizePtr.asFunction< - ffi.Pointer Function(VecVecChar, ffi.Pointer)>(); + GMat, Mat, ffi.Pointer)>>('gapi_LUT'); + late final _gapi_LUT = _gapi_LUTPtr.asFunction< + ffi.Pointer Function(GMat, Mat, ffi.Pointer)>(); - ffi.Pointer VecVecDMatch_Append( - VecVecDMatch vec, - VecDMatch dm, + ffi.Pointer gapi_LUV2BGR( + GMat src, + ffi.Pointer rval, ) { - return _VecVecDMatch_Append( - vec, - dm, + return _gapi_LUV2BGR( + src, + rval, ); } - late final _VecVecDMatch_AppendPtr = _lookup< + late final _gapi_LUV2BGRPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecVecDMatch, VecDMatch)>>('VecVecDMatch_Append'); - late final _VecVecDMatch_Append = _VecVecDMatch_AppendPtr.asFunction< - ffi.Pointer Function(VecVecDMatch, VecDMatch)>(); + GMat, ffi.Pointer)>>('gapi_LUV2BGR'); + late final _gapi_LUV2BGR = _gapi_LUV2BGRPtr + .asFunction Function(GMat, ffi.Pointer)>(); - ffi.Pointer VecVecDMatch_At( - VecVecDMatch vec, - int idx, - ffi.Pointer rval, + ffi.Pointer gapi_Laplacian( + GMat src, + int ddepth, + int ksize, + double scale, + double delta, + int borderType, + ffi.Pointer rval, ) { - return _VecVecDMatch_At( - vec, - idx, + return _gapi_Laplacian( + src, + ddepth, + ksize, + scale, + delta, + borderType, rval, ); } - late final _VecVecDMatch_AtPtr = _lookup< + late final _gapi_LaplacianPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(VecVecDMatch, ffi.Int, - ffi.Pointer)>>('VecVecDMatch_At'); - late final _VecVecDMatch_At = _VecVecDMatch_AtPtr.asFunction< + ffi.Pointer Function(GMat, ffi.Int, ffi.Int, ffi.Double, + ffi.Double, ffi.Int, ffi.Pointer)>>('gapi_Laplacian'); + late final _gapi_Laplacian = _gapi_LaplacianPtr.asFunction< ffi.Pointer Function( - VecVecDMatch, int, ffi.Pointer)>(); + GMat, int, int, double, double, int, ffi.Pointer)>(); - void VecVecDMatch_Close( - VecVecDMatchPtr vec, + ffi.Pointer gapi_NV12toBGR( + GMat src_y, + GMat src_uv, + ffi.Pointer rval, ) { - return _VecVecDMatch_Close( - vec, + return _gapi_NV12toBGR( + src_y, + src_uv, + rval, ); } - late final _VecVecDMatch_ClosePtr = - _lookup>( - 'VecVecDMatch_Close'); - late final _VecVecDMatch_Close = - _VecVecDMatch_ClosePtr.asFunction(); + late final _gapi_NV12toBGRPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + GMat, GMat, ffi.Pointer)>>('gapi_NV12toBGR'); + late final _gapi_NV12toBGR = _gapi_NV12toBGRPtr.asFunction< + ffi.Pointer Function(GMat, GMat, ffi.Pointer)>(); - ffi.Pointer VecVecDMatch_Data( - VecVecDMatch vec, - ffi.Pointer> rval, + ffi.Pointer gapi_NV12toBGRp( + GMat src_y, + GMat src_uv, + ffi.Pointer rval, ) { - return _VecVecDMatch_Data( - vec, + return _gapi_NV12toBGRp( + src_y, + src_uv, rval, ); } - late final _VecVecDMatch_DataPtr = _lookup< + late final _gapi_NV12toBGRpPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(VecVecDMatch, - ffi.Pointer>)>>('VecVecDMatch_Data'); - late final _VecVecDMatch_Data = _VecVecDMatch_DataPtr.asFunction< - ffi.Pointer Function( - VecVecDMatch, ffi.Pointer>)>(); + ffi.Pointer Function( + GMat, GMat, ffi.Pointer)>>('gapi_NV12toBGRp'); + late final _gapi_NV12toBGRp = _gapi_NV12toBGRpPtr.asFunction< + ffi.Pointer Function(GMat, GMat, ffi.Pointer)>(); - ffi.Pointer VecVecDMatch_New( - ffi.Pointer rval, + ffi.Pointer gapi_NV12toGray( + GMat src_y, + GMat src_uv, + ffi.Pointer rval, ) { - return _VecVecDMatch_New( + return _gapi_NV12toGray( + src_y, + src_uv, rval, ); } - late final _VecVecDMatch_NewPtr = _lookup< + late final _gapi_NV12toGrayPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer)>>('VecVecDMatch_New'); - late final _VecVecDMatch_New = _VecVecDMatch_NewPtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + GMat, GMat, ffi.Pointer)>>('gapi_NV12toGray'); + late final _gapi_NV12toGray = _gapi_NV12toGrayPtr.asFunction< + ffi.Pointer Function(GMat, GMat, ffi.Pointer)>(); - ffi.Pointer VecVecDMatch_NewFromPointer( - ffi.Pointer matches, - int length, - ffi.Pointer rval, + ffi.Pointer gapi_NV12toRGB( + GMat src_y, + GMat src_uv, + ffi.Pointer rval, ) { - return _VecVecDMatch_NewFromPointer( - matches, - length, + return _gapi_NV12toRGB( + src_y, + src_uv, rval, ); } - late final _VecVecDMatch_NewFromPointerPtr = _lookup< + late final _gapi_NV12toRGBPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, ffi.Int, - ffi.Pointer)>>('VecVecDMatch_NewFromPointer'); - late final _VecVecDMatch_NewFromPointer = - _VecVecDMatch_NewFromPointerPtr.asFunction< ffi.Pointer Function( - ffi.Pointer, int, ffi.Pointer)>(); + GMat, GMat, ffi.Pointer)>>('gapi_NV12toRGB'); + late final _gapi_NV12toRGB = _gapi_NV12toRGBPtr.asFunction< + ffi.Pointer Function(GMat, GMat, ffi.Pointer)>(); - ffi.Pointer VecVecDMatch_NewFromVec( - VecVecDMatch vec, - ffi.Pointer rval, + ffi.Pointer gapi_NV12toRGBp( + GMat src_y, + GMat src_uv, + ffi.Pointer rval, ) { - return _VecVecDMatch_NewFromVec( - vec, + return _gapi_NV12toRGBp( + src_y, + src_uv, rval, ); } - late final _VecVecDMatch_NewFromVecPtr = _lookup< + late final _gapi_NV12toRGBpPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(VecVecDMatch, - ffi.Pointer)>>('VecVecDMatch_NewFromVec'); - late final _VecVecDMatch_NewFromVec = _VecVecDMatch_NewFromVecPtr.asFunction< - ffi.Pointer Function( - VecVecDMatch, ffi.Pointer)>(); + ffi.Pointer Function( + GMat, GMat, ffi.Pointer)>>('gapi_NV12toRGBp'); + late final _gapi_NV12toRGBp = _gapi_NV12toRGBpPtr.asFunction< + ffi.Pointer Function(GMat, GMat, ffi.Pointer)>(); - ffi.Pointer VecVecDMatch_Size( - VecVecDMatch vec, - ffi.Pointer rval, + ffi.Pointer gapi_RGB2Gray( + GMat src, + ffi.Pointer rval, ) { - return _VecVecDMatch_Size( - vec, + return _gapi_RGB2Gray( + src, rval, ); } - late final _VecVecDMatch_SizePtr = _lookup< + late final _gapi_RGB2GrayPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecVecDMatch, ffi.Pointer)>>('VecVecDMatch_Size'); - late final _VecVecDMatch_Size = _VecVecDMatch_SizePtr.asFunction< - ffi.Pointer Function(VecVecDMatch, ffi.Pointer)>(); + GMat, ffi.Pointer)>>('gapi_RGB2Gray'); + late final _gapi_RGB2Gray = _gapi_RGB2GrayPtr + .asFunction Function(GMat, ffi.Pointer)>(); - ffi.Pointer VecVecPoint2f_Append( - VecVecPoint2f vec, - VecPoint2f pv, + ffi.Pointer gapi_RGB2Gray_1( + GMat src, + double rY, + double gY, + double bY, + ffi.Pointer rval, ) { - return _VecVecPoint2f_Append( - vec, - pv, + return _gapi_RGB2Gray_1( + src, + rY, + gY, + bY, + rval, ); } - late final _VecVecPoint2f_AppendPtr = _lookup< + late final _gapi_RGB2Gray_1Ptr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - VecVecPoint2f, VecPoint2f)>>('VecVecPoint2f_Append'); - late final _VecVecPoint2f_Append = _VecVecPoint2f_AppendPtr.asFunction< - ffi.Pointer Function(VecVecPoint2f, VecPoint2f)>(); + ffi.Pointer Function(GMat, ffi.Float, ffi.Float, ffi.Float, + ffi.Pointer)>>('gapi_RGB2Gray_1'); + late final _gapi_RGB2Gray_1 = _gapi_RGB2Gray_1Ptr.asFunction< + ffi.Pointer Function( + GMat, double, double, double, ffi.Pointer)>(); - ffi.Pointer VecVecPoint2f_At( - VecVecPoint2f vec, - int idx, - ffi.Pointer rval, + ffi.Pointer gapi_RGB2HSV( + GMat src, + ffi.Pointer rval, ) { - return _VecVecPoint2f_At( - vec, - idx, + return _gapi_RGB2HSV( + src, rval, ); } - late final _VecVecPoint2f_AtPtr = _lookup< + late final _gapi_RGB2HSVPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(VecVecPoint2f, ffi.Int, - ffi.Pointer)>>('VecVecPoint2f_At'); - late final _VecVecPoint2f_At = _VecVecPoint2f_AtPtr.asFunction< - ffi.Pointer Function( - VecVecPoint2f, int, ffi.Pointer)>(); + ffi.Pointer Function( + GMat, ffi.Pointer)>>('gapi_RGB2HSV'); + late final _gapi_RGB2HSV = _gapi_RGB2HSVPtr + .asFunction Function(GMat, ffi.Pointer)>(); - void VecVecPoint2f_Close( - VecVecPoint2fPtr vec, + ffi.Pointer gapi_RGB2I420( + GMat src, + ffi.Pointer rval, ) { - return _VecVecPoint2f_Close( - vec, + return _gapi_RGB2I420( + src, + rval, ); } - late final _VecVecPoint2f_ClosePtr = - _lookup>( - 'VecVecPoint2f_Close'); - late final _VecVecPoint2f_Close = - _VecVecPoint2f_ClosePtr.asFunction(); + late final _gapi_RGB2I420Ptr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + GMat, ffi.Pointer)>>('gapi_RGB2I420'); + late final _gapi_RGB2I420 = _gapi_RGB2I420Ptr + .asFunction Function(GMat, ffi.Pointer)>(); - ffi.Pointer VecVecPoint2f_New( - ffi.Pointer rval, + ffi.Pointer gapi_RGB2Lab( + GMat src, + ffi.Pointer rval, ) { - return _VecVecPoint2f_New( + return _gapi_RGB2Lab( + src, rval, ); } - late final _VecVecPoint2f_NewPtr = _lookup< + late final _gapi_RGB2LabPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer)>>('VecVecPoint2f_New'); - late final _VecVecPoint2f_New = _VecVecPoint2f_NewPtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + GMat, ffi.Pointer)>>('gapi_RGB2Lab'); + late final _gapi_RGB2Lab = _gapi_RGB2LabPtr + .asFunction Function(GMat, ffi.Pointer)>(); - ffi.Pointer VecVecPoint2f_NewFromPointer( - ffi.Pointer points, - int length, - ffi.Pointer rval, + ffi.Pointer gapi_RGB2YUV( + GMat src, + ffi.Pointer rval, ) { - return _VecVecPoint2f_NewFromPointer( - points, - length, + return _gapi_RGB2YUV( + src, rval, ); } - late final _VecVecPoint2f_NewFromPointerPtr = _lookup< + late final _gapi_RGB2YUVPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, ffi.Int, - ffi.Pointer)>>('VecVecPoint2f_NewFromPointer'); - late final _VecVecPoint2f_NewFromPointer = - _VecVecPoint2f_NewFromPointerPtr.asFunction< ffi.Pointer Function( - ffi.Pointer, int, ffi.Pointer)>(); + GMat, ffi.Pointer)>>('gapi_RGB2YUV'); + late final _gapi_RGB2YUV = _gapi_RGB2YUVPtr + .asFunction Function(GMat, ffi.Pointer)>(); - ffi.Pointer VecVecPoint2f_NewFromVec( - VecVecPoint2f vec, - ffi.Pointer rval, + ffi.Pointer gapi_RGB2YUV422( + GMat src, + ffi.Pointer rval, ) { - return _VecVecPoint2f_NewFromVec( - vec, + return _gapi_RGB2YUV422( + src, rval, ); } - late final _VecVecPoint2f_NewFromVecPtr = _lookup< + late final _gapi_RGB2YUV422Ptr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(VecVecPoint2f, - ffi.Pointer)>>('VecVecPoint2f_NewFromVec'); - late final _VecVecPoint2f_NewFromVec = - _VecVecPoint2f_NewFromVecPtr.asFunction< ffi.Pointer Function( - VecVecPoint2f, ffi.Pointer)>(); + GMat, ffi.Pointer)>>('gapi_RGB2YUV422'); + late final _gapi_RGB2YUV422 = _gapi_RGB2YUV422Ptr + .asFunction Function(GMat, ffi.Pointer)>(); - ffi.Pointer VecVecPoint2f_Size( - VecVecPoint2f vec, - ffi.Pointer rval, + ffi.Pointer gapi_Sobel( + GMat src, + int ddepth, + int dx, + int dy, + int ksize, + double scale, + double delta, + int borderType, + Scalar borderValue, + ffi.Pointer rval, ) { - return _VecVecPoint2f_Size( - vec, + return _gapi_Sobel( + src, + ddepth, + dx, + dy, + ksize, + scale, + delta, + borderType, + borderValue, rval, ); } - late final _VecVecPoint2f_SizePtr = _lookup< + late final _gapi_SobelPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecVecPoint2f, ffi.Pointer)>>('VecVecPoint2f_Size'); - late final _VecVecPoint2f_Size = _VecVecPoint2f_SizePtr.asFunction< - ffi.Pointer Function(VecVecPoint2f, ffi.Pointer)>(); + GMat, + ffi.Int, + ffi.Int, + ffi.Int, + ffi.Int, + ffi.Double, + ffi.Double, + ffi.Int, + Scalar, + ffi.Pointer)>>('gapi_Sobel'); + late final _gapi_Sobel = _gapi_SobelPtr.asFunction< + ffi.Pointer Function(GMat, int, int, int, int, double, double, + int, Scalar, ffi.Pointer)>(); - ffi.Pointer VecVecPoint3f_Append( - VecVecPoint3f vec, - VecPoint3f pv, + ffi.Pointer gapi_SobelXY( + GMat src, + int ddepth, + int order, + int ksize, + double scale, + double delta, + int borderType, + Scalar borderValue, + ffi.Pointer rval, + ffi.Pointer rval1, ) { - return _VecVecPoint3f_Append( - vec, - pv, + return _gapi_SobelXY( + src, + ddepth, + order, + ksize, + scale, + delta, + borderType, + borderValue, + rval, + rval1, ); } - late final _VecVecPoint3f_AppendPtr = _lookup< + late final _gapi_SobelXYPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecVecPoint3f, VecPoint3f)>>('VecVecPoint3f_Append'); - late final _VecVecPoint3f_Append = _VecVecPoint3f_AppendPtr.asFunction< - ffi.Pointer Function(VecVecPoint3f, VecPoint3f)>(); + GMat, + ffi.Int, + ffi.Int, + ffi.Int, + ffi.Double, + ffi.Double, + ffi.Int, + Scalar, + ffi.Pointer, + ffi.Pointer)>>('gapi_SobelXY'); + late final _gapi_SobelXY = _gapi_SobelXYPtr.asFunction< + ffi.Pointer Function(GMat, int, int, int, double, double, int, + Scalar, ffi.Pointer, ffi.Pointer)>(); - ffi.Pointer VecVecPoint3f_At( - VecVecPoint3f vec, - int idx, - ffi.Pointer rval, + ffi.Pointer gapi_YUV2BGR( + GMat src, + ffi.Pointer rval, ) { - return _VecVecPoint3f_At( - vec, - idx, + return _gapi_YUV2BGR( + src, rval, ); } - late final _VecVecPoint3f_AtPtr = _lookup< + late final _gapi_YUV2BGRPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(VecVecPoint3f, ffi.Int, - ffi.Pointer)>>('VecVecPoint3f_At'); - late final _VecVecPoint3f_At = _VecVecPoint3f_AtPtr.asFunction< - ffi.Pointer Function( - VecVecPoint3f, int, ffi.Pointer)>(); + ffi.Pointer Function( + GMat, ffi.Pointer)>>('gapi_YUV2BGR'); + late final _gapi_YUV2BGR = _gapi_YUV2BGRPtr + .asFunction Function(GMat, ffi.Pointer)>(); - void VecVecPoint3f_Close( - VecVecPoint3fPtr vec, + ffi.Pointer gapi_YUV2RGB( + GMat src, + ffi.Pointer rval, ) { - return _VecVecPoint3f_Close( - vec, + return _gapi_YUV2RGB( + src, + rval, ); } - late final _VecVecPoint3f_ClosePtr = - _lookup>( - 'VecVecPoint3f_Close'); - late final _VecVecPoint3f_Close = - _VecVecPoint3f_ClosePtr.asFunction(); + late final _gapi_YUV2RGBPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + GMat, ffi.Pointer)>>('gapi_YUV2RGB'); + late final _gapi_YUV2RGB = _gapi_YUV2RGBPtr + .asFunction Function(GMat, ffi.Pointer)>(); - ffi.Pointer VecVecPoint3f_New( - ffi.Pointer rval, + ffi.Pointer gapi_add( + GMat src1, + GMat src2, + int ddepth, + ffi.Pointer rval, ) { - return _VecVecPoint3f_New( + return _gapi_add( + src1, + src2, + ddepth, rval, ); } - late final _VecVecPoint3f_NewPtr = _lookup< + late final _gapi_addPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer)>>('VecVecPoint3f_New'); - late final _VecVecPoint3f_New = _VecVecPoint3f_NewPtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + GMat, GMat, ffi.Int, ffi.Pointer)>>('gapi_add'); + late final _gapi_add = _gapi_addPtr.asFunction< + ffi.Pointer Function(GMat, GMat, int, ffi.Pointer)>(); - ffi.Pointer VecVecPoint3f_NewFromPointer( - ffi.Pointer points, - int length, - ffi.Pointer rval, + ffi.Pointer gapi_addC( + GMat src, + GScalar c, + int ddepth, + ffi.Pointer rval, ) { - return _VecVecPoint3f_NewFromPointer( - points, - length, + return _gapi_addC( + src, + c, + ddepth, rval, ); } - late final _VecVecPoint3f_NewFromPointerPtr = _lookup< + late final _gapi_addCPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, ffi.Int, - ffi.Pointer)>>('VecVecPoint3f_NewFromPointer'); - late final _VecVecPoint3f_NewFromPointer = - _VecVecPoint3f_NewFromPointerPtr.asFunction< ffi.Pointer Function( - ffi.Pointer, int, ffi.Pointer)>(); + GMat, GScalar, ffi.Int, ffi.Pointer)>>('gapi_addC'); + late final _gapi_addC = _gapi_addCPtr.asFunction< + ffi.Pointer Function(GMat, GScalar, int, ffi.Pointer)>(); - ffi.Pointer VecVecPoint3f_NewFromVec( - VecVecPoint3f vec, - ffi.Pointer rval, + ffi.Pointer gapi_addC_1( + GScalar c, + GMat src, + int ddepth, + ffi.Pointer rval, ) { - return _VecVecPoint3f_NewFromVec( - vec, + return _gapi_addC_1( + c, + src, + ddepth, rval, ); } - late final _VecVecPoint3f_NewFromVecPtr = _lookup< + late final _gapi_addC_1Ptr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(VecVecPoint3f, - ffi.Pointer)>>('VecVecPoint3f_NewFromVec'); - late final _VecVecPoint3f_NewFromVec = - _VecVecPoint3f_NewFromVecPtr.asFunction< ffi.Pointer Function( - VecVecPoint3f, ffi.Pointer)>(); + GScalar, GMat, ffi.Int, ffi.Pointer)>>('gapi_addC_1'); + late final _gapi_addC_1 = _gapi_addC_1Ptr.asFunction< + ffi.Pointer Function(GScalar, GMat, int, ffi.Pointer)>(); - ffi.Pointer VecVecPoint3f_Size( - VecVecPoint3f vec, - ffi.Pointer rval, + ffi.Pointer gapi_bilateralFilter( + GMat src, + int d, + double sigmaColor, + double sigmaSpace, + int borderType, + ffi.Pointer rval, ) { - return _VecVecPoint3f_Size( - vec, + return _gapi_bilateralFilter( + src, + d, + sigmaColor, + sigmaSpace, + borderType, rval, ); } - late final _VecVecPoint3f_SizePtr = _lookup< + late final _gapi_bilateralFilterPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - VecVecPoint3f, ffi.Pointer)>>('VecVecPoint3f_Size'); - late final _VecVecPoint3f_Size = _VecVecPoint3f_SizePtr.asFunction< - ffi.Pointer Function(VecVecPoint3f, ffi.Pointer)>(); + ffi.Pointer Function(GMat, ffi.Int, ffi.Double, ffi.Double, + ffi.Int, ffi.Pointer)>>('gapi_bilateralFilter'); + late final _gapi_bilateralFilter = _gapi_bilateralFilterPtr.asFunction< + ffi.Pointer Function( + GMat, int, double, double, int, ffi.Pointer)>(); - ffi.Pointer VecVecPoint_Append( - VecVecPoint vec, - VecPoint pv, + ffi.Pointer gapi_blur( + GMat src, + Size ksize, + Point anchor, + int borderType, + Scalar borderValue, + ffi.Pointer rval, ) { - return _VecVecPoint_Append( - vec, - pv, + return _gapi_blur( + src, + ksize, + anchor, + borderType, + borderValue, + rval, ); } - late final _VecVecPoint_AppendPtr = _lookup< + late final _gapi_blurPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - VecVecPoint, VecPoint)>>('VecVecPoint_Append'); - late final _VecVecPoint_Append = _VecVecPoint_AppendPtr.asFunction< - ffi.Pointer Function(VecVecPoint, VecPoint)>(); + ffi.Pointer Function(GMat, Size, Point, ffi.Int, Scalar, + ffi.Pointer)>>('gapi_blur'); + late final _gapi_blur = _gapi_blurPtr.asFunction< + ffi.Pointer Function( + GMat, Size, Point, int, Scalar, ffi.Pointer)>(); - ffi.Pointer VecVecPoint_At( - VecVecPoint vec, - int idx, - ffi.Pointer rval, + ffi.Pointer gapi_boundingRect( + GArrayPoint2f src, + ffi.Pointer rval, ) { - return _VecVecPoint_At( - vec, - idx, + return _gapi_boundingRect( + src, rval, ); } - late final _VecVecPoint_AtPtr = _lookup< + late final _gapi_boundingRectPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecVecPoint, ffi.Int, ffi.Pointer)>>('VecVecPoint_At'); - late final _VecVecPoint_At = _VecVecPoint_AtPtr.asFunction< + GArrayPoint2f, ffi.Pointer)>>('gapi_boundingRect'); + late final _gapi_boundingRect = _gapi_boundingRectPtr.asFunction< ffi.Pointer Function( - VecVecPoint, int, ffi.Pointer)>(); + GArrayPoint2f, ffi.Pointer)>(); - void VecVecPoint_Close( - VecVecPointPtr vec, + ffi.Pointer gapi_boundingRect_1( + GArrayPoint2i src, + ffi.Pointer rval, ) { - return _VecVecPoint_Close( - vec, + return _gapi_boundingRect_1( + src, + rval, ); } - late final _VecVecPoint_ClosePtr = - _lookup>( - 'VecVecPoint_Close'); - late final _VecVecPoint_Close = - _VecVecPoint_ClosePtr.asFunction(); + late final _gapi_boundingRect_1Ptr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + GArrayPoint2i, ffi.Pointer)>>('gapi_boundingRect_1'); + late final _gapi_boundingRect_1 = _gapi_boundingRect_1Ptr.asFunction< + ffi.Pointer Function( + GArrayPoint2i, ffi.Pointer)>(); - ffi.Pointer VecVecPoint_New( - ffi.Pointer rval, + ffi.Pointer gapi_boundingRect_2( + GMat src, + ffi.Pointer rval, ) { - return _VecVecPoint_New( + return _gapi_boundingRect_2( + src, rval, ); } - late final _VecVecPoint_NewPtr = _lookup< + late final _gapi_boundingRect_2Ptr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer)>>('VecVecPoint_New'); - late final _VecVecPoint_New = _VecVecPoint_NewPtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + GMat, ffi.Pointer)>>('gapi_boundingRect_2'); + late final _gapi_boundingRect_2 = _gapi_boundingRect_2Ptr.asFunction< + ffi.Pointer Function(GMat, ffi.Pointer)>(); - ffi.Pointer VecVecPoint_NewFromPointer( - ffi.Pointer points, - int length, - ffi.Pointer rval, + ffi.Pointer gapi_boxFilter( + GMat src, + int dtype, + Size ksize, + Point anchor, + bool normalize, + int borderType, + Scalar borderValue, + ffi.Pointer rval, ) { - return _VecVecPoint_NewFromPointer( - points, - length, + return _gapi_boxFilter( + src, + dtype, + ksize, + anchor, + normalize, + borderType, + borderValue, rval, ); } - late final _VecVecPoint_NewFromPointerPtr = _lookup< + late final _gapi_boxFilterPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, ffi.Int, - ffi.Pointer)>>('VecVecPoint_NewFromPointer'); - late final _VecVecPoint_NewFromPointer = - _VecVecPoint_NewFromPointerPtr.asFunction< - ffi.Pointer Function( - ffi.Pointer, int, ffi.Pointer)>(); + ffi.Pointer Function(GMat, ffi.Int, Size, Point, ffi.Bool, + ffi.Int, Scalar, ffi.Pointer)>>('gapi_boxFilter'); + late final _gapi_boxFilter = _gapi_boxFilterPtr.asFunction< + ffi.Pointer Function( + GMat, int, Size, Point, bool, int, Scalar, ffi.Pointer)>(); - ffi.Pointer VecVecPoint_NewFromVec( - VecVecPoint vec, - ffi.Pointer rval, + ffi.Pointer gapi_cartToPolar( + GMat x, + GMat y, + bool angleInDegrees, + ffi.Pointer rval, + ffi.Pointer rval1, ) { - return _VecVecPoint_NewFromVec( - vec, + return _gapi_cartToPolar( + x, + y, + angleInDegrees, rval, + rval1, ); } - late final _VecVecPoint_NewFromVecPtr = _lookup< + late final _gapi_cartToPolarPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(VecVecPoint, - ffi.Pointer)>>('VecVecPoint_NewFromVec'); - late final _VecVecPoint_NewFromVec = _VecVecPoint_NewFromVecPtr.asFunction< - ffi.Pointer Function(VecVecPoint, ffi.Pointer)>(); + ffi.Pointer Function(GMat, GMat, ffi.Bool, + ffi.Pointer, ffi.Pointer)>>('gapi_cartToPolar'); + late final _gapi_cartToPolar = _gapi_cartToPolarPtr.asFunction< + ffi.Pointer Function( + GMat, GMat, bool, ffi.Pointer, ffi.Pointer)>(); - ffi.Pointer VecVecPoint_Size( - VecVecPoint vec, - ffi.Pointer rval, + ffi.Pointer gapi_concatHor( + GMat src1, + GMat src2, + ffi.Pointer rval, ) { - return _VecVecPoint_Size( - vec, + return _gapi_concatHor( + src1, + src2, rval, ); } - late final _VecVecPoint_SizePtr = _lookup< + late final _gapi_concatHorPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VecVecPoint, ffi.Pointer)>>('VecVecPoint_Size'); - late final _VecVecPoint_Size = _VecVecPoint_SizePtr.asFunction< - ffi.Pointer Function(VecVecPoint, ffi.Pointer)>(); + GMat, GMat, ffi.Pointer)>>('gapi_concatHor'); + late final _gapi_concatHor = _gapi_concatHorPtr.asFunction< + ffi.Pointer Function(GMat, GMat, ffi.Pointer)>(); - void VideoCapture_Close( - VideoCapturePtr self, + ffi.Pointer gapi_concatVert( + GMat src1, + GMat src2, + ffi.Pointer rval, ) { - return _VideoCapture_Close( - self, + return _gapi_concatVert( + src1, + src2, + rval, ); } - late final _VideoCapture_ClosePtr = - _lookup>( - 'VideoCapture_Close'); - late final _VideoCapture_Close = - _VideoCapture_ClosePtr.asFunction(); + late final _gapi_concatVertPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + GMat, GMat, ffi.Pointer)>>('gapi_concatVert'); + late final _gapi_concatVert = _gapi_concatVertPtr.asFunction< + ffi.Pointer Function(GMat, GMat, ffi.Pointer)>(); - ffi.Pointer VideoCapture_Get( - VideoCapture self, - int prop, - ffi.Pointer rval, + ffi.Pointer gapi_convertTo( + GMat src, + int rdepth, + double alpha, + double beta, + ffi.Pointer rval, ) { - return _VideoCapture_Get( - self, - prop, + return _gapi_convertTo( + src, + rdepth, + alpha, + beta, rval, ); } - late final _VideoCapture_GetPtr = _lookup< + late final _gapi_convertToPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(VideoCapture, ffi.Int, - ffi.Pointer)>>('VideoCapture_Get'); - late final _VideoCapture_Get = _VideoCapture_GetPtr.asFunction< + ffi.Pointer Function(GMat, ffi.Int, ffi.Double, ffi.Double, + ffi.Pointer)>>('gapi_convertTo'); + late final _gapi_convertTo = _gapi_convertToPtr.asFunction< ffi.Pointer Function( - VideoCapture, int, ffi.Pointer)>(); + GMat, int, double, double, ffi.Pointer)>(); - ffi.Pointer VideoCapture_Grab( - VideoCapture self, - int skip, + ffi.Pointer gapi_copy_1( + GMat in1, + ffi.Pointer rval, ) { - return _VideoCapture_Grab( - self, - skip, + return _gapi_copy_1( + in1, + rval, ); } - late final _VideoCapture_GrabPtr = _lookup< + late final _gapi_copy_1Ptr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VideoCapture, ffi.Int)>>('VideoCapture_Grab'); - late final _VideoCapture_Grab = _VideoCapture_GrabPtr.asFunction< - ffi.Pointer Function(VideoCapture, int)>(); + GMat, ffi.Pointer)>>('gapi_copy_1'); + late final _gapi_copy_1 = _gapi_copy_1Ptr + .asFunction Function(GMat, ffi.Pointer)>(); - ffi.Pointer VideoCapture_IsOpened( - VideoCapture self, - ffi.Pointer rval, + ffi.Pointer gapi_crop( + GMat src, + Rect rect, + ffi.Pointer rval, ) { - return _VideoCapture_IsOpened( - self, + return _gapi_crop( + src, + rect, rval, ); } - late final _VideoCapture_IsOpenedPtr = _lookup< + late final _gapi_cropPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VideoCapture, ffi.Pointer)>>('VideoCapture_IsOpened'); - late final _VideoCapture_IsOpened = _VideoCapture_IsOpenedPtr.asFunction< - ffi.Pointer Function(VideoCapture, ffi.Pointer)>(); + GMat, Rect, ffi.Pointer)>>('gapi_crop'); + late final _gapi_crop = _gapi_cropPtr.asFunction< + ffi.Pointer Function(GMat, Rect, ffi.Pointer)>(); - ffi.Pointer VideoCapture_New( - ffi.Pointer rval, + ffi.Pointer gapi_dilate( + GMat src, + Mat kernel, + Point anchor, + int iterations, + int borderType, + Scalar borderValue, + ffi.Pointer rval, ) { - return _VideoCapture_New( + return _gapi_dilate( + src, + kernel, + anchor, + iterations, + borderType, + borderValue, rval, ); } - late final _VideoCapture_NewPtr = _lookup< + late final _gapi_dilatePtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>>('VideoCapture_New'); - late final _VideoCapture_New = _VideoCapture_NewPtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + ffi.Pointer Function(GMat, Mat, Point, ffi.Int, ffi.Int, + Scalar, ffi.Pointer)>>('gapi_dilate'); + late final _gapi_dilate = _gapi_dilatePtr.asFunction< + ffi.Pointer Function( + GMat, Mat, Point, int, int, Scalar, ffi.Pointer)>(); - ffi.Pointer VideoCapture_NewFromFile( - ffi.Pointer filename, - int apiPreference, - ffi.Pointer rval, + ffi.Pointer gapi_dilate3x3( + GMat src, + int iterations, + int borderType, + Scalar borderValue, + ffi.Pointer rval, ) { - return _VideoCapture_NewFromFile( - filename, - apiPreference, + return _gapi_dilate3x3( + src, + iterations, + borderType, + borderValue, rval, ); } - late final _VideoCapture_NewFromFilePtr = _lookup< + late final _gapi_dilate3x3Ptr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, ffi.Int, - ffi.Pointer)>>('VideoCapture_NewFromFile'); - late final _VideoCapture_NewFromFile = - _VideoCapture_NewFromFilePtr.asFunction< - ffi.Pointer Function( - ffi.Pointer, int, ffi.Pointer)>(); + ffi.Pointer Function(GMat, ffi.Int, ffi.Int, Scalar, + ffi.Pointer)>>('gapi_dilate3x3'); + late final _gapi_dilate3x3 = _gapi_dilate3x3Ptr.asFunction< + ffi.Pointer Function( + GMat, int, int, Scalar, ffi.Pointer)>(); - ffi.Pointer VideoCapture_NewFromIndex( - int index, - int apiPreference, - ffi.Pointer rval, + ffi.Pointer gapi_div( + GMat src1, + GMat src2, + double scale, + int ddepth, + ffi.Pointer rval, ) { - return _VideoCapture_NewFromIndex( - index, - apiPreference, + return _gapi_div( + src1, + src2, + scale, + ddepth, rval, ); } - late final _VideoCapture_NewFromIndexPtr = _lookup< + late final _gapi_divPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Int, ffi.Int, - ffi.Pointer)>>('VideoCapture_NewFromIndex'); - late final _VideoCapture_NewFromIndex = - _VideoCapture_NewFromIndexPtr.asFunction< ffi.Pointer Function( - int, int, ffi.Pointer)>(); + GMat, GMat, ffi.Double, ffi.Int, ffi.Pointer)>>('gapi_div'); + late final _gapi_div = _gapi_divPtr.asFunction< + ffi.Pointer Function( + GMat, GMat, double, int, ffi.Pointer)>(); - ffi.Pointer VideoCapture_Open( - VideoCapture self, - ffi.Pointer uri, - ffi.Pointer rval, + ffi.Pointer gapi_divC( + GMat src, + GScalar divisor, + double scale, + int ddepth, + ffi.Pointer rval, ) { - return _VideoCapture_Open( - self, - uri, + return _gapi_divC( + src, + divisor, + scale, + ddepth, rval, ); } - late final _VideoCapture_OpenPtr = _lookup< + late final _gapi_divCPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(VideoCapture, ffi.Pointer, - ffi.Pointer)>>('VideoCapture_Open'); - late final _VideoCapture_Open = _VideoCapture_OpenPtr.asFunction< + ffi.Pointer Function(GMat, GScalar, ffi.Double, ffi.Int, + ffi.Pointer)>>('gapi_divC'); + late final _gapi_divC = _gapi_divCPtr.asFunction< ffi.Pointer Function( - VideoCapture, ffi.Pointer, ffi.Pointer)>(); + GMat, GScalar, double, int, ffi.Pointer)>(); - ffi.Pointer VideoCapture_OpenDevice( - VideoCapture self, - int device, - ffi.Pointer rval, + ffi.Pointer gapi_divRC( + GScalar divident, + GMat src, + double scale, + int ddepth, + ffi.Pointer rval, ) { - return _VideoCapture_OpenDevice( - self, - device, + return _gapi_divRC( + divident, + src, + scale, + ddepth, rval, ); } - late final _VideoCapture_OpenDevicePtr = _lookup< + late final _gapi_divRCPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(VideoCapture, ffi.Int, - ffi.Pointer)>>('VideoCapture_OpenDevice'); - late final _VideoCapture_OpenDevice = _VideoCapture_OpenDevicePtr.asFunction< + ffi.Pointer Function(GScalar, GMat, ffi.Double, ffi.Int, + ffi.Pointer)>>('gapi_divRC'); + late final _gapi_divRC = _gapi_divRCPtr.asFunction< ffi.Pointer Function( - VideoCapture, int, ffi.Pointer)>(); + GScalar, GMat, double, int, ffi.Pointer)>(); - ffi.Pointer VideoCapture_OpenDeviceWithAPI( - VideoCapture self, - int device, - int apiPreference, - ffi.Pointer rval, + ffi.Pointer gapi_erode( + GMat src, + Mat kernel, + Point anchor, + int iterations, + int borderType, + Scalar borderValue, + ffi.Pointer rval, ) { - return _VideoCapture_OpenDeviceWithAPI( - self, - device, - apiPreference, + return _gapi_erode( + src, + kernel, + anchor, + iterations, + borderType, + borderValue, rval, ); } - late final _VideoCapture_OpenDeviceWithAPIPtr = _lookup< + late final _gapi_erodePtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(VideoCapture, ffi.Int, ffi.Int, - ffi.Pointer)>>('VideoCapture_OpenDeviceWithAPI'); - late final _VideoCapture_OpenDeviceWithAPI = - _VideoCapture_OpenDeviceWithAPIPtr.asFunction< - ffi.Pointer Function( - VideoCapture, int, int, ffi.Pointer)>(); + ffi.Pointer Function(GMat, Mat, Point, ffi.Int, ffi.Int, + Scalar, ffi.Pointer)>>('gapi_erode'); + late final _gapi_erode = _gapi_erodePtr.asFunction< + ffi.Pointer Function( + GMat, Mat, Point, int, int, Scalar, ffi.Pointer)>(); - ffi.Pointer VideoCapture_OpenWithAPI( - VideoCapture self, - ffi.Pointer uri, - int apiPreference, - ffi.Pointer rval, + ffi.Pointer gapi_erode3x3( + GMat src, + int iterations, + int borderType, + Scalar borderValue, + ffi.Pointer rval, ) { - return _VideoCapture_OpenWithAPI( - self, - uri, - apiPreference, + return _gapi_erode3x3( + src, + iterations, + borderType, + borderValue, rval, ); } - late final _VideoCapture_OpenWithAPIPtr = _lookup< + late final _gapi_erode3x3Ptr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(VideoCapture, ffi.Pointer, - ffi.Int, ffi.Pointer)>>('VideoCapture_OpenWithAPI'); - late final _VideoCapture_OpenWithAPI = - _VideoCapture_OpenWithAPIPtr.asFunction< - ffi.Pointer Function(VideoCapture, ffi.Pointer, - int, ffi.Pointer)>(); + ffi.Pointer Function(GMat, ffi.Int, ffi.Int, Scalar, + ffi.Pointer)>>('gapi_erode3x3'); + late final _gapi_erode3x3 = _gapi_erode3x3Ptr.asFunction< + ffi.Pointer Function( + GMat, int, int, Scalar, ffi.Pointer)>(); - ffi.Pointer VideoCapture_Read( - VideoCapture self, - Mat buf, - ffi.Pointer rval, + ffi.Pointer gapi_filter2D( + GMat src, + int ddepth, + Mat kernel, + Point anchor, + Scalar delta, + int borderType, + Scalar borderValue, + ffi.Pointer rval, ) { - return _VideoCapture_Read( - self, - buf, + return _gapi_filter2D( + src, + ddepth, + kernel, + anchor, + delta, + borderType, + borderValue, rval, ); } - late final _VideoCapture_ReadPtr = _lookup< + late final _gapi_filter2DPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - VideoCapture, Mat, ffi.Pointer)>>('VideoCapture_Read'); - late final _VideoCapture_Read = _VideoCapture_ReadPtr.asFunction< + ffi.Pointer Function(GMat, ffi.Int, Mat, Point, Scalar, + ffi.Int, Scalar, ffi.Pointer)>>('gapi_filter2D'); + late final _gapi_filter2D = _gapi_filter2DPtr.asFunction< ffi.Pointer Function( - VideoCapture, Mat, ffi.Pointer)>(); + GMat, int, Mat, Point, Scalar, int, Scalar, ffi.Pointer)>(); - ffi.Pointer VideoCapture_Release( - VideoCapture self, - ) { - return _VideoCapture_Release( - self, + ffi.Pointer gapi_findContours( + GMat src, + int mode, + int method, + ffi.Pointer rval, + ) { + return _gapi_findContours( + src, + mode, + method, + rval, ); } - late final _VideoCapture_ReleasePtr = - _lookup Function(VideoCapture)>>( - 'VideoCapture_Release'); - late final _VideoCapture_Release = _VideoCapture_ReleasePtr.asFunction< - ffi.Pointer Function(VideoCapture)>(); + late final _gapi_findContoursPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(GMat, ffi.Int, ffi.Int, + ffi.Pointer)>>('gapi_findContours'); + late final _gapi_findContours = _gapi_findContoursPtr.asFunction< + ffi.Pointer Function( + GMat, int, int, ffi.Pointer)>(); - ffi.Pointer VideoCapture_Set( - VideoCapture self, - int prop, - double param, + ffi.Pointer gapi_findContoursH( + GMat src, + int mode, + int method, + ffi.Pointer rval, + ffi.Pointer rval1, ) { - return _VideoCapture_Set( - self, - prop, - param, + return _gapi_findContoursH( + src, + mode, + method, + rval, + rval1, ); } - late final _VideoCapture_SetPtr = _lookup< + late final _gapi_findContoursHPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VideoCapture, ffi.Int, ffi.Double)>>('VideoCapture_Set'); - late final _VideoCapture_Set = _VideoCapture_SetPtr.asFunction< - ffi.Pointer Function(VideoCapture, int, double)>(); - - void VideoWriter_Close( - VideoWriterPtr self, + GMat, + ffi.Int, + ffi.Int, + ffi.Pointer, + ffi.Pointer)>>('gapi_findContoursH'); + late final _gapi_findContoursH = _gapi_findContoursHPtr.asFunction< + ffi.Pointer Function(GMat, int, int, + ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer gapi_findContoursH_1( + GMat src, + int mode, + int method, + GOpaquePoint offset, + ffi.Pointer rval, + ffi.Pointer rval1, ) { - return _VideoWriter_Close( - self, + return _gapi_findContoursH_1( + src, + mode, + method, + offset, + rval, + rval1, ); } - late final _VideoWriter_ClosePtr = - _lookup>( - 'VideoWriter_Close'); - late final _VideoWriter_Close = - _VideoWriter_ClosePtr.asFunction(); - - ffi.Pointer VideoWriter_Fourcc( - int c1, - int c2, - int c3, - int c4, - ffi.Pointer rval, + late final _gapi_findContoursH_1Ptr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + GMat, + ffi.Int, + ffi.Int, + GOpaquePoint, + ffi.Pointer, + ffi.Pointer)>>('gapi_findContoursH_1'); + late final _gapi_findContoursH_1 = _gapi_findContoursH_1Ptr.asFunction< + ffi.Pointer Function(GMat, int, int, GOpaquePoint, + ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer gapi_findContours_1( + GMat src, + int mode, + int method, + GOpaquePoint offset, + ffi.Pointer rval, ) { - return _VideoWriter_Fourcc( - c1, - c2, - c3, - c4, + return _gapi_findContours_1( + src, + mode, + method, + offset, rval, ); } - late final _VideoWriter_FourccPtr = _lookup< + late final _gapi_findContours_1Ptr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Char, ffi.Char, ffi.Char, ffi.Char, - ffi.Pointer)>>('VideoWriter_Fourcc'); - late final _VideoWriter_Fourcc = _VideoWriter_FourccPtr.asFunction< + ffi.Pointer Function(GMat, ffi.Int, ffi.Int, GOpaquePoint, + ffi.Pointer)>>('gapi_findContours_1'); + late final _gapi_findContours_1 = _gapi_findContours_1Ptr.asFunction< ffi.Pointer Function( - int, int, int, int, ffi.Pointer)>(); + GMat, int, int, GOpaquePoint, ffi.Pointer)>(); - ffi.Pointer VideoWriter_IsOpened( - VideoWriter self, - ffi.Pointer rval, + ffi.Pointer gapi_fitLine2D( + GArrayPoint2d src, + int distType, + double param, + double reps, + double aeps, + ffi.Pointer rval, ) { - return _VideoWriter_IsOpened( - self, + return _gapi_fitLine2D( + src, + distType, + param, + reps, + aeps, rval, ); } - late final _VideoWriter_IsOpenedPtr = _lookup< + late final _gapi_fitLine2DPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VideoWriter, ffi.Pointer)>>('VideoWriter_IsOpened'); - late final _VideoWriter_IsOpened = _VideoWriter_IsOpenedPtr.asFunction< - ffi.Pointer Function(VideoWriter, ffi.Pointer)>(); + GArrayPoint2d, + ffi.Int, + ffi.Double, + ffi.Double, + ffi.Double, + ffi.Pointer)>>('gapi_fitLine2D'); + late final _gapi_fitLine2D = _gapi_fitLine2DPtr.asFunction< + ffi.Pointer Function(GArrayPoint2d, int, double, double, double, + ffi.Pointer)>(); - ffi.Pointer VideoWriter_New( - ffi.Pointer rval, + ffi.Pointer gapi_fitLine2D_1( + GArrayPoint2f src, + int distType, + double param, + double reps, + double aeps, + ffi.Pointer rval, ) { - return _VideoWriter_New( + return _gapi_fitLine2D_1( + src, + distType, + param, + reps, + aeps, rval, ); } - late final _VideoWriter_NewPtr = _lookup< + late final _gapi_fitLine2D_1Ptr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer)>>('VideoWriter_New'); - late final _VideoWriter_New = _VideoWriter_NewPtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + GArrayPoint2f, + ffi.Int, + ffi.Double, + ffi.Double, + ffi.Double, + ffi.Pointer)>>('gapi_fitLine2D_1'); + late final _gapi_fitLine2D_1 = _gapi_fitLine2D_1Ptr.asFunction< + ffi.Pointer Function(GArrayPoint2f, int, double, double, double, + ffi.Pointer)>(); - ffi.Pointer VideoWriter_Open( - VideoWriter self, - ffi.Pointer name, - ffi.Pointer codec, - double fps, - int width, - int height, - bool isColor, + ffi.Pointer gapi_fitLine2D_2( + GArrayPoint2i src, + int distType, + double param, + double reps, + double aeps, + ffi.Pointer rval, ) { - return _VideoWriter_Open( - self, - name, - codec, - fps, - width, - height, - isColor, + return _gapi_fitLine2D_2( + src, + distType, + param, + reps, + aeps, + rval, ); } - late final _VideoWriter_OpenPtr = _lookup< + late final _gapi_fitLine2D_2Ptr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - VideoWriter, - ffi.Pointer, - ffi.Pointer, - ffi.Double, - ffi.Int, + GArrayPoint2i, ffi.Int, - ffi.Bool)>>('VideoWriter_Open'); - late final _VideoWriter_Open = _VideoWriter_OpenPtr.asFunction< - ffi.Pointer Function(VideoWriter, ffi.Pointer, - ffi.Pointer, double, int, int, bool)>(); + ffi.Double, + ffi.Double, + ffi.Double, + ffi.Pointer)>>('gapi_fitLine2D_2'); + late final _gapi_fitLine2D_2 = _gapi_fitLine2D_2Ptr.asFunction< + ffi.Pointer Function(GArrayPoint2i, int, double, double, double, + ffi.Pointer)>(); - ffi.Pointer VideoWriter_Release( - VideoWriter self, + ffi.Pointer gapi_fitLine2D_3( + GMat src, + int distType, + double param, + double reps, + double aeps, + ffi.Pointer rval, ) { - return _VideoWriter_Release( - self, + return _gapi_fitLine2D_3( + src, + distType, + param, + reps, + aeps, + rval, ); } - late final _VideoWriter_ReleasePtr = - _lookup Function(VideoWriter)>>( - 'VideoWriter_Release'); - late final _VideoWriter_Release = _VideoWriter_ReleasePtr.asFunction< - ffi.Pointer Function(VideoWriter)>(); + late final _gapi_fitLine2D_3Ptr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(GMat, ffi.Int, ffi.Double, ffi.Double, + ffi.Double, ffi.Pointer)>>('gapi_fitLine2D_3'); + late final _gapi_fitLine2D_3 = _gapi_fitLine2D_3Ptr.asFunction< + ffi.Pointer Function( + GMat, int, double, double, double, ffi.Pointer)>(); - ffi.Pointer VideoWriter_Write( - VideoWriter self, - Mat img, + ffi.Pointer gapi_fitLine3D_1( + GArrayPoint3d src, + int distType, + double param, + double reps, + double aeps, + ffi.Pointer rval, ) { - return _VideoWriter_Write( - self, - img, + return _gapi_fitLine3D_1( + src, + distType, + param, + reps, + aeps, + rval, ); } - late final _VideoWriter_WritePtr = _lookup< - ffi.NativeFunction Function(VideoWriter, Mat)>>( - 'VideoWriter_Write'); - late final _VideoWriter_Write = _VideoWriter_WritePtr.asFunction< - ffi.Pointer Function(VideoWriter, Mat)>(); + late final _gapi_fitLine3D_1Ptr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + GArrayPoint3d, + ffi.Int, + ffi.Double, + ffi.Double, + ffi.Double, + ffi.Pointer)>>('gapi_fitLine3D_1'); + late final _gapi_fitLine3D_1 = _gapi_fitLine3D_1Ptr.asFunction< + ffi.Pointer Function(GArrayPoint3d, int, double, double, double, + ffi.Pointer)>(); - ffi.Pointer WarpAffine( - Mat src, - Mat dst, - Mat rot_mat, - Size dsize, + ffi.Pointer gapi_fitLine3D_2( + GArrayPoint3f src, + int distType, + double param, + double reps, + double aeps, + ffi.Pointer rval, ) { - return _WarpAffine( + return _gapi_fitLine3D_2( src, - dst, - rot_mat, - dsize, + distType, + param, + reps, + aeps, + rval, ); } - late final _WarpAffinePtr = _lookup< + late final _gapi_fitLine3D_2Ptr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Mat, Mat, Mat, Size)>>('WarpAffine'); - late final _WarpAffine = _WarpAffinePtr.asFunction< - ffi.Pointer Function(Mat, Mat, Mat, Size)>(); + ffi.Pointer Function( + GArrayPoint3f, + ffi.Int, + ffi.Double, + ffi.Double, + ffi.Double, + ffi.Pointer)>>('gapi_fitLine3D_2'); + late final _gapi_fitLine3D_2 = _gapi_fitLine3D_2Ptr.asFunction< + ffi.Pointer Function(GArrayPoint3f, int, double, double, double, + ffi.Pointer)>(); - ffi.Pointer WarpAffineWithParams( - Mat src, - Mat dst, - Mat rot_mat, - Size dsize, - int flags, - int borderMode, - Scalar borderValue, + ffi.Pointer gapi_fitLine3D_3( + GArrayPoint3i src, + int distType, + double param, + double reps, + double aeps, + ffi.Pointer rval, + ) { + return _gapi_fitLine3D_3( + src, + distType, + param, + reps, + aeps, + rval, + ); + } + + late final _gapi_fitLine3D_3Ptr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + GArrayPoint3i, + ffi.Int, + ffi.Double, + ffi.Double, + ffi.Double, + ffi.Pointer)>>('gapi_fitLine3D_3'); + late final _gapi_fitLine3D_3 = _gapi_fitLine3D_3Ptr.asFunction< + ffi.Pointer Function(GArrayPoint3i, int, double, double, double, + ffi.Pointer)>(); + + ffi.Pointer gapi_fitLine3D_4( + GMat src, + int distType, + double param, + double reps, + double aeps, + ffi.Pointer rval, ) { - return _WarpAffineWithParams( + return _gapi_fitLine3D_4( src, - dst, - rot_mat, - dsize, - flags, - borderMode, - borderValue, + distType, + param, + reps, + aeps, + rval, ); } - late final _WarpAffineWithParamsPtr = _lookup< + late final _gapi_fitLine3D_4Ptr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Mat, Mat, Mat, Size, ffi.Int, ffi.Int, - Scalar)>>('WarpAffineWithParams'); - late final _WarpAffineWithParams = _WarpAffineWithParamsPtr.asFunction< - ffi.Pointer Function(Mat, Mat, Mat, Size, int, int, Scalar)>(); + ffi.Pointer Function(GMat, ffi.Int, ffi.Double, ffi.Double, + ffi.Double, ffi.Pointer)>>('gapi_fitLine3D_4'); + late final _gapi_fitLine3D_4 = _gapi_fitLine3D_4Ptr.asFunction< + ffi.Pointer Function( + GMat, int, double, double, double, ffi.Pointer)>(); - ffi.Pointer WarpPerspective( - Mat src, - Mat dst, - Mat m, - Size dsize, + ffi.Pointer gapi_flip( + GMat src, + int flipCode, + ffi.Pointer rval, ) { - return _WarpPerspective( + return _gapi_flip( src, - dst, - m, - dsize, + flipCode, + rval, ); } - late final _WarpPerspectivePtr = _lookup< - ffi - .NativeFunction Function(Mat, Mat, Mat, Size)>>( - 'WarpPerspective'); - late final _WarpPerspective = _WarpPerspectivePtr.asFunction< - ffi.Pointer Function(Mat, Mat, Mat, Size)>(); + late final _gapi_flipPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + GMat, ffi.Int, ffi.Pointer)>>('gapi_flip'); + late final _gapi_flip = _gapi_flipPtr.asFunction< + ffi.Pointer Function(GMat, int, ffi.Pointer)>(); - ffi.Pointer WarpPerspectiveWithParams( - Mat src, - Mat dst, - Mat rot_mat, - Size dsize, - int flags, - int borderMode, + ffi.Pointer gapi_gaussianBlur( + GMat src, + Size ksize, + double sigmaX, + double sigmaY, + int borderType, Scalar borderValue, + ffi.Pointer rval, ) { - return _WarpPerspectiveWithParams( + return _gapi_gaussianBlur( src, - dst, - rot_mat, - dsize, - flags, - borderMode, + ksize, + sigmaX, + sigmaY, + borderType, borderValue, + rval, ); } - late final _WarpPerspectiveWithParamsPtr = _lookup< + late final _gapi_gaussianBlurPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Mat, Mat, Mat, Size, ffi.Int, ffi.Int, - Scalar)>>('WarpPerspectiveWithParams'); - late final _WarpPerspectiveWithParams = - _WarpPerspectiveWithParamsPtr.asFunction< - ffi.Pointer Function( - Mat, Mat, Mat, Size, int, int, Scalar)>(); + ffi.Pointer Function(GMat, Size, ffi.Double, ffi.Double, + ffi.Int, Scalar, ffi.Pointer)>>('gapi_gaussianBlur'); + late final _gapi_gaussianBlur = _gapi_gaussianBlurPtr.asFunction< + ffi.Pointer Function( + GMat, Size, double, double, int, Scalar, ffi.Pointer)>(); - ffi.Pointer Watershed( - Mat image, - Mat markers, + ffi.Pointer gapi_goodFeaturesToTrack( + GMat image, + int maxCorners, + double qualityLevel, + double minDistance, + Mat mask, + int blockSize, + bool useHarrisDetector, + double k, ) { - return _Watershed( + return _gapi_goodFeaturesToTrack( image, - markers, + maxCorners, + qualityLevel, + minDistance, + mask, + blockSize, + useHarrisDetector, + k, ); } - late final _WatershedPtr = - _lookup Function(Mat, Mat)>>( - 'Watershed'); - late final _Watershed = - _WatershedPtr.asFunction Function(Mat, Mat)>(); + late final _gapi_goodFeaturesToTrackPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(GMat, ffi.Int, ffi.Double, ffi.Double, + Mat, ffi.Int, ffi.Bool, ffi.Double)>>('gapi_goodFeaturesToTrack'); + late final _gapi_goodFeaturesToTrack = + _gapi_goodFeaturesToTrackPtr.asFunction< + ffi.Pointer Function( + GMat, int, double, double, Mat, int, bool, double)>(); - void WeChatQRCode_Close( - WeChatQRCodePtr self, + ffi.Pointer gapi_mask( + GMat src, + GMat mask, + ffi.Pointer rval, ) { - return _WeChatQRCode_Close( - self, + return _gapi_mask( + src, + mask, + rval, ); } - late final _WeChatQRCode_ClosePtr = - _lookup>( - 'WeChatQRCode_Close'); - late final _WeChatQRCode_Close = - _WeChatQRCode_ClosePtr.asFunction(); + late final _gapi_maskPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + GMat, GMat, ffi.Pointer)>>('gapi_mask'); + late final _gapi_mask = _gapi_maskPtr.asFunction< + ffi.Pointer Function(GMat, GMat, ffi.Pointer)>(); - ffi.Pointer WeChatQRCode_DetectAndDecode( - ffi.Pointer self, - Mat img, - ffi.Pointer points, - ffi.Pointer rval, + ffi.Pointer gapi_mean( + GMat src, + ffi.Pointer rval, ) { - return _WeChatQRCode_DetectAndDecode( - self, - img, - points, + return _gapi_mean( + src, rval, ); } - late final _WeChatQRCode_DetectAndDecodePtr = _lookup< + late final _gapi_meanPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer, - Mat, - ffi.Pointer, - ffi.Pointer)>>('WeChatQRCode_DetectAndDecode'); - late final _WeChatQRCode_DetectAndDecode = - _WeChatQRCode_DetectAndDecodePtr.asFunction< - ffi.Pointer Function(ffi.Pointer, Mat, - ffi.Pointer, ffi.Pointer)>(); + GMat, ffi.Pointer)>>('gapi_mean'); + late final _gapi_mean = _gapi_meanPtr + .asFunction Function(GMat, ffi.Pointer)>(); - ffi.Pointer WeChatQRCode_GetScaleFactor( - ffi.Pointer self, - ffi.Pointer rval, + ffi.Pointer gapi_medianBlur( + GMat src, + int ksize, + ffi.Pointer rval, ) { - return _WeChatQRCode_GetScaleFactor( - self, + return _gapi_medianBlur( + src, + ksize, rval, ); } - late final _WeChatQRCode_GetScaleFactorPtr = _lookup< + late final _gapi_medianBlurPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer)>>('WeChatQRCode_GetScaleFactor'); - late final _WeChatQRCode_GetScaleFactor = - _WeChatQRCode_GetScaleFactorPtr.asFunction< ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>(); + GMat, ffi.Int, ffi.Pointer)>>('gapi_medianBlur'); + late final _gapi_medianBlur = _gapi_medianBlurPtr.asFunction< + ffi.Pointer Function(GMat, int, ffi.Pointer)>(); - ffi.Pointer WeChatQRCode_New( - ffi.Pointer qrcode, + ffi.Pointer gapi_merge3( + GMat src1, + GMat src2, + GMat src3, + ffi.Pointer rval, ) { - return _WeChatQRCode_New( - qrcode, + return _gapi_merge3( + src1, + src2, + src3, + rval, ); } - late final _WeChatQRCode_NewPtr = _lookup< + late final _gapi_merge3Ptr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer)>>('WeChatQRCode_New'); - late final _WeChatQRCode_New = _WeChatQRCode_NewPtr.asFunction< - ffi.Pointer Function(ffi.Pointer)>(); + GMat, GMat, GMat, ffi.Pointer)>>('gapi_merge3'); + late final _gapi_merge3 = _gapi_merge3Ptr.asFunction< + ffi.Pointer Function(GMat, GMat, GMat, ffi.Pointer)>(); - ffi.Pointer WeChatQRCode_NewWithParams( - ffi.Pointer detector_prototxt_path, - ffi.Pointer detector_caffe_model_path, - ffi.Pointer super_resolution_prototxt_path, - ffi.Pointer super_resolution_caffe_model_path, - ffi.Pointer qrcode, + ffi.Pointer gapi_merge4( + GMat src1, + GMat src2, + GMat src3, + GMat src4, + ffi.Pointer rval, ) { - return _WeChatQRCode_NewWithParams( - detector_prototxt_path, - detector_caffe_model_path, - super_resolution_prototxt_path, - super_resolution_caffe_model_path, - qrcode, + return _gapi_merge4( + src1, + src2, + src3, + src4, + rval, ); } - late final _WeChatQRCode_NewWithParamsPtr = _lookup< + late final _gapi_merge4Ptr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>('WeChatQRCode_NewWithParams'); - late final _WeChatQRCode_NewWithParams = - _WeChatQRCode_NewWithParamsPtr.asFunction< - ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>(); + GMat, GMat, GMat, GMat, ffi.Pointer)>>('gapi_merge4'); + late final _gapi_merge4 = _gapi_merge4Ptr.asFunction< + ffi.Pointer Function( + GMat, GMat, GMat, GMat, ffi.Pointer)>(); - ffi.Pointer WeChatQRCode_SetScaleFactor( - ffi.Pointer self, - double scale_factor, + ffi.Pointer gapi_morphologyEx( + GMat src, + int op, + Mat kernel, + Point anchor, + int iterations, + int borderType, + Scalar borderValue, + ffi.Pointer rval, ) { - return _WeChatQRCode_SetScaleFactor( - self, - scale_factor, + return _gapi_morphologyEx( + src, + op, + kernel, + anchor, + iterations, + borderType, + borderValue, + rval, ); } - late final _WeChatQRCode_SetScaleFactorPtr = _lookup< + late final _gapi_morphologyExPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Float)>>('WeChatQRCode_SetScaleFactor'); - late final _WeChatQRCode_SetScaleFactor = - _WeChatQRCode_SetScaleFactorPtr.asFunction< - ffi.Pointer Function(ffi.Pointer, double)>(); + ffi.Pointer Function(GMat, ffi.Int, Mat, Point, ffi.Int, + ffi.Int, Scalar, ffi.Pointer)>>('gapi_morphologyEx'); + late final _gapi_morphologyEx = _gapi_morphologyExPtr.asFunction< + ffi.Pointer Function( + GMat, int, Mat, Point, int, int, Scalar, ffi.Pointer)>(); - void Window_Close( - ffi.Pointer winname, + ffi.Pointer gapi_mul( + GMat src1, + GMat src2, + double scale, + int ddepth, + ffi.Pointer rval, ) { - return _Window_Close( - winname, + return _gapi_mul( + src1, + src2, + scale, + ddepth, + rval, ); } - late final _Window_ClosePtr = - _lookup)>>( - 'Window_Close'); - late final _Window_Close = - _Window_ClosePtr.asFunction)>(); + late final _gapi_mulPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + GMat, GMat, ffi.Double, ffi.Int, ffi.Pointer)>>('gapi_mul'); + late final _gapi_mul = _gapi_mulPtr.asFunction< + ffi.Pointer Function( + GMat, GMat, double, int, ffi.Pointer)>(); - ffi.Pointer Window_GetProperty( - ffi.Pointer winname, - int flag, - ffi.Pointer rval, + ffi.Pointer gapi_mulC( + GMat src, + GScalar multiplier, + int ddepth, + ffi.Pointer rval, ) { - return _Window_GetProperty( - winname, - flag, + return _gapi_mulC( + src, + multiplier, + ddepth, rval, ); } - late final _Window_GetPropertyPtr = _lookup< + late final _gapi_mulCPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, ffi.Int, - ffi.Pointer)>>('Window_GetProperty'); - late final _Window_GetProperty = _Window_GetPropertyPtr.asFunction< - ffi.Pointer Function( - ffi.Pointer, int, ffi.Pointer)>(); + ffi.Pointer Function( + GMat, GScalar, ffi.Int, ffi.Pointer)>>('gapi_mulC'); + late final _gapi_mulC = _gapi_mulCPtr.asFunction< + ffi.Pointer Function(GMat, GScalar, int, ffi.Pointer)>(); - ffi.Pointer Window_IMShow( - ffi.Pointer winname, - Mat mat, - ) { - return _Window_IMShow( - winname, - mat, + ffi.Pointer gapi_mulC_1( + GMat src, + double multiplier, + int ddepth, + ffi.Pointer rval, + ) { + return _gapi_mulC_1( + src, + multiplier, + ddepth, + rval, ); } - late final _Window_IMShowPtr = _lookup< + late final _gapi_mulC_1Ptr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer, Mat)>>('Window_IMShow'); - late final _Window_IMShow = _Window_IMShowPtr.asFunction< - ffi.Pointer Function(ffi.Pointer, Mat)>(); + GMat, ffi.Double, ffi.Int, ffi.Pointer)>>('gapi_mulC_1'); + late final _gapi_mulC_1 = _gapi_mulC_1Ptr.asFunction< + ffi.Pointer Function(GMat, double, int, ffi.Pointer)>(); - ffi.Pointer Window_Move( - ffi.Pointer winname, - int x, - int y, + ffi.Pointer gapi_mulC_2( + GScalar multiplier, + GMat src, + int ddepth, + ffi.Pointer rval, ) { - return _Window_Move( - winname, - x, - y, + return _gapi_mulC_2( + multiplier, + src, + ddepth, + rval, ); } - late final _Window_MovePtr = _lookup< + late final _gapi_mulC_2Ptr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer, ffi.Int, ffi.Int)>>('Window_Move'); - late final _Window_Move = _Window_MovePtr.asFunction< - ffi.Pointer Function(ffi.Pointer, int, int)>(); + GScalar, GMat, ffi.Int, ffi.Pointer)>>('gapi_mulC_2'); + late final _gapi_mulC_2 = _gapi_mulC_2Ptr.asFunction< + ffi.Pointer Function(GScalar, GMat, int, ffi.Pointer)>(); - ffi.Pointer Window_New( - ffi.Pointer winname, - int flags, + ffi.Pointer gapi_normalize( + GMat src, + double alpha, + double beta, + int norm_type, + int ddepth, + ffi.Pointer rval, ) { - return _Window_New( - winname, - flags, + return _gapi_normalize( + src, + alpha, + beta, + norm_type, + ddepth, + rval, ); } - late final _Window_NewPtr = _lookup< + late final _gapi_normalizePtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Int)>>('Window_New'); - late final _Window_New = _Window_NewPtr.asFunction< - ffi.Pointer Function(ffi.Pointer, int)>(); + ffi.Pointer Function(GMat, ffi.Double, ffi.Double, ffi.Int, + ffi.Int, ffi.Pointer)>>('gapi_normalize'); + late final _gapi_normalize = _gapi_normalizePtr.asFunction< + ffi.Pointer Function( + GMat, double, double, int, int, ffi.Pointer)>(); - ffi.Pointer Window_Resize( - ffi.Pointer winname, - int width, - int height, + ffi.Pointer gapi_phase( + GMat x, + GMat y, + bool angleInDegrees, + ffi.Pointer rval, ) { - return _Window_Resize( - winname, - width, - height, + return _gapi_phase( + x, + y, + angleInDegrees, + rval, ); } - late final _Window_ResizePtr = _lookup< + late final _gapi_phasePtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer, ffi.Int, ffi.Int)>>('Window_Resize'); - late final _Window_Resize = _Window_ResizePtr.asFunction< - ffi.Pointer Function(ffi.Pointer, int, int)>(); + GMat, GMat, ffi.Bool, ffi.Pointer)>>('gapi_phase'); + late final _gapi_phase = _gapi_phasePtr.asFunction< + ffi.Pointer Function(GMat, GMat, bool, ffi.Pointer)>(); - ffi.Pointer Window_SelectROI( - ffi.Pointer winname, - Mat img, - ffi.Pointer rval, + ffi.Pointer gapi_polarToCart( + GMat magnitude, + GMat angle, + bool angleInDegrees, + ffi.Pointer rval, ) { - return _Window_SelectROI( - winname, - img, + return _gapi_polarToCart( + magnitude, + angle, + angleInDegrees, rval, ); } - late final _Window_SelectROIPtr = _lookup< + late final _gapi_polarToCartPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, Mat, - ffi.Pointer)>>('Window_SelectROI'); - late final _Window_SelectROI = _Window_SelectROIPtr.asFunction< - ffi.Pointer Function( - ffi.Pointer, Mat, ffi.Pointer)>(); + ffi.Pointer Function( + GMat, GMat, ffi.Bool, ffi.Pointer)>>('gapi_polarToCart'); + late final _gapi_polarToCart = _gapi_polarToCartPtr.asFunction< + ffi.Pointer Function(GMat, GMat, bool, ffi.Pointer)>(); - ffi.Pointer Window_SelectROIs( - ffi.Pointer winname, - Mat img, - ffi.Pointer rval, + ffi.Pointer gapi_remap( + GMat src, + Mat map1, + Mat map2, + int interpolation, + int borderMode, + Scalar borderValue, + ffi.Pointer rval, ) { - return _Window_SelectROIs( - winname, - img, + return _gapi_remap( + src, + map1, + map2, + interpolation, + borderMode, + borderValue, rval, ); } - late final _Window_SelectROIsPtr = _lookup< + late final _gapi_remapPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, Mat, - ffi.Pointer)>>('Window_SelectROIs'); - late final _Window_SelectROIs = _Window_SelectROIsPtr.asFunction< + ffi.Pointer Function(GMat, Mat, Mat, ffi.Int, ffi.Int, + Scalar, ffi.Pointer)>>('gapi_remap'); + late final _gapi_remap = _gapi_remapPtr.asFunction< ffi.Pointer Function( - ffi.Pointer, Mat, ffi.Pointer)>(); + GMat, Mat, Mat, int, int, Scalar, ffi.Pointer)>(); - ffi.Pointer Window_SetProperty( - ffi.Pointer winname, - int flag, - double value, + ffi.Pointer gapi_resize( + GMat src, + Size dsize, + double fx, + double fy, + int interpolation, + ffi.Pointer rval, ) { - return _Window_SetProperty( - winname, - flag, - value, + return _gapi_resize( + src, + dsize, + fx, + fy, + interpolation, + rval, ); } - late final _Window_SetPropertyPtr = _lookup< + late final _gapi_resizePtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, ffi.Int, - ffi.Double)>>('Window_SetProperty'); - late final _Window_SetProperty = _Window_SetPropertyPtr.asFunction< - ffi.Pointer Function(ffi.Pointer, int, double)>(); + ffi.Pointer Function(GMat, Size, ffi.Double, ffi.Double, + ffi.Int, ffi.Pointer)>>('gapi_resize'); + late final _gapi_resize = _gapi_resizePtr.asFunction< + ffi.Pointer Function( + GMat, Size, double, double, int, ffi.Pointer)>(); - ffi.Pointer Window_SetTitle( - ffi.Pointer winname, - ffi.Pointer title, + ffi.Pointer gapi_resizeP( + GMat src, + Size dsize, + int interpolation, + ffi.Pointer rval, ) { - return _Window_SetTitle( - winname, - title, + return _gapi_resizeP( + src, + dsize, + interpolation, + rval, ); } - late final _Window_SetTitlePtr = _lookup< + late final _gapi_resizePPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer)>>('Window_SetTitle'); - late final _Window_SetTitle = _Window_SetTitlePtr.asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>(); + ffi.Pointer Function( + GMat, Size, ffi.Int, ffi.Pointer)>>('gapi_resizeP'); + late final _gapi_resizeP = _gapi_resizePPtr.asFunction< + ffi.Pointer Function(GMat, Size, int, ffi.Pointer)>(); - ffi.Pointer Window_WaitKey( - int delay, - ffi.Pointer rval, + ffi.Pointer gapi_sepFilter( + GMat src, + int ddepth, + Mat kernelX, + Mat kernelY, + Point anchor, + Scalar delta, + int borderType, + Scalar borderValue, + ffi.Pointer rval, ) { - return _Window_WaitKey( - delay, + return _gapi_sepFilter( + src, + ddepth, + kernelX, + kernelY, + anchor, + delta, + borderType, + borderValue, rval, ); } - late final _Window_WaitKeyPtr = _lookup< + late final _gapi_sepFilterPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - ffi.Int, ffi.Pointer)>>('Window_WaitKey'); - late final _Window_WaitKey = _Window_WaitKeyPtr.asFunction< - ffi.Pointer Function(int, ffi.Pointer)>(); + ffi.Pointer Function(GMat, ffi.Int, Mat, Mat, Point, Scalar, + ffi.Int, Scalar, ffi.Pointer)>>('gapi_sepFilter'); + late final _gapi_sepFilter = _gapi_sepFilterPtr.asFunction< + ffi.Pointer Function(GMat, int, Mat, Mat, Point, Scalar, int, + Scalar, ffi.Pointer)>(); - ffi.Pointer Zeros( - int rows, - int cols, - int type, - ffi.Pointer rval, + ffi.Pointer gapi_split3( + GMat src, + ffi.Pointer rval, + ffi.Pointer rval1, + ffi.Pointer rval2, ) { - return _Zeros( - rows, - cols, - type, + return _gapi_split3( + src, rval, + rval1, + rval2, ); } - late final _ZerosPtr = _lookup< + late final _gapi_split3Ptr = _lookup< ffi.NativeFunction< - ffi.Pointer Function( - ffi.Int, ffi.Int, ffi.Int, ffi.Pointer)>>('Zeros'); - late final _Zeros = _ZerosPtr.asFunction< - ffi.Pointer Function(int, int, int, ffi.Pointer)>(); + ffi.Pointer Function(GMat, ffi.Pointer, + ffi.Pointer, ffi.Pointer)>>('gapi_split3'); + late final _gapi_split3 = _gapi_split3Ptr.asFunction< + ffi.Pointer Function( + GMat, ffi.Pointer, ffi.Pointer, ffi.Pointer)>(); - ffi.Pointer averageHashCompare( - Mat a, - Mat b, - ffi.Pointer rval, + ffi.Pointer gapi_split4( + GMat src, + ffi.Pointer rval, + ffi.Pointer rval1, + ffi.Pointer rval2, + ffi.Pointer rval3, ) { - return _averageHashCompare( - a, - b, + return _gapi_split4( + src, rval, + rval1, + rval2, + rval3, ); } - late final _averageHashComparePtr = _lookup< + late final _gapi_split4Ptr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - Mat, Mat, ffi.Pointer)>>('averageHashCompare'); - late final _averageHashCompare = _averageHashComparePtr.asFunction< - ffi.Pointer Function(Mat, Mat, ffi.Pointer)>(); + GMat, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>('gapi_split4'); + late final _gapi_split4 = _gapi_split4Ptr.asFunction< + ffi.Pointer Function(GMat, ffi.Pointer, ffi.Pointer, + ffi.Pointer, ffi.Pointer)>(); - ffi.Pointer averageHashCompute( - Mat inputArr, - Mat outputArr, + ffi.Pointer gapi_sqrt( + GMat src, + ffi.Pointer rval, ) { - return _averageHashCompute( - inputArr, - outputArr, + return _gapi_sqrt( + src, + rval, ); } - late final _averageHashComputePtr = - _lookup Function(Mat, Mat)>>( - 'averageHashCompute'); - late final _averageHashCompute = _averageHashComputePtr - .asFunction Function(Mat, Mat)>(); + late final _gapi_sqrtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + GMat, ffi.Pointer)>>('gapi_sqrt'); + late final _gapi_sqrt = _gapi_sqrtPtr + .asFunction Function(GMat, ffi.Pointer)>(); - ffi.Pointer blockMeanHashCompare( - Mat a, - Mat b, - int mode, - ffi.Pointer rval, + ffi.Pointer gapi_sub( + GMat src1, + GMat src2, + int ddepth, + ffi.Pointer rval, ) { - return _blockMeanHashCompare( - a, - b, - mode, + return _gapi_sub( + src1, + src2, + ddepth, rval, ); } - late final _blockMeanHashComparePtr = _lookup< + late final _gapi_subPtr = _lookup< ffi.NativeFunction< - ffi.Pointer Function(Mat, Mat, ffi.Int, - ffi.Pointer)>>('blockMeanHashCompare'); - late final _blockMeanHashCompare = _blockMeanHashComparePtr.asFunction< - ffi.Pointer Function(Mat, Mat, int, ffi.Pointer)>(); + ffi.Pointer Function( + GMat, GMat, ffi.Int, ffi.Pointer)>>('gapi_sub'); + late final _gapi_sub = _gapi_subPtr.asFunction< + ffi.Pointer Function(GMat, GMat, int, ffi.Pointer)>(); - ffi.Pointer blockMeanHashCompute( - Mat inputArr, - Mat outputArr, - int mode, + ffi.Pointer gapi_subC( + GMat src, + GScalar c, + int ddepth, + ffi.Pointer rval, ) { - return _blockMeanHashCompute( - inputArr, - outputArr, - mode, + return _gapi_subC( + src, + c, + ddepth, + rval, ); } - late final _blockMeanHashComputePtr = _lookup< - ffi - .NativeFunction Function(Mat, Mat, ffi.Int)>>( - 'blockMeanHashCompute'); - late final _blockMeanHashCompute = _blockMeanHashComputePtr - .asFunction Function(Mat, Mat, int)>(); - - ffi.Pointer colorMomentHashCompare( - Mat a, - Mat b, - ffi.Pointer rval, + late final _gapi_subCPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + GMat, GScalar, ffi.Int, ffi.Pointer)>>('gapi_subC'); + late final _gapi_subC = _gapi_subCPtr.asFunction< + ffi.Pointer Function(GMat, GScalar, int, ffi.Pointer)>(); + + ffi.Pointer gapi_subRC( + GScalar c, + GMat src, + int ddepth, + ffi.Pointer rval, ) { - return _colorMomentHashCompare( - a, - b, + return _gapi_subRC( + c, + src, + ddepth, rval, ); } - late final _colorMomentHashComparePtr = _lookup< + late final _gapi_subRCPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - Mat, Mat, ffi.Pointer)>>('colorMomentHashCompare'); - late final _colorMomentHashCompare = _colorMomentHashComparePtr.asFunction< - ffi.Pointer Function(Mat, Mat, ffi.Pointer)>(); + GScalar, GMat, ffi.Int, ffi.Pointer)>>('gapi_subRC'); + late final _gapi_subRC = _gapi_subRCPtr.asFunction< + ffi.Pointer Function(GScalar, GMat, int, ffi.Pointer)>(); - ffi.Pointer colorMomentHashCompute( - Mat inputArr, - Mat outputArr, + ffi.Pointer gapi_warpAffine( + GMat src, + Mat M, + Size dsize, + int flags, + int borderMode, + Scalar borderValue, + ffi.Pointer rval, ) { - return _colorMomentHashCompute( - inputArr, - outputArr, + return _gapi_warpAffine( + src, + M, + dsize, + flags, + borderMode, + borderValue, + rval, ); } - late final _colorMomentHashComputePtr = - _lookup Function(Mat, Mat)>>( - 'colorMomentHashCompute'); - late final _colorMomentHashCompute = _colorMomentHashComputePtr - .asFunction Function(Mat, Mat)>(); + late final _gapi_warpAffinePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(GMat, Mat, Size, ffi.Int, ffi.Int, + Scalar, ffi.Pointer)>>('gapi_warpAffine'); + late final _gapi_warpAffine = _gapi_warpAffinePtr.asFunction< + ffi.Pointer Function( + GMat, Mat, Size, int, int, Scalar, ffi.Pointer)>(); - ffi.Pointer destroyAllWindows() { - return _destroyAllWindows(); + ffi.Pointer gapi_warpPerspective( + GMat src, + Mat M, + Size dsize, + int flags, + int borderMode, + Scalar borderValue, + ffi.Pointer rval, + ) { + return _gapi_warpPerspective( + src, + M, + dsize, + flags, + borderMode, + borderValue, + rval, + ); } - late final _destroyAllWindowsPtr = - _lookup Function()>>( - 'destroyAllWindows'); - late final _destroyAllWindows = - _destroyAllWindowsPtr.asFunction Function()>(); + late final _gapi_warpPerspectivePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(GMat, Mat, Size, ffi.Int, ffi.Int, + Scalar, ffi.Pointer)>>('gapi_warpPerspective'); + late final _gapi_warpPerspective = _gapi_warpPerspectivePtr.asFunction< + ffi.Pointer Function( + GMat, Mat, Size, int, int, Scalar, ffi.Pointer)>(); ffi.Pointer getBuildInfo( ffi.Pointer> rval, @@ -18742,6 +33447,49 @@ class CvNative { late final _getBuildInfo = _getBuildInfoPtr.asFunction< ffi.Pointer Function(ffi.Pointer>)>(); + ffi.Pointer getBuildInfo_Async( + CvCallback_1 callback, + ) { + return _getBuildInfo_Async( + callback, + ); + } + + late final _getBuildInfo_AsyncPtr = + _lookup Function(CvCallback_1)>>( + 'getBuildInfo_Async'); + late final _getBuildInfo_Async = _getBuildInfo_AsyncPtr + .asFunction Function(CvCallback_1)>(); + + ffi.Pointer getOptimalNewCameraMatrix_Async( + Mat cameraMatrix, + Mat distCoeffs, + Size size, + double alpha, + Size newImgSize, + bool centerPrincipalPoint, + CvCallback_2 callback, + ) { + return _getOptimalNewCameraMatrix_Async( + cameraMatrix, + distCoeffs, + size, + alpha, + newImgSize, + centerPrincipalPoint, + callback, + ); + } + + late final _getOptimalNewCameraMatrix_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, Size, ffi.Double, Size, + ffi.Bool, CvCallback_2)>>('getOptimalNewCameraMatrix_Async'); + late final _getOptimalNewCameraMatrix_Async = + _getOptimalNewCameraMatrix_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, Size, double, Size, bool, CvCallback_2)>(); + ffi.Pointer getPredefinedDictionary( int dictionaryId, ffi.Pointer rval, @@ -18759,6 +33507,35 @@ class CvNative { late final _getPredefinedDictionary = _getPredefinedDictionaryPtr.asFunction< ffi.Pointer Function(int, ffi.Pointer)>(); + ffi.Pointer initUndistortRectifyMap_Async( + Mat cameraMatrix, + Mat distCoeffs, + Mat r, + Mat newCameraMatrix, + Size size, + int m1type, + CvCallback_2 callback, + ) { + return _initUndistortRectifyMap_Async( + cameraMatrix, + distCoeffs, + r, + newCameraMatrix, + size, + m1type, + callback, + ); + } + + late final _initUndistortRectifyMap_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, Mat, Mat, Size, ffi.Int, + CvCallback_2)>>('initUndistortRectifyMap_Async'); + late final _initUndistortRectifyMap_Async = + _initUndistortRectifyMap_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, Mat, Mat, Size, int, CvCallback_2)>(); + ffi.Pointer marrHildrethHashCompare( Mat a, Mat b, @@ -18819,6 +33596,20 @@ class CvNative { late final _openCVVersion = _openCVVersionPtr.asFunction< ffi.Pointer Function(ffi.Pointer>)>(); + ffi.Pointer openCVVersion_Async( + CvCallback_1 callback, + ) { + return _openCVVersion_Async( + callback, + ); + } + + late final _openCVVersion_AsyncPtr = + _lookup Function(CvCallback_1)>>( + 'openCVVersion_Async'); + late final _openCVVersion_Async = _openCVVersion_AsyncPtr + .asFunction Function(CvCallback_1)>(); + ffi.Pointer pHashCompare( Mat a, Mat b, @@ -18914,6 +33705,57 @@ class CvNative { late final _registerErrorCallback = _registerErrorCallbackPtr.asFunction(); + ffi.Pointer undistortPoints_Async( + Mat distorted, + Mat k, + Mat d, + Mat r, + Mat p, + TermCriteria criteria, + CvCallback_1 callback, + ) { + return _undistortPoints_Async( + distorted, + k, + d, + r, + p, + criteria, + callback, + ); + } + + late final _undistortPoints_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(Mat, Mat, Mat, Mat, Mat, TermCriteria, + CvCallback_1)>>('undistortPoints_Async'); + late final _undistortPoints_Async = _undistortPoints_AsyncPtr.asFunction< + ffi.Pointer Function( + Mat, Mat, Mat, Mat, Mat, TermCriteria, CvCallback_1)>(); + + ffi.Pointer undistort_Async( + Mat src, + Mat cameraMatrix, + Mat distCoeffs, + Mat newCameraMatrix, + CvCallback_1 callback, + ) { + return _undistort_Async( + src, + cameraMatrix, + distCoeffs, + newCameraMatrix, + callback, + ); + } + + late final _undistort_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, Mat, Mat, CvCallback_1)>>('undistort_Async'); + late final _undistort_Async = _undistort_AsyncPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat, Mat, CvCallback_1)>(); + late final addresses = _SymbolAddresses(this); } @@ -18922,8 +33764,18 @@ 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> @@ -18937,8 +33789,16 @@ 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; @@ -18950,6 +33810,8 @@ class _SymbolAddresses { get BlockMeanHash_Close => _library._BlockMeanHash_ClosePtr; ffi.Pointer> get CLAHE_Close => _library._CLAHE_ClosePtr; + ffi.Pointer> + get CLAHE_Close_Async => _library._CLAHE_Close_AsyncPtr; ffi.Pointer> get CascadeClassifier_Close => _library._CascadeClassifier_ClosePtr; ffi.Pointer)>> @@ -18960,20 +33822,46 @@ 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> get Layer_Close => _library._Layer_ClosePtr; + ffi.Pointer> + 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)>> @@ -18982,20 +33870,40 @@ class _SymbolAddresses { get MergeMertens_Close => _library._MergeMertens_ClosePtr; ffi.Pointer> get Net_Close => _library._Net_ClosePtr; + ffi.Pointer> + 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; - ffi.Pointer> + ffi.Pointer< + ffi.NativeFunction< + ffi.Pointer Function( + SimpleBlobDetectorPtr, CvCallback_0)>> + get SimpleBlobDetector_Close_Async => + _library._SimpleBlobDetector_Close_AsyncPtr; + ffi.Pointer> get Stitcher_Close => _library._Stitcher_ClosePtr; + ffi.Pointer> + get Stitcher_Close_Async => _library._Stitcher_Close_AsyncPtr; ffi.Pointer> get Subdiv2D_Close => _library._Subdiv2D_ClosePtr; + ffi.Pointer> + get Subdiv2D_Close_Async => _library._Subdiv2D_Close_AsyncPtr; ffi.Pointer> get TrackerMIL_Close => _library._TrackerMIL_ClosePtr; ffi.Pointer> @@ -19018,10 +33926,18 @@ class _SymbolAddresses { get VecPoint3f_Close => _library._VecPoint3f_ClosePtr; ffi.Pointer> get VecPoint_Close => _library._VecPoint_ClosePtr; + ffi.Pointer> + get VecPrim_Close => _library._VecPrim_ClosePtr; ffi.Pointer> get VecRect_Close => _library._VecRect_ClosePtr; ffi.Pointer> get VecUChar_Close => _library._VecUChar_ClosePtr; + ffi.Pointer> + get VecVec4f_Close => _library._VecVec4f_ClosePtr; + ffi.Pointer> + get VecVec4i_Close => _library._VecVec4i_ClosePtr; + ffi.Pointer> + get VecVec6f_Close => _library._VecVec6f_ClosePtr; ffi.Pointer> get VecVecChar_Close => _library._VecVecChar_ClosePtr; ffi.Pointer> @@ -19040,6 +33956,12 @@ class _SymbolAddresses { get WeChatQRCode_Close => _library._WeChatQRCode_ClosePtr; ffi.Pointer)>> get Window_Close => _library._Window_ClosePtr; + ffi.Pointer> + get gapi_GComputation_Close => _library._gapi_GComputation_ClosePtr; + ffi.Pointer> + get gapi_GMat_Close => _library._gapi_GMat_ClosePtr; + ffi.Pointer> + get gapi_GScalar_Close => _library._gapi_GScalar_ClosePtr; } final class AKAZE extends ffi.Struct { @@ -19128,6 +34050,40 @@ final class CascadeClassifier extends ffi.Struct { } typedef CascadeClassifierPtr = ffi.Pointer; +typedef CvCallback_0 = ffi.Pointer>; +typedef CvCallback_0Function = ffi.Void Function(); +typedef DartCvCallback_0Function = void Function(); +typedef CvCallback_1 = ffi.Pointer>; +typedef CvCallback_1Function = ffi.Void Function(ffi.Pointer); +typedef DartCvCallback_1Function = void Function(ffi.Pointer); +typedef CvCallback_2 = ffi.Pointer>; +typedef CvCallback_2Function = ffi.Void Function( + ffi.Pointer, ffi.Pointer); +typedef DartCvCallback_2Function = void Function( + ffi.Pointer, ffi.Pointer); +typedef CvCallback_3 = ffi.Pointer>; +typedef CvCallback_3Function = ffi.Void Function( + ffi.Pointer, ffi.Pointer, ffi.Pointer); +typedef DartCvCallback_3Function = void Function( + ffi.Pointer, ffi.Pointer, ffi.Pointer); +typedef CvCallback_4 = ffi.Pointer>; +typedef CvCallback_4Function = ffi.Void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer, ffi.Pointer); +typedef DartCvCallback_4Function = void Function(ffi.Pointer, + ffi.Pointer, ffi.Pointer, ffi.Pointer); +typedef CvCallback_5 = ffi.Pointer>; +typedef CvCallback_5Function = ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer); +typedef DartCvCallback_5Function = void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer); final class CvStatus extends ffi.Struct { @ffi.Int() @@ -19199,22 +34155,96 @@ final class FlannBasedMatcher extends ffi.Struct { typedef FlannBasedMatcherPtr = ffi.Pointer; +final class GArrayGArrayPoint extends ffi.Struct { + external ffi.Pointer ptr; +} + +final class GArrayPoint extends ffi.Struct { + external ffi.Pointer ptr; +} + +final class GArrayPoint2d extends ffi.Struct { + external ffi.Pointer ptr; +} + +final class GArrayPoint2f extends ffi.Struct { + external ffi.Pointer ptr; +} + +final class GArrayPoint2i extends ffi.Struct { + external ffi.Pointer ptr; +} + +final class GArrayPoint3d extends ffi.Struct { + external ffi.Pointer ptr; +} + +final class GArrayPoint3f extends ffi.Struct { + external ffi.Pointer ptr; +} + +final class GArrayPoint3i extends ffi.Struct { + external ffi.Pointer ptr; +} + +final class GArrayPrim extends ffi.Struct { + external ffi.Pointer ptr; +} + +final class GArrayVec4i extends ffi.Struct { + external ffi.Pointer ptr; +} + +final class GComputation extends ffi.Struct { + external ffi.Pointer ptr; +} + +typedef GComputationPtr = ffi.Pointer; + final class GFTTDetector extends ffi.Struct { external ffi.Pointer ptr; } typedef GFTTDetectorPtr = ffi.Pointer; -final class HOGDescriptor extends ffi.Struct { +final class GFrame extends ffi.Struct { external ffi.Pointer ptr; } -typedef HOGDescriptorPtr = ffi.Pointer; +final class GMat extends ffi.Struct { + external ffi.Pointer ptr; +} + +typedef GMatPtr = ffi.Pointer; + +final class GOpaquePoint extends ffi.Struct { + external ffi.Pointer ptr; +} + +final class GOpaqueRect extends ffi.Struct { + external ffi.Pointer ptr; +} + +final class GOpaqueVec4f extends ffi.Struct { + external ffi.Pointer ptr; +} + +final class GOpaqueVec6f extends ffi.Struct { + external ffi.Pointer ptr; +} -final class InputOutputArray extends ffi.Struct { +final class GScalar extends ffi.Struct { external ffi.Pointer ptr; } +typedef GScalarPtr = ffi.Pointer; + +final class HOGDescriptor extends ffi.Struct { + external ffi.Pointer ptr; +} + +typedef HOGDescriptorPtr = ffi.Pointer; + final class KAZE extends ffi.Struct { external ffi.Pointer ptr; } @@ -19387,12 +34417,10 @@ final class Point3f extends ffi.Struct { external double z; } -final class PtrStitcher extends ffi.Struct { - external ffi.Pointer> ptr; +final class Prim extends ffi.Struct { + external ffi.Pointer ptr; } -typedef PtrStitcherPtr = ffi.Pointer; - final class QRCodeDetector extends ffi.Struct { external ffi.Pointer ptr; } @@ -19556,9 +34584,11 @@ final class Size2f extends ffi.Struct { } final class Stitcher extends ffi.Struct { - external ffi.Pointer ptr; + external ffi.Pointer> ptr; } +typedef StitcherPtr = ffi.Pointer; + final class Subdiv2D extends ffi.Struct { external ffi.Pointer ptr; } @@ -19898,6 +34928,10 @@ final class VecFloat extends ffi.Struct { typedef VecFloatPtr = ffi.Pointer; +final class VecGMat extends ffi.Struct { + external ffi.Pointer ptr; +} + final class VecInt extends ffi.Struct { external ffi.Pointer ptr; } @@ -19933,6 +34967,12 @@ final class VecPoint3f extends ffi.Struct { typedef VecPoint3fPtr = ffi.Pointer; typedef VecPointPtr = ffi.Pointer; +final class VecPrim extends ffi.Struct { + external ffi.Pointer ptr; +} + +typedef VecPrimPtr = ffi.Pointer; + final class VecRect extends ffi.Struct { external ffi.Pointer ptr; } @@ -19945,6 +34985,24 @@ final class VecUChar extends ffi.Struct { typedef VecUCharPtr = ffi.Pointer; +final class VecVec4f extends ffi.Struct { + external ffi.Pointer ptr; +} + +typedef VecVec4fPtr = ffi.Pointer; + +final class VecVec4i extends ffi.Struct { + external ffi.Pointer ptr; +} + +typedef VecVec4iPtr = ffi.Pointer; + +final class VecVec6f extends ffi.Struct { + external ffi.Pointer ptr; +} + +typedef VecVec6fPtr = ffi.Pointer; + final class VecVecChar extends ffi.Struct { external ffi.Pointer ptr; } diff --git a/lib/src/photo/photo.dart b/lib/src/photo/photo.dart index aefb95bf..cd5af23f 100644 --- a/lib/src/photo/photo.dart +++ b/lib/src/photo/photo.dart @@ -22,7 +22,11 @@ class MergeMertens extends CvStruct { finalizer.attach(this, ptr.cast(), detach: this); } } - + factory MergeMertens.fromPointer( + cvg.MergeMertensPtr ptr, [ + bool attach = true, + ]) => + MergeMertens._(ptr.cast(), attach); factory MergeMertens.empty() { final p = calloc(); cvRun(() => CFFI.MergeMertens_Create(p)); @@ -36,7 +40,12 @@ class MergeMertens extends CvStruct { }) { final p = calloc(); cvRun( - () => CFFI.MergeMertens_CreateWithParams(contrastWeight, saturationWeight, exposureWeight, p), + () => CFFI.MergeMertens_CreateWithParams( + contrastWeight, + saturationWeight, + exposureWeight, + p, + ), ); return MergeMertens._(p); } @@ -79,6 +88,11 @@ class AlignMTB extends CvStruct { finalizer.attach(this, ptr.cast(), detach: this); } } + factory AlignMTB.fromPointer( + cvg.AlignMTBPtr ptr, [ + bool attach = true, + ]) => + AlignMTB._(ptr.cast(), attach); /// AlignMTB for converts images to median threshold bitmaps. /// of type AlignMTB converts images to median threshold bitmaps (1 for pixels @@ -102,7 +116,11 @@ class AlignMTB extends CvStruct { /// https://docs.opencv.org/master/d6/df5/group__photo__hdr.html /// https://docs.opencv.org/master/d7/db6/classcv_1_1AlignMTB.html /// https://docs.opencv.org/master/d6/df5/group__photo__hdr.html#ga2f1fafc885a5d79dbfb3542e08db0244 - factory AlignMTB.create({int maxBits = 6, int excludeRange = 4, bool cut = true}) { + factory AlignMTB.create({ + int maxBits = 6, + int excludeRange = 4, + bool cut = true, + }) { final p = calloc(); cvRun(() => CFFI.AlignMTB_CreateWithParams(maxBits, excludeRange, cut, p)); return AlignMTB._(p); @@ -140,7 +158,9 @@ Mat colorChange( double blueMul = 1.0, }) { final dst = Mat.empty(); - cvRun(() => CFFI.ColorChange(src.ref, mask.ref, dst.ref, redMul, greenMul, blueMul)); + cvRun( + () => CFFI.ColorChange(src.ref, mask.ref, dst.ref, redMul, greenMul, blueMul), + ); return dst; } @@ -148,9 +168,17 @@ Mat colorChange( // /// For further details, please see: /// https://docs.opencv.org/master/df/da0/group__photo__clone.html#ga2bf426e4c93a6b1f21705513dfeca49d -Mat seamlessClone(InputArray src, InputArray dst, InputArray mask, Point p, int flags) { +Mat seamlessClone( + InputArray src, + InputArray dst, + InputArray mask, + Point p, + int flags, +) { final blend = Mat.empty(); - cvRun(() => CFFI.SeamlessClone(src.ref, dst.ref, mask.ref, p.ref, blend.ref, flags)); + cvRun( + () => CFFI.SeamlessClone(src.ref, dst.ref, mask.ref, p.ref, blend.ref, flags), + ); return blend; } @@ -181,7 +209,16 @@ Mat textureFlattening( int kernelSize = 3, }) { final dst = Mat.empty(); - cvRun(() => CFFI.TextureFlattening(src.ref, mask.ref, dst.ref, lowThreshold, highThreshold, kernelSize)); + cvRun( + () => CFFI.TextureFlattening( + src.ref, + mask.ref, + dst.ref, + lowThreshold, + highThreshold, + kernelSize, + ), + ); return dst; } @@ -285,7 +322,9 @@ Mat edgePreservingFilter( double sigmaR = 0.4, }) { final dst = Mat.empty(); - cvRun(() => CFFI.EdgePreservingFilter(src.ref, dst.ref, flags, sigmaS, sigmaR)); + cvRun( + () => CFFI.EdgePreservingFilter(src.ref, dst.ref, flags, sigmaS, sigmaR), + ); return dst; } @@ -301,7 +340,16 @@ Mat edgePreservingFilter( }) { final dst1 = Mat.empty(); final dst2 = Mat.empty(); - cvRun(() => CFFI.PencilSketch(src.ref, dst1.ref, dst2.ref, sigmaS, sigmaR, shadeFactor)); + cvRun( + () => CFFI.PencilSketch( + src.ref, + dst1.ref, + dst2.ref, + sigmaS, + sigmaR, + shadeFactor, + ), + ); return (dst1, dst2); } @@ -328,8 +376,21 @@ Mat stylization( // /// For further details, please see: /// https://docs.opencv.org/4.x/d7/d8b/group__photo__inpaint.html#gaedd30dfa0214fec4c88138b51d678085 -Mat inpaint(InputArray src, InputArray inpaintMask, double inpaintRadius, int flags) { +Mat inpaint( + InputArray src, + InputArray inpaintMask, + double inpaintRadius, + int flags, +) { final dst = Mat.empty(); - cvRun(() => CFFI.PhotoInpaint(src.ref, inpaintMask.ref, dst.ref, inpaintRadius, flags)); + cvRun( + () => CFFI.PhotoInpaint( + src.ref, + inpaintMask.ref, + dst.ref, + inpaintRadius, + flags, + ), + ); return dst; } diff --git a/lib/src/photo/photo_async.dart b/lib/src/photo/photo_async.dart new file mode 100644 index 00000000..c343118d --- /dev/null +++ b/lib/src/photo/photo_async.dart @@ -0,0 +1,295 @@ +library cv; + +import '../core/base.dart'; +import '../core/mat.dart'; +import '../core/point.dart'; +import '../opencv.g.dart' as cvg; +import './photo.dart'; + +extension MergeMertensAsync on MergeMertens { + static Future emptyNewAsync() async => cvRunAsync( + CFFI.MergeMertens_Create_Async, + (c, p) => c.complete(MergeMertens.fromPointer(p.cast())), + ); + + static Future createAsync({ + double contrastWeight = 1.0, + double saturationWeight = 1.0, + double exposureWeight = 0.0, + }) async { + return cvRunAsync( + (callback) => CFFI.MergeMertens_CreateWithParams_Async( + contrastWeight, + saturationWeight, + exposureWeight, + callback, + ), + (c, p) => c.complete(MergeMertens.fromPointer(p.cast())), + ); + } + + Future processAsync(VecMat src) async { + return cvRunAsync( + (callback) => CFFI.MergeMertens_Process_Async(ref, src.ref, callback), + (c, pdst) => c.complete(Mat.fromPointer(pdst.cast())), + ); + } +} + +extension AlignMTBAsync on AlignMTB { + static Future emptyNewAsync() async => cvRunAsync( + CFFI.AlignMTB_Create_Async, + (c, p) => c.complete(AlignMTB.fromPointer(p.cast())), + ); + + static Future createAsync({ + int maxBits = 6, + int excludeRange = 4, + bool cut = true, + }) async { + return cvRunAsync( + (callback) => CFFI.AlignMTB_CreateWithParams_Async( + maxBits, + excludeRange, + cut, + callback, + ), + (c, p) => c.complete(AlignMTB.fromPointer(p.cast())), + ); + } + + Future processAsync(VecMat src) async { + return cvRunAsync( + (callback) => CFFI.AlignMTB_Process_Async(ref, src.ref, callback), + (c, pdst) => c.complete(VecMat.fromPointer(pdst.cast())), + ); + } +} + +Future colorChangeAsync( + InputArray src, + InputArray mask, { + double redMul = 1.0, + double greenMul = 1.0, + double blueMul = 1.0, +}) async { + return cvRunAsync( + (callback) => CFFI.ColorChange_Async( + src.ref, + mask.ref, + redMul, + greenMul, + blueMul, + callback, + ), + (c, pdst) => c.complete(Mat.fromPointer(pdst.cast())), + ); +} + +Future seamlessCloneAsync( + InputArray src, + InputArray dst, + InputArray mask, + Point p, + int flags, +) async { + return cvRunAsync( + (callback) => CFFI.SeamlessClone_Async( + src.ref, + dst.ref, + mask.ref, + p.ref, + flags, + callback, + ), + matCompleter, + ); +} + +Future illuminationChangeAsync( + InputArray src, + InputArray mask, { + double alpha = 0.2, + double beta = 0.4, +}) async { + return cvRunAsync( + (callback) => CFFI.IlluminationChange_Async( + src.ref, + mask.ref, + alpha, + beta, + callback, + ), + (c, pdst) => c.complete(Mat.fromPointer(pdst.cast())), + ); +} + +Future textureFlatteningAsync( + InputArray src, + InputArray mask, { + double lowThreshold = 30, + double highThreshold = 45, + int kernelSize = 3, +}) async { + return cvRunAsync( + (callback) => CFFI.TextureFlattening_Async( + src.ref, + mask.ref, + lowThreshold, + highThreshold, + kernelSize, + callback, + ), + (c, pdst) => c.complete(Mat.fromPointer(pdst.cast())), + ); +} + +Future fastNlMeansDenoisingAsync( + InputArray src, { + double h = 3, + int templateWindowSize = 7, + int searchWindowSize = 21, +}) async { + return cvRunAsync( + (callback) => CFFI.FastNlMeansDenoisingWithParams_Async( + src.ref, + h, + templateWindowSize, + searchWindowSize, + callback, + ), + (c, pdst) => c.complete(Mat.fromPointer(pdst.cast())), + ); +} + +Future fastNlMeansDenoisingColoredAsync( + InputArray src, { + double h = 3, + double hColor = 3, + int templateWindowSize = 7, + int searchWindowSize = 21, +}) async { + return cvRunAsync( + (callback) => CFFI.FastNlMeansDenoisingColoredWithParams_Async( + src.ref, + h, + hColor, + templateWindowSize, + searchWindowSize, + callback, + ), + (c, pdst) => c.complete(Mat.fromPointer(pdst.cast())), + ); +} + +Future fastNlMeansDenoisingColoredMultiAsync( + VecMat srcImgs, + int imgToDenoiseIndex, + int temporalWindowSize, { + double h = 3, + double hColor = 3, + int templateWindowSize = 7, + int searchWindowSize = 21, +}) async { + return cvRunAsync( + (callback) => CFFI.FastNlMeansDenoisingColoredMultiWithParams_Async( + srcImgs.ref, + imgToDenoiseIndex, + temporalWindowSize, + h, + hColor, + templateWindowSize, + searchWindowSize, + callback, + ), + (c, pdst) => c.complete(Mat.fromPointer(pdst.cast())), + ); +} + +Future detailEnhanceAsync( + InputArray src, { + double sigmaS = 10, + double sigmaR = 0.15, +}) async { + return cvRunAsync( + (callback) => CFFI.DetailEnhance_Async( + src.ref, + sigmaS, + sigmaR, + callback, + ), + (c, pdst) => c.complete(Mat.fromPointer(pdst.cast())), + ); +} + +Future edgePreservingFilterAsync( + InputArray src, { + int flags = 1, + double sigmaS = 60, + double sigmaR = 0.4, +}) async { + return cvRunAsync( + (callback) => CFFI.EdgePreservingFilter_Async( + src.ref, + flags, + sigmaS, + sigmaR, + callback, + ), + (c, pdst) => c.complete(Mat.fromPointer(pdst.cast())), + ); +} + +Future<(Mat dst1, Mat dst2)> pencilSketchAsync( + InputArray src, { + double sigmaS = 60, + double sigmaR = 0.07, + double shadeFactor = 0.02, +}) async { + return cvRunAsync2( + (callback) => CFFI.PencilSketch_Async( + src.ref, + sigmaS, + sigmaR, + shadeFactor, + callback, + ), + (c, pdst1, pdst2) => c.complete( + (Mat.fromPointer(pdst1.cast()), Mat.fromPointer(pdst2.cast())), + ), + ); +} + +Future stylizationAsync( + InputArray src, { + double sigmaS = 60, + double sigmaR = 0.45, +}) async { + return cvRunAsync( + (callback) => CFFI.Stylization_Async( + src.ref, + sigmaS, + sigmaR, + callback, + ), + (c, pdst) => c.complete(Mat.fromPointer(pdst.cast())), + ); +} + +Future inpaintAsync( + InputArray src, + InputArray inpaintMask, + double inpaintRadius, + int flags, +) async { + return cvRunAsync( + (callback) => CFFI.PhotoInpaint_Async( + src.ref, + inpaintMask.ref, + inpaintRadius, + flags, + callback, + ), + (c, pdst) => c.complete(Mat.fromPointer(pdst.cast())), + ); +} diff --git a/lib/src/stitching/stitching.dart b/lib/src/stitching/stitching.dart index 8ccf16de..9ecef6ac 100644 --- a/lib/src/stitching/stitching.dart +++ b/lib/src/stitching/stitching.dart @@ -18,23 +18,18 @@ import '../opencv.g.dart' as cvg; /// stability and quality of the final images at least being familiar /// with the theory is recommended. /// https://docs.opencv.org/4.x/d2/d8d/classcv_1_1Stitcher.html#details -class Stitcher extends CvStruct { - Stitcher._(cvg.PtrStitcherPtr ptr, [bool attach = true]) : super.fromPointer(ptr) { +class Stitcher extends CvStruct { + Stitcher._(cvg.StitcherPtr ptr, [bool attach = true]) : super.fromPointer(ptr) { if (attach) { finalizer.attach(this, ptr.cast(), detach: this); } } - - cvg.Stitcher get stitcher { - final s = calloc(); - cvRun(() => CFFI.Stitcher_Get(ptr.ref, s)); - return s.ref; - } + factory Stitcher.fromPointer(cvg.StitcherPtr ptr, [bool attach = true]) => Stitcher._(ptr.cast(), attach); /// Creates a Stitcher configured in one of the stitching modes. /// https://docs.opencv.org/4.x/d2/d8d/classcv_1_1Stitcher.html#a308a47865a1f381e4429c8ec5e99549f factory Stitcher.create({StitcherMode mode = StitcherMode.PANORAMA}) { - final ptr_ = calloc(); + final ptr_ = calloc(); cvRun(() => CFFI.Stitcher_Create(mode.index, ptr_)); return Stitcher._(ptr_); } @@ -43,98 +38,98 @@ class Stitcher extends CvStruct { double get registrationResol { return using((arena) { final rptr = arena(); - cvRun(() => CFFI.Stitcher_GetRegistrationResol(stitcher, rptr)); + cvRun(() => CFFI.Stitcher_GetRegistrationResol(ref, rptr)); return rptr.value; }); } /// https://docs.opencv.org/4.x/d2/d8d/classcv_1_1Stitcher.html#a9912fe8c095b8385267908e5ef707439 set registrationResol(double value) { - cvRun(() => CFFI.Stitcher_SetRegistrationResol(stitcher, value)); + cvRun(() => CFFI.Stitcher_SetRegistrationResol(ref, value)); } /// https://docs.opencv.org/4.x/d2/d8d/classcv_1_1Stitcher.html#ac559c3eb228614f9402ff3eba23a08f5 double get seamEstimationResol { return using((arena) { final rptr = arena(); - cvRun(() => CFFI.Stitcher_GetSeamEstimationResol(stitcher, rptr)); + cvRun(() => CFFI.Stitcher_GetSeamEstimationResol(ref, rptr)); return rptr.value; }); } /// https://docs.opencv.org/4.x/d2/d8d/classcv_1_1Stitcher.html#ad0fcef52b2fedda1dbb90ea780cd7979 set seamEstimationResol(double value) { - cvRun(() => CFFI.Stitcher_SetSeamEstimationResol(stitcher, value)); + cvRun(() => CFFI.Stitcher_SetSeamEstimationResol(ref, value)); } /// https://docs.opencv.org/4.x/d2/d8d/classcv_1_1Stitcher.html#ad13d2d50b253e471fbaf041b9a044571 double get compositingResol { return using((arena) { final rptr = arena(); - cvRun(() => CFFI.Stitcher_GetCompositingResol(stitcher, rptr)); + cvRun(() => CFFI.Stitcher_GetCompositingResol(ref, rptr)); return rptr.value; }); } /// https://docs.opencv.org/4.x/d2/d8d/classcv_1_1Stitcher.html#afe927e80fcb2ca2061630ddd98eebba8 set compositingResol(double value) { - cvRun(() => CFFI.Stitcher_SetCompositingResol(stitcher, value)); + cvRun(() => CFFI.Stitcher_SetCompositingResol(ref, value)); } /// https://docs.opencv.org/4.x/d2/d8d/classcv_1_1Stitcher.html#a3755bbeca7f4c80dc42af034f7621568 double get panoConfidenceThresh { return using((arena) { final rptr = arena(); - cvRun(() => CFFI.Stitcher_GetPanoConfidenceThresh(stitcher, rptr)); + cvRun(() => CFFI.Stitcher_GetPanoConfidenceThresh(ref, rptr)); return rptr.value; }); } /// https://docs.opencv.org/4.x/d2/d8d/classcv_1_1Stitcher.html#a6f5e62bc1dd5d7bdb5f9313a2c21c558 set panoConfidenceThresh(double value) { - cvRun(() => CFFI.Stitcher_SetPanoConfidenceThresh(stitcher, value)); + cvRun(() => CFFI.Stitcher_SetPanoConfidenceThresh(ref, value)); } /// https://docs.opencv.org/4.x/d2/d8d/classcv_1_1Stitcher.html#af6a51e0b23dac119a3612d57345f9a7f bool get waveCorrection { return using((arena) { final rptr = arena(); - cvRun(() => CFFI.Stitcher_GetWaveCorrection(stitcher, rptr)); + cvRun(() => CFFI.Stitcher_GetWaveCorrection(ref, rptr)); return rptr.value; }); } /// https://docs.opencv.org/4.x/d2/d8d/classcv_1_1Stitcher.html#a968a2f4a1faddfdacbcfce54b44bab70 set waveCorrection(bool value) { - cvRun(() => CFFI.Stitcher_SetWaveCorrection(stitcher, value)); + cvRun(() => CFFI.Stitcher_SetWaveCorrection(ref, value)); } /// https://docs.opencv.org/4.x/d2/d8d/classcv_1_1Stitcher.html#abc0c8f54a1d223a1098206654813d973 int get interpolationFlags { return using((arena) { final rptr = arena(); - cvRun(() => CFFI.Stitcher_GetInterpolationFlags(stitcher, rptr)); + cvRun(() => CFFI.Stitcher_GetInterpolationFlags(ref, rptr)); return rptr.value; }); } /// https://docs.opencv.org/4.x/d2/d8d/classcv_1_1Stitcher.html#a253d04b8dcd3c674321b29139c769873 set interpolationFlags(int value) { - cvRun(() => CFFI.Stitcher_SetInterpolationFlags(stitcher, value)); + cvRun(() => CFFI.Stitcher_SetInterpolationFlags(ref, value)); } /// https://docs.opencv.org/4.x/d2/d8d/classcv_1_1Stitcher.html#ad9c9c9b8a97b686ad3b93f7918c4c6de int get waveCorrectKind { return using((arena) { final rptr = arena(); - cvRun(() => CFFI.Stitcher_GetWaveCorrectKind(stitcher, rptr)); + cvRun(() => CFFI.Stitcher_GetWaveCorrectKind(ref, rptr)); return rptr.value; }); } /// https://docs.opencv.org/4.x/d2/d8d/classcv_1_1Stitcher.html#a17413f5c06e4e569bfd45e01d4e8ff4a set waveCorrectKind(int value) { - cvRun(() => CFFI.Stitcher_SetWaveCorrectKind(stitcher, value)); + cvRun(() => CFFI.Stitcher_SetWaveCorrectKind(ref, value)); } /// These functions try to match the given images and to estimate rotations of each camera. @@ -143,7 +138,7 @@ class Stitcher extends CvStruct { return using((arena) { final rptr = arena(); masks ??= VecMat.fromList([]); - cvRun(() => CFFI.Stitcher_EstimateTransform(stitcher, images.ref, masks!.ref, rptr)); + cvRun(() => CFFI.Stitcher_EstimateTransform(ref, images.ref, masks!.ref, rptr)); return StitcherStatus.fromInt(rptr.value); }); } @@ -157,8 +152,8 @@ class Stitcher extends CvStruct { final rptr = arena(); final rpano = Mat.empty(); images == null - ? cvRun(() => CFFI.Stitcher_ComposePanorama(stitcher, rpano.ref, rptr)) - : cvRun(() => CFFI.Stitcher_ComposePanorama_1(stitcher, images.ref, rpano.ref, rptr)); + ? cvRun(() => CFFI.Stitcher_ComposePanorama(ref, rpano.ref, rptr)) + : cvRun(() => CFFI.Stitcher_ComposePanorama_1(ref, images.ref, rpano.ref, rptr)); return (StitcherStatus.fromInt(rptr.value), rpano); }); } @@ -171,8 +166,8 @@ class Stitcher extends CvStruct { final rptr = arena(); final rpano = Mat.empty(); masks == null - ? cvRun(() => CFFI.Stitcher_Stitch(stitcher, images.ref, rpano.ref, rptr)) - : cvRun(() => CFFI.Stitcher_Stitch_1(stitcher, images.ref, masks.ref, rpano.ref, rptr)); + ? cvRun(() => CFFI.Stitcher_Stitch(ref, images.ref, rpano.ref, rptr)) + : cvRun(() => CFFI.Stitcher_Stitch_1(ref, images.ref, masks.ref, rpano.ref, rptr)); return (StitcherStatus.fromInt(rptr.value), rpano); }); } @@ -180,11 +175,11 @@ class Stitcher extends CvStruct { /// https://docs.opencv.org/4.x/d2/d8d/classcv_1_1Stitcher.html#a7fed80561a9b46a1a924ac6cb334ac85 VecInt get component { final rptr = calloc(); - cvRun(() => CFFI.Stitcher_Component(stitcher, rptr)); + cvRun(() => CFFI.Stitcher_Component(ref, rptr)); return VecInt.fromPointer(rptr); } - static final finalizer = OcvFinalizer(CFFI.addresses.Stitcher_Close); + static final finalizer = OcvFinalizer(CFFI.addresses.Stitcher_Close); void dispose() { finalizer.detach(this); @@ -195,7 +190,7 @@ class Stitcher extends CvStruct { List get props => [ptr.address]; @override - cvg.PtrStitcher get ref => ptr.ref; + cvg.Stitcher get ref => ptr.ref; } /// https://docs.opencv.org/4.x/d2/d8d/classcv_1_1Stitcher.html#a507409ce9435dd89857469d12ec06b45 diff --git a/lib/src/stitching/stitching_async.dart b/lib/src/stitching/stitching_async.dart new file mode 100644 index 00000000..42ccdf78 --- /dev/null +++ b/lib/src/stitching/stitching_async.dart @@ -0,0 +1,176 @@ +library cv; + +import 'dart:ffi' as ffi; +import 'package:ffi/ffi.dart'; + +import '../core/base.dart'; +import '../core/mat.dart'; +import '../core/vec.dart'; +import '../opencv.g.dart' as cvg; +import './stitching.dart'; + +extension StitcherAsync on Stitcher { + static Future createAsync({ + StitcherMode mode = StitcherMode.PANORAMA, + }) async => + cvRunAsync( + (callback) => CFFI.Stitcher_Create_Async(mode.index, callback), + (c, p) => c.complete(Stitcher.fromPointer(p.cast())), + ); + + Future getRegistrationResolAsync() async => cvRunAsync( + (callback) => CFFI.Stitcher_GetRegistrationResol_Async(ref, callback), + doubleCompleter, + ); + + Future setRegistrationResolAsync(double value) async => cvRunAsync0( + (callback) => CFFI.Stitcher_SetRegistrationResol_Async(ref, value, callback), + (c) => c.complete(), + ); + + Future getSeamEstimationResolAsync() async { + return cvRunAsync( + (callback) => CFFI.Stitcher_GetSeamEstimationResol_Async(ref, callback), + doubleCompleter, + ); + } + + Future setSeamEstimationResolAsync(double value) async => cvRunAsync0( + (callback) => CFFI.Stitcher_SetSeamEstimationResol_Async(ref, value, callback), + (c) => c.complete(), + ); + + Future getCompositingResolAsync() async { + return cvRunAsync( + (callback) => CFFI.Stitcher_GetCompositingResol_Async(ref, callback), + doubleCompleter, + ); + } + + Future setCompositingResolAsync(double value) async => cvRunAsync0( + (callback) => CFFI.Stitcher_SetCompositingResol_Async(ref, value, callback), + (c) => c.complete(), + ); + + Future getPanoConfidenceThreshAsync() async { + return cvRunAsync( + (callback) => CFFI.Stitcher_GetPanoConfidenceThresh_Async(ref, callback), + doubleCompleter, + ); + } + + Future setPanoConfidenceThreshAsync(double value) async => cvRunAsync0( + (callback) => CFFI.Stitcher_SetPanoConfidenceThresh_Async( + ref, + value, + callback, + ), + (c) => c.complete(), + ); + + Future getWaveCorrectionAsync() async { + return cvRunAsync( + (callback) => CFFI.Stitcher_GetWaveCorrection_Async(ref, callback), + boolCompleter, + ); + } + + Future setWaveCorrectionAsync(bool value) async => cvRunAsync0( + (callback) => CFFI.Stitcher_SetWaveCorrection_Async(ref, value, callback), + (c) => c.complete(), + ); + + Future getInterpolationFlagsAsync() async { + return cvRunAsync( + (callback) => CFFI.Stitcher_GetInterpolationFlags_Async(ref, callback), + intCompleter, + ); + } + + Future setInterpolationFlagsAsync(int value) async => cvRunAsync0( + (callback) => CFFI.Stitcher_SetInterpolationFlags_Async(ref, value, callback), + (c) => c.complete(), + ); + + Future getWaveCorrectKindAsync() async { + return cvRunAsync( + (callback) => CFFI.Stitcher_GetWaveCorrectKind_Async(ref, callback), + intCompleter, + ); + } + + Future setWaveCorrectKindAsync(int value) async => cvRunAsync0( + (callback) => CFFI.Stitcher_SetWaveCorrectKind_Async(ref, value, callback), + (c) => c.complete(), + ); + + Future estimateTransformAsync( + VecMat images, { + VecMat? masks, + }) async { + masks ??= VecMat.fromList([]); + return cvRunAsync( + (callback) => CFFI.Stitcher_EstimateTransform_Async( + ref, + images.ref, + masks!.ref, + callback, + ), (c, p) { + final value = p.cast().value; + calloc.free(p); + return c.complete(StitcherStatus.fromInt(value)); + }); + } + + Future<(StitcherStatus, Mat)> composePanoramaAsync({VecMat? images}) async { + return cvRunAsync2( + (callback) => images == null + ? CFFI.Stitcher_ComposePanorama_Async( + ref, + callback, + ) + : CFFI.Stitcher_ComposePanorama_1_Async( + ref, + images.ref, + callback, + ), (c, status, pano) { + final value = status.cast().value; + calloc.free(status); + return c.complete( + (StitcherStatus.fromInt(value), Mat.fromPointer(pano.cast())), + ); + }); + } + + Future<(StitcherStatus, Mat)> stitchAsync( + VecMat images, { + VecMat? masks, + }) async { + return cvRunAsync2( + (callback) => masks == null + ? CFFI.Stitcher_Stitch_Async( + ref, + images.ref, + callback, + ) + : CFFI.Stitcher_Stitch_1_Async( + ref, + images.ref, + masks.ref, + callback, + ), (c, status, pano) { + final value = status.cast().value; + calloc.free(status); + return c.complete( + (StitcherStatus.fromInt(value), Mat.fromPointer(pano.cast())), + ); + }); + } + + Future getComponentAsync() async { + return cvRunAsync( + (callback) => CFFI.Stitcher_Component_Async(ref, callback), + (c, p) => c.complete(VecInt.fromPointer(p.cast())), + ); + } +} diff --git a/lib/src/svd/svd.dart b/lib/src/svd/svd.dart index 72ec2b8a..8ed43e75 100644 --- a/lib/src/svd/svd.dart +++ b/lib/src/svd/svd.dart @@ -1,13 +1,41 @@ -library cv; +library cv.svd; + +import 'dart:ffi' as ffi; + +import 'package:ffi/ffi.dart'; import '../core/base.dart'; import '../core/mat.dart'; +import '../opencv.g.dart' as cvg; /// SVDCompute decomposes matrix and stores the results to user-provided matrices /// /// https://docs.opencv.org/4.1.2/df/df7/classcv_1_1SVD.html#a76f0b2044df458160292045a3d3714c6 class SVD { - static void compute(Mat src, Mat w, Mat u, Mat vt, {int flags = 0}) { - cvRun(() => CFFI.SVD_Compute(src.ref, w.ref, u.ref, vt.ref, flags)); + /// decomposes matrix and stores the results to user-provided matrices + /// The methods/functions perform SVD of matrix. + /// + /// https://docs.opencv.org/4.1.2/df/df7/classcv_1_1SVD.html#a76f0b2044df458160292045a3d3714c6 + static (Mat w, Mat u, Mat vt) compute(Mat src, {Mat? w, Mat? u, Mat? vt, int flags = 0}) { + final pw = w?.ptr ?? calloc(); + final pu = u?.ptr ?? calloc(); + final pvt = vt?.ptr ?? calloc(); + cvRun(() => CFFI.SVD_Compute(src.ref, pw, pu, pvt, flags)); + return (w ?? Mat.fromPointer(pw), u ?? Mat.fromPointer(pu), vt ?? Mat.fromPointer(pvt)); + } + + /// async version of [compute] + static Future<(Mat w, Mat u, Mat vt)> computeAsync(Mat src, {int flags = 0}) async => + cvRunAsync3((callback) => CFFI.SVD_Compute_Async(src.ref, flags, callback), matCompleter3); + + static Mat backSubst(Mat w, Mat u, Mat vt, Mat rhs, {Mat? dst}) { + final pdst = dst?.ptr ?? calloc(); + cvRun(() => CFFI.SVD_backSubst(w.ref, u.ref, vt.ref, rhs.ref, pdst)); + return dst ?? Mat.fromPointer(pdst); } + + static Future backSubstAsync(Mat w, Mat u, Mat vt, Mat rhs, {Mat? dst}) async => cvRunAsync( + (callback) => CFFI.SVD_backSubst_Async(w.ref, u.ref, vt.ref, rhs.ref, callback), + matCompleter, + ); } diff --git a/lib/src/utils/bytesio.dart b/lib/src/utils/bytesio.dart deleted file mode 100644 index 8b137891..00000000 --- a/lib/src/utils/bytesio.dart +++ /dev/null @@ -1 +0,0 @@ - diff --git a/lib/src/video/video.dart b/lib/src/video/video.dart index 98cdf80d..b09728fa 100644 --- a/lib/src/video/video.dart +++ b/lib/src/video/video.dart @@ -189,31 +189,29 @@ Mat calcOpticalFlowFarneback( VecPoint2f nextPts, { VecUChar? status, VecFloat? err, - Size winSize = (21, 21), + (int, int) winSize = (21, 21), int maxLevel = 3, - TermCriteria criteria = (TERM_COUNT + TERM_EPS, 30, 1e-4), + (int, int, double) criteria = (TERM_COUNT + TERM_EPS, 30, 1e-4), int flags = 0, double minEigThreshold = 1e-4, }) { final s = status?.ptr ?? calloc(); final e = err?.ptr ?? calloc(); - cvRunArena((arena) { - cvRun( - () => CFFI.CalcOpticalFlowPyrLKWithParams( - prevImg.ref, - nextImg.ref, - prevPts.ref, - nextPts.ref, - s, - e, - winSize.toSize(arena).ref, - maxLevel, - criteria.toNativePtr(arena).ref, - flags, - minEigThreshold, - ), - ); - }); + cvRun( + () => CFFI.CalcOpticalFlowPyrLKWithParams( + prevImg.ref, + nextImg.ref, + prevPts.ref, + nextPts.ref, + s, + e, + winSize.cvd.ref, + maxLevel, + criteria.toTermCriteria().ref, + flags, + minEigThreshold, + ), + ); return (nextPts, status ?? VecUChar.fromPointer(s), VecFloat.fromPointer(e)); } @@ -226,7 +224,7 @@ Mat calcOpticalFlowFarneback( InputArray inputImage, InputOutputArray warpMatrix, int motionType, - TermCriteria criteria, + (int, int, double) criteria, InputArray inputMask, int gaussFiltSize, ) { @@ -238,7 +236,7 @@ Mat calcOpticalFlowFarneback( inputImage.ref, warpMatrix.ref, motionType, - criteria.toNativePtr(arena).ref, + criteria.toTermCriteria().ref, inputMask.ref, gaussFiltSize, p, 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 6e86259e..e54b8b37 100644 --- a/lib/src/video/videoio.dart +++ b/lib/src/video/videoio.dart @@ -8,7 +8,6 @@ import 'package:ffi/ffi.dart'; import '../constants.g.dart'; import '../core/base.dart'; import '../core/mat.dart'; -import '../core/size.dart'; import '../opencv.g.dart' as cvg; class VideoCapture extends CvStruct { @@ -18,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)); @@ -41,11 +42,9 @@ class VideoCapture extends CvStruct { } factory VideoCapture.fromDevice(int device, {int apiPreference = CAP_ANY}) { - return using((arena) { - final p = calloc(); - cvRun(() => CFFI.VideoCapture_NewFromIndex(device, apiPreference, p)); - return VideoCapture._(p); - }); + final p = calloc(); + cvRun(() => CFFI.VideoCapture_NewFromIndex(device, apiPreference, p)); + return VideoCapture._(p); } @override @@ -158,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)); @@ -168,7 +169,7 @@ class VideoWriter extends CvStruct { String filename, String codec, double fps, - Size frameSize, { + (int, int) frameSize, { bool isColor = true, }) { return cvRunArena((arena) { @@ -191,7 +192,7 @@ class VideoWriter extends CvStruct { }); } - void open(String filename, String codec, double fps, Size frameSize, {bool isColor = true}) { + void open(String filename, String codec, double fps, (int, int) frameSize, {bool isColor = true}) { using((arena) { final name = filename.toNativeUtf8(allocator: arena); final codec_ = codec.toNativeUtf8(allocator: arena); 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/pubspec.yaml b/pubspec.yaml index e50292e0..2c382d61 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.0.10+1 homepage: https://github.com/rainyl/opencv_dart environment: - sdk: ">=3.2.4 <4.0.0" + sdk: ">=3.3.0 <4.0.0" flutter: ">=3.0.0" dependencies: diff --git a/scripts/pre-commit b/scripts/pre-commit new file mode 100644 index 00000000..e69de29b diff --git a/src/calib3d/calib3d.cpp b/src/calib3d/calib3d.cpp index 298dd769..d82590d9 100644 --- a/src/calib3d/calib3d.cpp +++ b/src/calib3d/calib3d.cpp @@ -8,59 +8,81 @@ #include "calib3d.h" -CvStatus *Fisheye_UndistortImage(Mat distorted, Mat undistorted, Mat k, Mat d) -{ +CvStatus *Fisheye_UndistortImage(Mat distorted, Mat undistorted, Mat k, Mat d) { BEGIN_WRAP cv::fisheye::undistortImage(*distorted.ptr, *undistorted.ptr, *k.ptr, *d.ptr); END_WRAP } -CvStatus *Fisheye_UndistortImageWithParams(Mat distorted, Mat undistorted, Mat k, Mat d, Mat knew, Size size) -{ +CvStatus *Fisheye_UndistortImageWithParams( + Mat distorted, Mat undistorted, Mat k, Mat d, Mat knew, Size size +) { BEGIN_WRAP cv::Size sz(size.width, size.height); cv::fisheye::undistortImage(*distorted.ptr, *undistorted.ptr, *k.ptr, *d.ptr, *knew.ptr, sz); END_WRAP } -CvStatus *Fisheye_UndistortPoints(Mat distorted, Mat undistorted, Mat k, Mat d, Mat r, Mat p) -{ +CvStatus *Fisheye_UndistortPoints(Mat distorted, Mat undistorted, Mat k, Mat d, Mat r, Mat p) { BEGIN_WRAP cv::fisheye::undistortPoints(*distorted.ptr, *undistorted.ptr, *k.ptr, *d.ptr, *r.ptr, *p.ptr); END_WRAP } -CvStatus *Fisheye_EstimateNewCameraMatrixForUndistortRectify(Mat k, Mat d, Size imgSize, Mat r, Mat p, - double balance, Size newSize, double fovScale) -{ +CvStatus *Fisheye_EstimateNewCameraMatrixForUndistortRectify( + Mat k, Mat d, Size imgSize, Mat r, Mat p, double balance, Size newSize, double fovScale +) { BEGIN_WRAP cv::Size newSz(newSize.width, newSize.height); cv::Size imgSz(imgSize.width, imgSize.height); - cv::fisheye::estimateNewCameraMatrixForUndistortRectify(*k.ptr, *d.ptr, imgSz, *r.ptr, *p.ptr, balance, - newSz, fovScale); + cv::fisheye::estimateNewCameraMatrixForUndistortRectify( + *k.ptr, *d.ptr, imgSz, *r.ptr, *p.ptr, balance, newSz, fovScale + ); END_WRAP } -CvStatus *InitUndistortRectifyMap(Mat cameraMatrix, Mat distCoeffs, Mat r, Mat newCameraMatrix, Size size, - int m1type, Mat map1, Mat map2) -{ +CvStatus *InitUndistortRectifyMap( + Mat cameraMatrix, + Mat distCoeffs, + Mat r, + Mat newCameraMatrix, + Size size, + int m1type, + Mat map1, + Mat map2 +) { BEGIN_WRAP cv::Size sz(size.width, size.height); - cv::initUndistortRectifyMap(*cameraMatrix.ptr, *distCoeffs.ptr, *r.ptr, *newCameraMatrix.ptr, sz, m1type, - *map1.ptr, *map2.ptr); - END_WRAP -} - -CvStatus *GetOptimalNewCameraMatrixWithParams(Mat cameraMatrix, Mat distCoeffs, Size size, double alpha, - Size newImgSize, Rect *validPixROI, bool centerPrincipalPoint, - Mat *rval) -{ + cv::initUndistortRectifyMap( + *cameraMatrix.ptr, + *distCoeffs.ptr, + *r.ptr, + *newCameraMatrix.ptr, + sz, + m1type, + *map1.ptr, + *map2.ptr + ); + END_WRAP +} + +CvStatus *GetOptimalNewCameraMatrixWithParams( + Mat cameraMatrix, + Mat distCoeffs, + Size size, + double alpha, + Size newImgSize, + Rect *validPixROI, + bool centerPrincipalPoint, + Mat *rval +) { BEGIN_WRAP cv::Size sz(size.width, size.height); cv::Size newSize(newImgSize.width, newImgSize.height); cv::Rect rect(validPixROI->x, validPixROI->y, validPixROI->width, validPixROI->height); - cv::Mat *mat = new cv::Mat(cv::getOptimalNewCameraMatrix(*cameraMatrix.ptr, *distCoeffs.ptr, sz, alpha, - newSize, &rect, centerPrincipalPoint)); + cv::Mat *mat = new cv::Mat(cv::getOptimalNewCameraMatrix( + *cameraMatrix.ptr, *distCoeffs.ptr, sz, alpha, newSize, &rect, centerPrincipalPoint + )); validPixROI->x = rect.x; validPixROI->y = rect.y; validPixROI->width = rect.width; @@ -69,96 +91,136 @@ CvStatus *GetOptimalNewCameraMatrixWithParams(Mat cameraMatrix, Mat distCoeffs, END_WRAP } -CvStatus *CalibrateCamera(VecVecPoint3f objectPoints, VecVecPoint2f imagePoints, Size imageSize, - Mat cameraMatrix, Mat distCoeffs, Mat rvecs, Mat tvecs, int flag, - TermCriteria criteria, double *rval) -{ +CvStatus *CalibrateCamera( + VecVecPoint3f objectPoints, + VecVecPoint2f imagePoints, + Size imageSize, + Mat cameraMatrix, + Mat distCoeffs, + Mat rvecs, + Mat tvecs, + int flag, + TermCriteria criteria, + double *rval +) { BEGIN_WRAP auto tc = cv::TermCriteria(criteria.type, criteria.maxCount, criteria.epsilon); - *rval = - cv::calibrateCamera(*objectPoints.ptr, *imagePoints.ptr, cv::Size(imageSize.width, imageSize.height), - *cameraMatrix.ptr, *distCoeffs.ptr, *rvecs.ptr, *tvecs.ptr, flag, tc); + *rval = cv::calibrateCamera( + *objectPoints.ptr, + *imagePoints.ptr, + cv::Size(imageSize.width, imageSize.height), + *cameraMatrix.ptr, + *distCoeffs.ptr, + *rvecs.ptr, + *tvecs.ptr, + flag, + tc + ); END_WRAP } -CvStatus *Undistort(Mat src, Mat dst, Mat cameraMatrix, Mat distCoeffs, Mat newCameraMatrix) -{ +CvStatus *Undistort(Mat src, Mat dst, Mat cameraMatrix, Mat distCoeffs, Mat newCameraMatrix) { BEGIN_WRAP cv::undistort(*src.ptr, *dst.ptr, *cameraMatrix.ptr, *distCoeffs.ptr, *newCameraMatrix.ptr); END_WRAP } -CvStatus *UndistortPoints(Mat distorted, Mat undistorted, Mat k, Mat d, Mat r, Mat p, TermCriteria criteria) -{ +CvStatus * +UndistortPoints(Mat distorted, Mat undistorted, Mat k, Mat d, Mat r, Mat p, TermCriteria criteria) { BEGIN_WRAP auto tc = cv::TermCriteria(criteria.type, criteria.maxCount, criteria.epsilon); cv::undistortPoints(*distorted.ptr, *undistorted.ptr, *k.ptr, *d.ptr, *r.ptr, *p.ptr, tc); END_WRAP } -CvStatus *FindChessboardCorners(Mat image, Size patternSize, Mat corners, int flags, bool *rval) -{ +CvStatus *FindChessboardCorners(Mat image, Size patternSize, Mat corners, int flags, bool *rval) { BEGIN_WRAP cv::Size sz(patternSize.width, patternSize.height); *rval = cv::findChessboardCorners(*image.ptr, sz, *corners.ptr, flags); END_WRAP } -CvStatus *FindChessboardCornersSB(Mat image, Size patternSize, Mat corners, int flags, bool *rval) -{ +CvStatus *FindChessboardCornersSB(Mat image, Size patternSize, Mat corners, int flags, bool *rval) { BEGIN_WRAP cv::Size sz(patternSize.width, patternSize.height); *rval = cv::findChessboardCornersSB(*image.ptr, sz, *corners.ptr, flags); END_WRAP } -CvStatus *FindChessboardCornersSBWithMeta(Mat image, Size patternSize, Mat corners, int flags, Mat meta, - bool *rval) -{ +CvStatus *FindChessboardCornersSBWithMeta( + Mat image, Size patternSize, Mat corners, int flags, Mat meta, bool *rval +) { BEGIN_WRAP cv::Size sz(patternSize.width, patternSize.height); *rval = cv::findChessboardCornersSB(*image.ptr, sz, *corners.ptr, flags, *meta.ptr); END_WRAP } -CvStatus *DrawChessboardCorners(Mat image, Size patternSize, Mat corners, bool patternWasFound) -{ +CvStatus *DrawChessboardCorners(Mat image, Size patternSize, Mat corners, bool patternWasFound) { BEGIN_WRAP cv::Size sz(patternSize.width, patternSize.height); cv::drawChessboardCorners(*image.ptr, sz, *corners.ptr, patternWasFound); END_WRAP } -CvStatus *EstimateAffinePartial2D(VecPoint2f from, VecPoint2f to, Mat *rval) -{ +CvStatus *EstimateAffinePartial2D(VecPoint2f from, VecPoint2f to, Mat *rval) { BEGIN_WRAP *rval = {new cv::Mat(cv::estimateAffinePartial2D(*from.ptr, *to.ptr))}; END_WRAP } -CvStatus *EstimateAffinePartial2DWithParams(VecPoint2f from, VecPoint2f to, Mat inliers, int method, - double ransacReprojThreshold, size_t maxIters, double confidence, - size_t refineIters, Mat *rval) -{ +CvStatus *EstimateAffinePartial2DWithParams( + VecPoint2f from, + VecPoint2f to, + Mat inliers, + int method, + double ransacReprojThreshold, + size_t maxIters, + double confidence, + size_t refineIters, + Mat *rval +) { BEGIN_WRAP *rval = {new cv::Mat(cv::estimateAffinePartial2D( - *from.ptr, *to.ptr, *inliers.ptr, method, ransacReprojThreshold, maxIters, confidence, refineIters))}; + *from.ptr, + *to.ptr, + *inliers.ptr, + method, + ransacReprojThreshold, + maxIters, + confidence, + refineIters + ))}; END_WRAP } -CvStatus *EstimateAffine2D(VecPoint2f from, VecPoint2f to, Mat *rval) -{ +CvStatus *EstimateAffine2D(VecPoint2f from, VecPoint2f to, Mat *rval) { BEGIN_WRAP *rval = {new cv::Mat(cv::estimateAffine2D(*from.ptr, *to.ptr))}; END_WRAP } -CvStatus *EstimateAffine2DWithParams(VecPoint2f from, VecPoint2f to, Mat inliers, int method, - double ransacReprojThreshold, size_t maxIters, double confidence, - size_t refineIters, Mat *rval) -{ - BEGIN_WRAP - *rval = {new cv::Mat(cv::estimateAffine2D(*from.ptr, *to.ptr, *inliers.ptr, method, ransacReprojThreshold, - maxIters, confidence, refineIters))}; +CvStatus *EstimateAffine2DWithParams( + VecPoint2f from, + VecPoint2f to, + Mat inliers, + int method, + double ransacReprojThreshold, + size_t maxIters, + double confidence, + size_t refineIters, + Mat *rval +) { + BEGIN_WRAP + *rval = {new cv::Mat(cv::estimateAffine2D( + *from.ptr, + *to.ptr, + *inliers.ptr, + method, + ransacReprojThreshold, + maxIters, + confidence, + refineIters + ))}; END_WRAP } diff --git a/src/calib3d/calib3d_async.cpp b/src/calib3d/calib3d_async.cpp new file mode 100644 index 00000000..41c982a2 --- /dev/null +++ b/src/calib3d/calib3d_async.cpp @@ -0,0 +1,265 @@ +#include "calib3d_async.h" +#include "core/types.h" +#include + +CvStatus *fisheye_undistortImage_Async(Mat distorted, Mat k, Mat d, CVD_OUT CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::fisheye::undistortImage(*distorted.ptr, dst, *k.ptr, *d.ptr); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *fisheye_undistortImageWithParams_Async( + Mat distorted, Mat k, Mat d, Mat knew, Size size, CVD_OUT CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat dst; + cv::fisheye::undistortImage( + *distorted.ptr, dst, *k.ptr, *d.ptr, *knew.ptr, cv::Size(size.width, size.height) + ); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *fisheye_undistortPoints_Async( + Mat distorted, Mat k, Mat d, Mat R, Mat P, CVD_OUT CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat dst; + cv::fisheye::undistortPoints(*distorted.ptr, dst, *k.ptr, *d.ptr, *R.ptr, *P.ptr); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *fisheye_estimateNewCameraMatrixForUndistortRectify_Async( + Mat k, + Mat d, + Size imgSize, + Mat r, + double balance, + Size newSize, + double fovScale, + CVD_OUT CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat dst; + cv::fisheye::estimateNewCameraMatrixForUndistortRectify( + *k.ptr, + *d.ptr, + cv::Size(imgSize.width, imgSize.height), + *r.ptr, + dst, + balance, + cv::Size(newSize.width, newSize.height), + fovScale + ); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +// calib3d +CvStatus *calibrateCamera_Async( + VecVecPoint3f objectPoints, + VecVecPoint2f imagePoints, + Size imageSize, + Mat cameraMatrix, + Mat distCoeffs, + int flag, + TermCriteria criteria, + CVD_OUT CvCallback_5 callback +) { + BEGIN_WRAP + auto tc = cv::TermCriteria(criteria.type, criteria.maxCount, criteria.epsilon); + cv::Mat rvecs; + cv::Mat tvecs; + auto rval = cv::calibrateCamera( + *objectPoints.ptr, + *imagePoints.ptr, + cv::Size(imageSize.width, imageSize.height), + *cameraMatrix.ptr, + *distCoeffs.ptr, + rvecs, + tvecs, + flag, + tc + ); + callback( + new double(rval), + new Mat{new cv::Mat(*cameraMatrix.ptr)}, + new Mat{new cv::Mat(*distCoeffs.ptr)}, + new Mat{new cv::Mat(rvecs)}, + new Mat{new cv::Mat(tvecs)} + ); + END_WRAP +} +CvStatus *drawChessboardCorners_Async( + Mat image, Size patternSize, bool patternWasFound, CVD_OUT CvCallback_0 callback +) { + BEGIN_WRAP + cv::Mat dst; + cv::drawChessboardCorners( + *image.ptr, cv::Size(patternSize.width, patternSize.height), dst, patternWasFound + ); + callback(); + END_WRAP +} +CvStatus *estimateAffinePartial2D_Async(VecPoint2f from, VecPoint2f to, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::estimateAffinePartial2D(*from.ptr, *to.ptr, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} +CvStatus *estimateAffinePartial2DWithParams_Async( + VecPoint2f from, + VecPoint2f to, + int method, + double ransacReprojThreshold, + size_t maxIters, + double confidence, + size_t refineIters, + CVD_OUT CvCallback_2 callback +) { + BEGIN_WRAP + cv::Mat inliers; + cv::Mat dst = cv::estimateAffinePartial2D( + *from.ptr, *to.ptr, inliers, method, ransacReprojThreshold, maxIters, confidence, refineIters + ); + callback(new Mat{new cv::Mat(dst)}, new Mat{new cv::Mat(inliers)}); + END_WRAP +} +CvStatus *estimateAffine2D_Async(VecPoint2f from, VecPoint2f to, CVD_OUT CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::estimateAffine2D(*from.ptr, *to.ptr, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} +CvStatus *estimateAffine2DWithParams_Async( + VecPoint2f from, + VecPoint2f to, + int method, + double ransacReprojThreshold, + size_t maxIters, + double confidence, + size_t refineIters, + CVD_OUT CvCallback_2 callback +) { + BEGIN_WRAP + cv::Mat inliers; + cv::Mat dst = cv::estimateAffine2D( + *from.ptr, *to.ptr, inliers, method, ransacReprojThreshold, maxIters, confidence, refineIters + ); + callback(new Mat{new cv::Mat(dst)}, new Mat{new cv::Mat(inliers)}); + END_WRAP +} +CvStatus * +findChessboardCorners_Async(Mat image, Size patternSize, int flags, CvCallback_2 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::Mat dst2; + auto rval = cv::findChessboardCorners( + *image.ptr, cv::Size(patternSize.width, patternSize.height), dst, flags + ); + callback(new bool(rval), new Mat{new cv::Mat(dst)}); + END_WRAP +} +CvStatus * +findChessboardCornersSB_Async(Mat image, Size patternSize, int flags, CvCallback_2 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::Mat dst2; + auto rval = cv::findChessboardCornersSB( + *image.ptr, cv::Size(patternSize.width, patternSize.height), dst, flags + ); + callback(new bool(rval), new Mat{new cv::Mat(dst)}); + END_WRAP +} +CvStatus *findChessboardCornersSBWithMeta_Async( + Mat image, Size patternSize, int flags, CVD_OUT CvCallback_3 callback +) { + BEGIN_WRAP + cv::Mat dst; + cv::Mat dst2; + auto rval = cv::findChessboardCornersSB( + *image.ptr, cv::Size(patternSize.width, patternSize.height), dst, flags, dst2 + ); + callback(new bool(rval), new Mat{new cv::Mat(dst)}, new Mat{new cv::Mat(dst2)}); + END_WRAP +} +CvStatus *getOptimalNewCameraMatrix_Async( + Mat cameraMatrix, + Mat distCoeffs, + Size size, + double alpha, + Size newImgSize, + bool centerPrincipalPoint, + CVD_OUT CvCallback_2 callback +) { + BEGIN_WRAP + cv::Rect dst; + auto rval = cv::getOptimalNewCameraMatrix( + *cameraMatrix.ptr, + *distCoeffs.ptr, + cv::Size(size.width, size.height), + alpha, + cv::Size(newImgSize.width, newImgSize.height), + &dst, + centerPrincipalPoint + ); + callback(new Mat{new cv::Mat(rval)}, new Rect{dst.x, dst.y, dst.width, dst.height}); + END_WRAP +} +CvStatus *initUndistortRectifyMap_Async( + Mat cameraMatrix, + Mat distCoeffs, + Mat r, + Mat newCameraMatrix, + Size size, + int m1type, + CVD_OUT CvCallback_2 callback +) { + BEGIN_WRAP + cv::Mat dst1; + cv::Mat dst2; + cv::initUndistortRectifyMap( + *cameraMatrix.ptr, + *distCoeffs.ptr, + *r.ptr, + *newCameraMatrix.ptr, + cv::Size(size.width, size.height), + m1type, + dst1, + dst2 + ); + callback(new Mat{new cv::Mat(dst1)}, new Mat{new cv::Mat(dst2)}); + END_WRAP +} + +CvStatus *undistort_Async( + Mat src, Mat cameraMatrix, Mat distCoeffs, Mat newCameraMatrix, CVD_OUT CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat dst; + cv::undistort(*src.ptr, dst, *cameraMatrix.ptr, *distCoeffs.ptr, *newCameraMatrix.ptr); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} +CvStatus *undistortPoints_Async( + Mat distorted, Mat k, Mat d, Mat r, Mat p, TermCriteria criteria, CVD_OUT CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat dst; + cv::undistortPoints( + *distorted.ptr, + dst, + *k.ptr, + *d.ptr, + *r.ptr, + *p.ptr, + cv::TermCriteria(criteria.type, criteria.maxCount, criteria.epsilon) + ); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} diff --git a/src/calib3d/calib3d_async.h b/src/calib3d/calib3d_async.h new file mode 100644 index 00000000..5bafc3c3 --- /dev/null +++ b/src/calib3d/calib3d_async.h @@ -0,0 +1,217 @@ +/* + Created by Rainyl. + Licensed: Apache 2.0 license. Copyright (c) 2024 Rainyl. +*/ + +#ifndef CVD_ASYNC_CALIB3D_H +#define CVD_ASYNC_CALIB3D_H + +#include "core/types.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif +// fisheye +// // Performs camera calibration. +// CvStatus *fisheye_calibrate(VecVecPoint2f objectPoints, VecVecPoint2f +// imagePoints, const Size image_size, +// InputOutputArray K, InputOutputArray D, int +// flags, TermCriteria criteria, CvCallback_3 +// callback); + +// // Distorts 2D points using fisheye model. +// CvStatus *fisheye_distortPoints(InputArray undistorted, OutputArray +// distorted, InputArray K, InputArray D, +// double alpha = 0); + +// // Estimates new camera intrinsic matrix for undistortion or rectification. +// CvStatus *fisheye_estimateNewCameraMatrixForUndistortRectify(InputArray K, +// InputArray D, +// const Size +// &image_size, +// InputArray R, +// OutputArray P, +// double balance = +// 0.0, const Size +// &new_size = +// Size(), double +// fov_scale +// = 1.0); + +// // Computes undistortion and rectification maps for image transform by remap. +// If D is empty zero +// // distortion is used, if R or P is empty identity matrixes are used. +// CvStatus *fisheye_initUndistortRectifyMap(InputArray K, InputArray D, +// InputArray R, InputArray P, +// const Size &size, int m1type, +// OutputArray map1, OutputArray +// map2); + +// // Projects points using fisheye model. +// CvStatus *fisheye_projectPoints(InputArray objectPoints, OutputArray +// imagePoints, const Affine3d &affine, +// InputArray K, InputArray D, double alpha = 0, +// OutputArray jacobian = noArray()); + +// CvStatus *fisheye_projectPoints(InputArray objectPoints, OutputArray +// imagePoints, InputArray rvec, +// InputArray tvec, InputArray K, InputArray D, +// double alpha = 0, OutputArray jacobian = +// noArray()); + +// // Finds an object pose from 3D-2D point correspondences for fisheye camera +// moodel. bool fisheye_solvePnP(InputArray objectPoints, InputArray +// imagePoints, InputArray cameraMatrix, +// InputArray distCoeffs, OutputArray rvec, OutputArray +// tvec, bool useExtrinsicGuess = false, int flags = +// SOLVEPNP_ITERATIVE, TermCriteria criteria = +// TermCriteria(TermCriteria_MAX_ITER + TermCriteria_EPS, +// 10, +// 1e-8)); + +// // This is an overloaded member function, provided for convenience. It +// differs from the above function +// // only in what argument(s) it accepts. +// double fisheye_stereoCalibrate(InputArrayOfArrays objectPoints, +// InputArrayOfArrays imagePoints1, +// InputArrayOfArrays imagePoints2, +// InputOutputArray K1, InputOutputArray D1, +// InputOutputArray K2, InputOutputArray D2, Size +// imageSize, OutputArray R, OutputArray T, int +// flags = fisheye_CALIB_FIX_INTRINSIC, +// TermCriteria criteria = +// TermCriteria(TermCriteria_COUNT + +// TermCriteria_EPS, +// 100, +// DBL_EPSILON)); + +// // Performs stereo calibration. +// double fisheye_stereoCalibrate(InputArrayOfArrays objectPoints, +// InputArrayOfArrays imagePoints1, +// InputArrayOfArrays imagePoints2, +// InputOutputArray K1, InputOutputArray D1, +// InputOutputArray K2, InputOutputArray D2, Size +// imageSize, OutputArray R, OutputArray T, +// OutputArrayOfArrays rvecs, OutputArrayOfArrays +// tvecs, int flags = +// fisheye_CALIB_FIX_INTRINSIC, TermCriteria +// criteria = TermCriteria(TermCriteria_COUNT + +// TermCriteria_EPS, +// 100, +// DBL_EPSILON)); + +// // Stereo rectification for fisheye camera model. +// CvStatus *fisheye_stereoRectify(InputArray K1, InputArray D1, InputArray K2, +// InputArray D2, +// const Size &imageSize, InputArray R, +// InputArray tvec, OutputArray R1, OutputArray +// R2, OutputArray P1, OutputArray P2, +// OutputArray Q, int flags, const Size +// &newImageSize = Size(), double balance = 0.0, +// double fov_scale = 1.0); + +// // Transforms an image to compensate for fisheye lens distortion. +// CvStatus *fisheye_undistortImage(InputArray distorted, OutputArray +// undistorted, InputArray K, InputArray D, +// InputArray Knew = noArray(), const Size +// &new_size = Size()); + +// // Undistorts 2D points using fisheye model. +// CvStatus *fisheye_undistortPoints( +// InputArray distorted, OutputArray undistorted, InputArray K, InputArray +// D, InputArray R = noArray(), InputArray P = noArray(), TermCriteria +// criteria = TermCriteria(TermCriteria_MAX_ITER + TermCriteria_EPS, 10, +// 1e-8)); + +CvStatus *fisheye_undistortImage_Async(Mat distorted, Mat k, Mat d, CVD_OUT CvCallback_1 callback); +CvStatus *fisheye_undistortImageWithParams_Async( + Mat distorted, Mat k, Mat d, Mat knew, Size size, CVD_OUT CvCallback_1 callback +); +CvStatus *fisheye_undistortPoints_Async( + Mat distorted, Mat k, Mat d, Mat R, Mat P, CVD_OUT CvCallback_1 callback +); +CvStatus *fisheye_estimateNewCameraMatrixForUndistortRectify_Async( + Mat k, + Mat d, + Size imgSize, + Mat r, + double balance, + Size newSize, + double fovScale, + CVD_OUT CvCallback_1 p +); + +// calib3d +CvStatus *calibrateCamera_Async( + VecVecPoint3f objectPoints, + VecVecPoint2f imagePoints, + Size imageSize, + Mat cameraMatrix, + Mat distCoeffs, + int flag, + TermCriteria criteria, + CVD_OUT CvCallback_5 callback +); +CvStatus *drawChessboardCorners_Async( + Mat image, Size patternSize, bool patternWasFound, CVD_OUT CvCallback_0 callback +); +CvStatus *estimateAffinePartial2D_Async(VecPoint2f from, VecPoint2f to, CvCallback_1 callback); +CvStatus *estimateAffinePartial2DWithParams_Async( + VecPoint2f from, + VecPoint2f to, + int method, + double ransacReprojThreshold, + size_t maxIters, + double confidence, + size_t refineIters, + CVD_OUT CvCallback_2 callback +); +CvStatus *estimateAffine2D_Async(VecPoint2f from, VecPoint2f to, CVD_OUT CvCallback_1 callback); +CvStatus *estimateAffine2DWithParams_Async( + VecPoint2f from, + VecPoint2f to, + int method, + double ransacReprojThreshold, + size_t maxIters, + double confidence, + size_t refineIters, + CVD_OUT CvCallback_2 callback +); +CvStatus * +findChessboardCorners_Async(Mat image, Size patternSize, int flags, CvCallback_2 callback); +CvStatus * +findChessboardCornersSB_Async(Mat image, Size patternSize, int flags, CvCallback_2 callback); +CvStatus *findChessboardCornersSBWithMeta_Async( + Mat image, Size patternSize, int flags, CVD_OUT CvCallback_3 callback +); +CvStatus *getOptimalNewCameraMatrix_Async( + Mat cameraMatrix, + Mat distCoeffs, + Size size, + double alpha, + Size newImgSize, + bool centerPrincipalPoint, + CVD_OUT CvCallback_2 callback +); +CvStatus *initUndistortRectifyMap_Async( + Mat cameraMatrix, + Mat distCoeffs, + Mat r, + Mat newCameraMatrix, + Size size, + int m1type, + CVD_OUT CvCallback_2 callback +); + +CvStatus *undistort_Async( + Mat src, Mat cameraMatrix, Mat distCoeffs, Mat newCameraMatrix, CVD_OUT CvCallback_1 callback +); +CvStatus *undistortPoints_Async( + Mat distorted, Mat k, Mat d, Mat r, Mat p, TermCriteria criteria, CVD_OUT CvCallback_1 callback +); + +#ifdef __cplusplus +} +#endif +#endif // CVD_ASYNC_CALIB3D_H diff --git a/src/core/core.cpp b/src/core/core.cpp index 88e142f1..50289be3 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -5,38 +5,43 @@ #include #include -CvStatus *RotatedRect_Points(RotatedRect rect, VecPoint2f *pts) -{ +CvStatus *RotatedRect_Points(RotatedRect rect, VecPoint2f *pts) { BEGIN_WRAP - auto r = cv::RotatedRect(cv::Point2f(rect.center.x, rect.center.y), - cv::Size2f(rect.size.width, rect.size.height), rect.angle); + auto r = cv::RotatedRect( + cv::Point2f(rect.center.x, rect.center.y), + cv::Size2f(rect.size.width, rect.size.height), + rect.angle + ); std::vector pts_; r.points(pts_); *pts = {new std::vector(pts_)}; END_WRAP } -CvStatus *RotatedRect_BoundingRect(RotatedRect rect, Rect *rval) -{ +CvStatus *RotatedRect_BoundingRect(RotatedRect rect, Rect *rval) { BEGIN_WRAP - auto r = cv::RotatedRect(cv::Point2f(rect.center.x, rect.center.y), - cv::Size2f(rect.size.width, rect.size.height), rect.angle); + auto r = cv::RotatedRect( + cv::Point2f(rect.center.x, rect.center.y), + cv::Size2f(rect.size.width, rect.size.height), + rect.angle + ); auto rr = r.boundingRect(); *rval = {rr.x, rr.y, rr.width, rr.height}; END_WRAP } -CvStatus *RotatedRect_BoundingRect2f(RotatedRect rect, Rect2f *rval) -{ +CvStatus *RotatedRect_BoundingRect2f(RotatedRect rect, Rect2f *rval) { BEGIN_WRAP - auto r = cv::RotatedRect(cv::Point2f(rect.center.x, rect.center.y), - cv::Size2f(rect.size.width, rect.size.height), rect.angle); + auto r = cv::RotatedRect( + cv::Point2f(rect.center.x, rect.center.y), + cv::Size2f(rect.size.width, rect.size.height), + rect.angle + ); auto rr = r.boundingRect2f(); *rval = {rr.x, rr.y, rr.width, rr.height}; END_WRAP } -void CvStatus_Close(CvStatus *self) -{ +void CvStatus_Close(CvStatus *self) { if (self->err != NULL) { free(self->err); self->err = NULL; @@ -56,421 +61,375 @@ void CvStatus_Close(CvStatus *self) delete self; } -CvStatus *Mat_New(Mat *rval) -{ +CvStatus *Mat_New(Mat *rval) { BEGIN_WRAP *rval = {new cv::Mat()}; END_WRAP } -CvStatus *Mat_NewWithSize(int rows, int cols, int type, Mat *rval) -{ +CvStatus *Mat_NewWithSize(int rows, int cols, int type, Mat *rval) { BEGIN_WRAP *rval = {new cv::Mat(rows, cols, type, 0.0)}; END_WRAP } -CvStatus *Mat_NewWithSizes(VecInt sizes, int type, Mat *rval) -{ +CvStatus *Mat_NewWithSizes(VecInt sizes, int type, Mat *rval) { BEGIN_WRAP *rval = {new cv::Mat(*sizes.ptr, type)}; END_WRAP } -CvStatus *Mat_NewWithSizesFromScalar(VecInt sizes, int type, Scalar ar, Mat *rval) -{ +CvStatus *Mat_NewWithSizesFromScalar(VecInt sizes, int type, Scalar ar, Mat *rval) { BEGIN_WRAP cv::Scalar c = cv::Scalar(ar.val1, ar.val2, ar.val3, ar.val4); *rval = {new cv::Mat(*sizes.ptr, type, c)}; END_WRAP } -CvStatus *Mat_NewWithSizesFromBytes(VecInt sizes, int type, VecChar buf, Mat *rval) -{ +CvStatus *Mat_NewWithSizesFromBytes(VecInt sizes, int type, VecChar buf, Mat *rval) { BEGIN_WRAP *rval = {new cv::Mat(*sizes.ptr, type, buf.ptr)}; END_WRAP } -CvStatus *Mat_NewFromScalar(const Scalar ar, int type, Mat *rval) -{ +CvStatus *Mat_NewFromScalar(const Scalar ar, int type, Mat *rval) { BEGIN_WRAP cv::Scalar c = cv::Scalar(ar.val1, ar.val2, ar.val3, ar.val4); *rval = {new cv::Mat(1, 1, type, c)}; END_WRAP } -CvStatus *Mat_NewWithSizeFromScalar(const Scalar ar, int rows, int cols, int type, Mat *rval) -{ +CvStatus *Mat_NewWithSizeFromScalar(const Scalar ar, int rows, int cols, int type, Mat *rval) { BEGIN_WRAP cv::Scalar c = cv::Scalar(ar.val1, ar.val2, ar.val3, ar.val4); *rval = {new cv::Mat(rows, cols, type, c)}; END_WRAP } -CvStatus *Mat_NewFromBytes(int rows, int cols, int type, void *buf, int step, Mat *rval) -{ - BEGIN_WRAP - auto p = reinterpret_cast(buf); - *rval = {new cv::Mat(rows, cols, type, buf, step)}; - END_WRAP -} -CvStatus *Mat_NewFromVecPoint(VecPoint vec, Mat *rval) -{ +CvStatus *Mat_NewFromBytes(int rows, int cols, int type, void *buf, Mat *rval) { + BEGIN_WRAP + // auto p = reinterpret_cast(buf); + // int depth = CV_MAT_DEPTH(type); + // switch (depth) { + // case CV_8U: + // case CV_8S: expect_total = 256; break; + // case CV_16U: + // case CV_16S: expect_total = 65536; break; + // // TODO: can't create a mat with 4294967296 rows, maybe use vector instead + // // case CV_32S: + // // expect_total = 4294967296; + // // break; + // default: + // throw cv::Exception( + // cv::Error::StsNotImplemented, + // "source Mat Type not supported", + // __func__, + // __FILE__, + // __LINE__ + // ); + // } + cv::Mat m = cv::Mat(rows, cols, type); + m.create(rows, cols, type); + memcpy(m.data, buf, m.total() * m.elemSize()); + *rval = {new cv::Mat(m)}; + END_WRAP +} +CvStatus *Mat_NewFromVecPoint(VecPoint vec, Mat *rval) { BEGIN_WRAP *rval = {new cv::Mat(*vec.ptr)}; END_WRAP } -CvStatus *Mat_NewFromVecPoint2f(VecPoint2f vec, Mat *rval) -{ +CvStatus *Mat_NewFromVecPoint2f(VecPoint2f vec, Mat *rval) { BEGIN_WRAP *rval = {new cv::Mat(*vec.ptr)}; END_WRAP } -CvStatus *Mat_NewFromVecPoint3f(VecPoint3f vec, Mat *rval) -{ +CvStatus *Mat_NewFromVecPoint3f(VecPoint3f vec, Mat *rval) { BEGIN_WRAP *rval = {new cv::Mat(*vec.ptr)}; END_WRAP } -CvStatus *Mat_FromPtr(Mat m, int rows, int cols, int type, int prows, int pcols, Mat *rval) -{ +CvStatus *Mat_FromPtr(Mat m, int rows, int cols, int type, int prows, int pcols, Mat *rval) { BEGIN_WRAP *rval = {new cv::Mat(rows, cols, type, m.ptr->ptr(prows, pcols))}; END_WRAP } -CvStatus *Mat_FromCMat(Mat m, Mat *rval) -{ +CvStatus *Mat_FromCMat(Mat m, Mat *rval) { BEGIN_WRAP *rval = {new cv::Mat(m.ptr->clone())}; END_WRAP } -void Mat_Close(MatPtr m) -{ +void Mat_Close(MatPtr m) { m->ptr->release(); - CVD_FREE(m) + CVD_FREE(m); } -void Mat_CloseVoid(void *m) -{ +void Mat_CloseVoid(void *m) { auto p = reinterpret_cast(m); p->ptr->release(); - CVD_FREE(p) + CVD_FREE(p); } -CvStatus *Mat_Release(Mat *m) -{ +CvStatus *Mat_Release(Mat *m) { BEGIN_WRAP m->ptr->release(); END_WRAP } -CvStatus *Mat_Empty(Mat m, bool *rval) -{ +CvStatus *Mat_Empty(Mat m, bool *rval) { BEGIN_WRAP *rval = m.ptr->empty(); END_WRAP } -CvStatus *Mat_IsContinuous(Mat m, bool *rval) -{ +CvStatus *Mat_IsContinuous(Mat m, bool *rval) { BEGIN_WRAP *rval = m.ptr->isContinuous(); END_WRAP } -CvStatus *Mat_Clone(Mat m, Mat *rval) -{ +CvStatus *Mat_Clone(Mat m, Mat *rval) { BEGIN_WRAP *rval = {new cv::Mat(m.ptr->clone())}; END_WRAP } -CvStatus *Mat_CopyTo(Mat m, Mat dst) -{ +CvStatus *Mat_CopyTo(Mat m, Mat dst) { BEGIN_WRAP m.ptr->copyTo(*dst.ptr); END_WRAP } -CvStatus *Mat_CopyToWithMask(Mat m, Mat dst, Mat mask) -{ +CvStatus *Mat_CopyToWithMask(Mat m, Mat dst, Mat mask) { BEGIN_WRAP m.ptr->copyTo(*dst.ptr, *mask.ptr); END_WRAP } -CvStatus *Mat_ConvertTo(Mat m, Mat dst, int type) -{ +CvStatus *Mat_ConvertTo(Mat m, Mat dst, int type) { BEGIN_WRAP m.ptr->convertTo(*dst.ptr, type); END_WRAP } -CvStatus *Mat_ConvertToWithParams(Mat m, Mat dst, int type, float alpha, float beta) -{ +CvStatus *Mat_ConvertToWithParams(Mat m, Mat dst, int type, float alpha, float beta) { BEGIN_WRAP m.ptr->convertTo(*dst.ptr, type, alpha, beta); END_WRAP } -CvStatus *Mat_ToVecUChar(Mat m, VecUChar *rval) -{ +CvStatus *Mat_ToVecUChar(Mat m, VecUChar *rval) { BEGIN_WRAP *rval = {new std::vector(m.ptr->begin(), m.ptr->end())}; END_WRAP } -CvStatus *Mat_ToVecChar(Mat m, VecChar *rval) -{ +CvStatus *Mat_ToVecChar(Mat m, VecChar *rval) { BEGIN_WRAP *rval = {new std::vector(m.ptr->begin(), m.ptr->end())}; END_WRAP } -CvStatus *Mat_Region(Mat m, Rect r, Mat *rval) -{ +CvStatus *Mat_Region(Mat m, Rect r, Mat *rval) { BEGIN_WRAP *rval = {new cv::Mat(*m.ptr, cv::Rect(r.x, r.y, r.width, r.height))}; END_WRAP } -CvStatus *Mat_Reshape(Mat m, int cn, int rows, Mat *rval) -{ +CvStatus *Mat_Reshape(Mat m, int cn, int rows, Mat *rval) { BEGIN_WRAP *rval = {new cv::Mat(m.ptr->reshape(cn, rows))}; END_WRAP } -CvStatus *Mat_PatchNaNs(Mat m, double val) -{ +CvStatus *Mat_PatchNaNs(Mat m, double val) { BEGIN_WRAP cv::patchNaNs(*m.ptr, val); END_WRAP } -CvStatus *Mat_ConvertFp16(Mat m, Mat *rval) -{ +CvStatus *Mat_ConvertFp16(Mat m, Mat *rval) { BEGIN_WRAP auto dst = cv::Mat(); cv::convertFp16(*m.ptr, dst); *rval = {new cv::Mat(dst)}; END_WRAP } -CvStatus *Mat_Mean(Mat m, Scalar *rval) -{ +CvStatus *Mat_Mean(Mat m, Scalar *rval) { BEGIN_WRAP cv::Scalar c = cv::mean(*m.ptr); *rval = Scalar{c.val[0], c.val[1], c.val[2], c.val[3]}; END_WRAP } -CvStatus *Mat_MeanWithMask(Mat m, Mat mask, Scalar *rval) -{ +CvStatus *Mat_MeanWithMask(Mat m, Mat mask, Scalar *rval) { BEGIN_WRAP cv::Scalar c = cv::mean(*m.ptr, *mask.ptr); *rval = Scalar{c.val[0], c.val[1], c.val[2], c.val[3]}; END_WRAP } -CvStatus *Mat_Sqrt(Mat m, Mat *rval) -{ +CvStatus *Mat_Sqrt(Mat m, Mat *rval) { BEGIN_WRAP auto dst = cv::Mat(); cv::sqrt(*m.ptr, dst); *rval = {new cv::Mat(dst)}; END_WRAP } -CvStatus *Mat_Rows(Mat m, int *rval) -{ +CvStatus *Mat_Rows(Mat m, int *rval) { BEGIN_WRAP *rval = m.ptr->rows; END_WRAP } -CvStatus *Mat_Cols(Mat m, int *rval) -{ +CvStatus *Mat_Cols(Mat m, int *rval) { BEGIN_WRAP *rval = m.ptr->cols; END_WRAP } -CvStatus *Mat_Channels(Mat m, int *rval) -{ +CvStatus *Mat_Channels(Mat m, int *rval) { BEGIN_WRAP *rval = m.ptr->channels(); END_WRAP } -CvStatus *Mat_Type(Mat m, int *rval) -{ +CvStatus *Mat_Type(Mat m, int *rval) { BEGIN_WRAP *rval = m.ptr->type(); END_WRAP } -CvStatus *Mat_Step(Mat m, int *rval) -{ +CvStatus *Mat_Step(Mat m, int *rval) { BEGIN_WRAP *rval = m.ptr->step; END_WRAP } -CvStatus *Mat_Total(Mat m, int *rval) -{ +CvStatus *Mat_Total(Mat m, int *rval) { BEGIN_WRAP *rval = m.ptr->total(); END_WRAP } -CvStatus *Mat_Size(Mat m, VecInt *rval) -{ +CvStatus *Mat_Size(Mat m, VecInt *rval) { BEGIN_WRAP std::vector v; auto size = m.ptr->size; - for (int i = 0; i < size.dims(); i++) { - v.push_back(size[i]); - } + for (int i = 0; i < size.dims(); i++) { v.push_back(size[i]); } *rval = {new std::vector(v)}; END_WRAP } -CvStatus *Mat_ElemSize(Mat m, int *rval) -{ +CvStatus *Mat_ElemSize(Mat m, int *rval) { BEGIN_WRAP *rval = m.ptr->elemSize(); END_WRAP } -CvStatus *Mat_Data(Mat m, VecUChar *rval) -{ +CvStatus *Mat_Data(Mat m, VecUChar *rval) { BEGIN_WRAP *rval = {new std::vector(*m.ptr->data)}; END_WRAP } -CvStatus *Mat_DataPtr(Mat m, uchar **data, int *length) -{ +CvStatus *Mat_DataPtr(Mat m, uchar **data, int *length) { BEGIN_WRAP *data = m.ptr->data; *length = static_cast(m.ptr->total() * m.ptr->elemSize()); END_WRAP } -CvStatus *Eye(int rows, int cols, int type, Mat *rval) -{ +CvStatus *Eye(int rows, int cols, int type, Mat *rval) { BEGIN_WRAP *rval = {new cv::Mat(cv::Mat::eye(rows, cols, type))}; END_WRAP } -CvStatus *Zeros(int rows, int cols, int type, Mat *rval) -{ +CvStatus *Zeros(int rows, int cols, int type, Mat *rval) { BEGIN_WRAP *rval = {new cv::Mat(cv::Mat::zeros(rows, cols, type))}; END_WRAP } -CvStatus *Ones(int rows, int cols, int type, Mat *rval) -{ +CvStatus *Ones(int rows, int cols, int type, Mat *rval) { BEGIN_WRAP *rval = {new cv::Mat(cv::Mat::ones(rows, cols, type))}; END_WRAP } -CvStatus *Mat_Ptr_u8_1(Mat m, int i, uchar **rval) -{ +CvStatus *Mat_Ptr_u8_1(Mat m, int i, uchar **rval) { BEGIN_WRAP *rval = m.ptr->ptr(i); END_WRAP } -CvStatus *Mat_Ptr_u8_2(Mat m, int i, int j, uchar **rval) -{ +CvStatus *Mat_Ptr_u8_2(Mat m, int i, int j, uchar **rval) { BEGIN_WRAP *rval = m.ptr->ptr(i, j); END_WRAP } -CvStatus *Mat_Ptr_u8_3(Mat m, int i, int j, int k, uchar **rval) -{ +CvStatus *Mat_Ptr_u8_3(Mat m, int i, int j, int k, uchar **rval) { BEGIN_WRAP *rval = m.ptr->ptr(i, j, k); END_WRAP } -CvStatus *Mat_Ptr_i8_1(Mat m, int i, char **rval) -{ +CvStatus *Mat_Ptr_i8_1(Mat m, int i, char **rval) { BEGIN_WRAP *rval = m.ptr->ptr(i); END_WRAP } -CvStatus *Mat_Ptr_i8_2(Mat m, int i, int j, char **rval) -{ +CvStatus *Mat_Ptr_i8_2(Mat m, int i, int j, char **rval) { BEGIN_WRAP *rval = m.ptr->ptr(i, j); END_WRAP } -CvStatus *Mat_Ptr_i8_3(Mat m, int i, int j, int k, char **rval) -{ +CvStatus *Mat_Ptr_i8_3(Mat m, int i, int j, int k, char **rval) { BEGIN_WRAP *rval = m.ptr->ptr(i, j, k); END_WRAP } -CvStatus *Mat_Ptr_u16_1(Mat m, int i, ushort **rval) -{ +CvStatus *Mat_Ptr_u16_1(Mat m, int i, ushort **rval) { BEGIN_WRAP *rval = m.ptr->ptr(i); END_WRAP } -CvStatus *Mat_Ptr_u16_2(Mat m, int i, int j, ushort **rval) -{ +CvStatus *Mat_Ptr_u16_2(Mat m, int i, int j, ushort **rval) { BEGIN_WRAP *rval = m.ptr->ptr(i, j); END_WRAP } -CvStatus *Mat_Ptr_u16_3(Mat m, int i, int j, int k, ushort **rval) -{ +CvStatus *Mat_Ptr_u16_3(Mat m, int i, int j, int k, ushort **rval) { BEGIN_WRAP *rval = m.ptr->ptr(i, j, k); END_WRAP } -CvStatus *Mat_Ptr_i16_1(Mat m, int i, short **rval) -{ +CvStatus *Mat_Ptr_i16_1(Mat m, int i, short **rval) { BEGIN_WRAP *rval = m.ptr->ptr(i); END_WRAP } -CvStatus *Mat_Ptr_i16_2(Mat m, int i, int j, short **rval) -{ +CvStatus *Mat_Ptr_i16_2(Mat m, int i, int j, short **rval) { BEGIN_WRAP *rval = m.ptr->ptr(i, j); END_WRAP } -CvStatus *Mat_Ptr_i16_3(Mat m, int i, int j, int k, short **rval) -{ +CvStatus *Mat_Ptr_i16_3(Mat m, int i, int j, int k, short **rval) { BEGIN_WRAP *rval = m.ptr->ptr(i, j, k); END_WRAP } -CvStatus *Mat_Ptr_i32_1(Mat m, int i, int **rval) -{ +CvStatus *Mat_Ptr_i32_1(Mat m, int i, int **rval) { BEGIN_WRAP *rval = m.ptr->ptr(i); END_WRAP } -CvStatus *Mat_Ptr_i32_2(Mat m, int i, int j, int **rval) -{ +CvStatus *Mat_Ptr_i32_2(Mat m, int i, int j, int **rval) { BEGIN_WRAP *rval = m.ptr->ptr(i, j); END_WRAP } -CvStatus *Mat_Ptr_i32_3(Mat m, int i, int j, int k, int **rval) -{ +CvStatus *Mat_Ptr_i32_3(Mat m, int i, int j, int k, int **rval) { BEGIN_WRAP *rval = m.ptr->ptr(i, j, k); END_WRAP } -CvStatus *Mat_Ptr_f32_1(Mat m, int i, float **rval) -{ +CvStatus *Mat_Ptr_f32_1(Mat m, int i, float **rval) { BEGIN_WRAP *rval = m.ptr->ptr(i); END_WRAP } -CvStatus *Mat_Ptr_f32_2(Mat m, int i, int j, float **rval) -{ +CvStatus *Mat_Ptr_f32_2(Mat m, int i, int j, float **rval) { BEGIN_WRAP *rval = m.ptr->ptr(i, j); END_WRAP } -CvStatus *Mat_Ptr_f32_3(Mat m, int i, int j, int k, float **rval) -{ +CvStatus *Mat_Ptr_f32_3(Mat m, int i, int j, int k, float **rval) { BEGIN_WRAP *rval = m.ptr->ptr(i, j, k); END_WRAP } -CvStatus *Mat_Ptr_f64_1(Mat m, int i, double **rval) -{ +CvStatus *Mat_Ptr_f64_1(Mat m, int i, double **rval) { BEGIN_WRAP *rval = m.ptr->ptr(i); END_WRAP } -CvStatus *Mat_Ptr_f64_2(Mat m, int i, int j, double **rval) -{ +CvStatus *Mat_Ptr_f64_2(Mat m, int i, int j, double **rval) { BEGIN_WRAP *rval = m.ptr->ptr(i, j); END_WRAP } -CvStatus *Mat_Ptr_f64_3(Mat m, int i, int j, int k, double **rval) -{ +CvStatus *Mat_Ptr_f64_3(Mat m, int i, int j, int k, double **rval) { BEGIN_WRAP *rval = m.ptr->ptr(i, j, k); END_WRAP @@ -478,240 +437,204 @@ CvStatus *Mat_Ptr_f64_3(Mat m, int i, int j, int k, double **rval) #pragma region Mat_getter -CvStatus *Mat_GetUChar(Mat m, int row, int col, uint8_t *rval) -{ +CvStatus *Mat_GetUChar(Mat m, int row, int col, uint8_t *rval) { BEGIN_WRAP *rval = m.ptr->at(row, col); END_WRAP } -CvStatus *Mat_GetUChar3(Mat m, int x, int y, int z, uint8_t *rval) -{ +CvStatus *Mat_GetUChar3(Mat m, int x, int y, int z, uint8_t *rval) { BEGIN_WRAP *rval = m.ptr->at(x, y, z); END_WRAP } -CvStatus *Mat_GetSChar(Mat m, int row, int col, int8_t *rval) -{ +CvStatus *Mat_GetSChar(Mat m, int row, int col, int8_t *rval) { BEGIN_WRAP *rval = m.ptr->at(row, col); END_WRAP } -CvStatus *Mat_GetSChar3(Mat m, int x, int y, int z, int8_t *rval) -{ +CvStatus *Mat_GetSChar3(Mat m, int x, int y, int z, int8_t *rval) { BEGIN_WRAP *rval = m.ptr->at(x, y, z); END_WRAP } -CvStatus *Mat_GetUShort(Mat m, int row, int col, uint16_t *rval) -{ +CvStatus *Mat_GetUShort(Mat m, int row, int col, uint16_t *rval) { BEGIN_WRAP *rval = m.ptr->at(row, col); END_WRAP } -CvStatus *Mat_GetUShort3(Mat m, int x, int y, int z, uint16_t *rval) -{ +CvStatus *Mat_GetUShort3(Mat m, int x, int y, int z, uint16_t *rval) { BEGIN_WRAP *rval = m.ptr->at(x, y, z); END_WRAP } -CvStatus *Mat_GetShort(Mat m, int row, int col, int16_t *rval) -{ +CvStatus *Mat_GetShort(Mat m, int row, int col, int16_t *rval) { BEGIN_WRAP *rval = m.ptr->at(row, col); END_WRAP } -CvStatus *Mat_GetShort3(Mat m, int x, int y, int z, int16_t *rval) -{ +CvStatus *Mat_GetShort3(Mat m, int x, int y, int z, int16_t *rval) { BEGIN_WRAP *rval = m.ptr->at(x, y, z); END_WRAP } -CvStatus *Mat_GetInt(Mat m, int row, int col, int32_t *rval) -{ +CvStatus *Mat_GetInt(Mat m, int row, int col, int32_t *rval) { BEGIN_WRAP *rval = m.ptr->at(row, col); END_WRAP } -CvStatus *Mat_GetInt3(Mat m, int x, int y, int z, int32_t *rval) -{ +CvStatus *Mat_GetInt3(Mat m, int x, int y, int z, int32_t *rval) { BEGIN_WRAP *rval = m.ptr->at(x, y, z); END_WRAP } -CvStatus *Mat_GetFloat(Mat m, int row, int col, float *rval) -{ +CvStatus *Mat_GetFloat(Mat m, int row, int col, float *rval) { BEGIN_WRAP *rval = m.ptr->at(row, col); END_WRAP } -CvStatus *Mat_GetFloat3(Mat m, int x, int y, int z, float *rval) -{ +CvStatus *Mat_GetFloat3(Mat m, int x, int y, int z, float *rval) { BEGIN_WRAP *rval = m.ptr->at(x, y, z); END_WRAP } -CvStatus *Mat_GetDouble(Mat m, int row, int col, double *rval) -{ +CvStatus *Mat_GetDouble(Mat m, int row, int col, double *rval) { BEGIN_WRAP *rval = m.ptr->at(row, col); END_WRAP } -CvStatus *Mat_GetDouble3(Mat m, int x, int y, int z, double *rval) -{ +CvStatus *Mat_GetDouble3(Mat m, int x, int y, int z, double *rval) { BEGIN_WRAP *rval = m.ptr->at(x, y, z); END_WRAP } -CvStatus *Mat_GetVec2b(Mat m, int row, int col, Vec2b *rval) -{ +CvStatus *Mat_GetVec2b(Mat m, int row, int col, Vec2b *rval) { BEGIN_WRAP auto v = m.ptr->at(row, col); *rval = {v.val[0], v.val[1]}; END_WRAP } -CvStatus *Mat_GetVec3b(Mat m, int row, int col, Vec3b *rval) -{ +CvStatus *Mat_GetVec3b(Mat m, int row, int col, Vec3b *rval) { BEGIN_WRAP auto v = m.ptr->at(row, col); *rval = {v.val[0], v.val[1], v.val[2]}; END_WRAP } -CvStatus *Mat_GetVec4b(Mat m, int row, int col, Vec4b *rval) -{ +CvStatus *Mat_GetVec4b(Mat m, int row, int col, Vec4b *rval) { BEGIN_WRAP auto v = m.ptr->at(row, col); *rval = {v.val[0], v.val[1], v.val[2], v.val[3]}; END_WRAP } -CvStatus *Mat_GetVec2s(Mat m, int row, int col, Vec2s *rval) -{ +CvStatus *Mat_GetVec2s(Mat m, int row, int col, Vec2s *rval) { BEGIN_WRAP auto v = m.ptr->at(row, col); *rval = {v.val[0], v.val[1]}; END_WRAP } -CvStatus *Mat_GetVec3s(Mat m, int row, int col, Vec3s *rval) -{ +CvStatus *Mat_GetVec3s(Mat m, int row, int col, Vec3s *rval) { BEGIN_WRAP auto v = m.ptr->at(row, col); *rval = {v.val[0], v.val[1], v.val[2]}; END_WRAP } -CvStatus *Mat_GetVec4s(Mat m, int row, int col, Vec4s *rval) -{ +CvStatus *Mat_GetVec4s(Mat m, int row, int col, Vec4s *rval) { BEGIN_WRAP auto v = m.ptr->at(row, col); *rval = {v.val[0], v.val[1], v.val[2], v.val[3]}; END_WRAP } -CvStatus *Mat_GetVec2w(Mat m, int row, int col, Vec2w *rval) -{ +CvStatus *Mat_GetVec2w(Mat m, int row, int col, Vec2w *rval) { BEGIN_WRAP auto v = m.ptr->at(row, col); *rval = {v.val[0], v.val[1]}; END_WRAP } -CvStatus *Mat_GetVec3w(Mat m, int row, int col, Vec3w *rval) -{ +CvStatus *Mat_GetVec3w(Mat m, int row, int col, Vec3w *rval) { BEGIN_WRAP auto v = m.ptr->at(row, col); *rval = {v.val[0], v.val[1], v.val[2]}; END_WRAP } -CvStatus *Mat_GetVec4w(Mat m, int row, int col, Vec4w *rval) -{ +CvStatus *Mat_GetVec4w(Mat m, int row, int col, Vec4w *rval) { BEGIN_WRAP auto v = m.ptr->at(row, col); *rval = {v.val[0], v.val[1], v.val[2], v.val[3]}; END_WRAP } -CvStatus *Mat_GetVec2i(Mat m, int row, int col, Vec2i *rval) -{ +CvStatus *Mat_GetVec2i(Mat m, int row, int col, Vec2i *rval) { BEGIN_WRAP auto v = m.ptr->at(row, col); *rval = {v.val[0], v.val[1]}; END_WRAP } -CvStatus *Mat_GetVec3i(Mat m, int row, int col, Vec3i *rval) -{ +CvStatus *Mat_GetVec3i(Mat m, int row, int col, Vec3i *rval) { BEGIN_WRAP auto v = m.ptr->at(row, col); *rval = {v.val[0], v.val[1], v.val[2]}; END_WRAP } -CvStatus *Mat_GetVec4i(Mat m, int row, int col, Vec4i *rval) -{ +CvStatus *Mat_GetVec4i(Mat m, int row, int col, Vec4i *rval) { BEGIN_WRAP auto v = m.ptr->at(row, col); *rval = {v.val[0], v.val[1], v.val[2], v.val[3]}; END_WRAP } -CvStatus *Mat_GetVec6i(Mat m, int row, int col, Vec6i *rval) -{ +CvStatus *Mat_GetVec6i(Mat m, int row, int col, Vec6i *rval) { BEGIN_WRAP auto v = m.ptr->at(row, col); *rval = {v.val[0], v.val[1], v.val[2], v.val[3], v.val[4], v.val[5]}; END_WRAP } -CvStatus *Mat_GetVec8i(Mat m, int row, int col, Vec8i *rval) -{ +CvStatus *Mat_GetVec8i(Mat m, int row, int col, Vec8i *rval) { BEGIN_WRAP auto v = m.ptr->at(row, col); *rval = {v.val[0], v.val[1], v.val[2], v.val[3], v.val[4], v.val[5], v.val[6], v.val[7]}; END_WRAP } -CvStatus *Mat_GetVec2f(Mat m, int row, int col, Vec2f *rval) -{ +CvStatus *Mat_GetVec2f(Mat m, int row, int col, Vec2f *rval) { BEGIN_WRAP auto v = m.ptr->at(row, col); *rval = {v.val[0], v.val[1]}; END_WRAP } -CvStatus *Mat_GetVec3f(Mat m, int row, int col, Vec3f *rval) -{ +CvStatus *Mat_GetVec3f(Mat m, int row, int col, Vec3f *rval) { BEGIN_WRAP auto v = m.ptr->at(row, col); *rval = {v.val[0], v.val[1], v.val[2]}; END_WRAP } -CvStatus *Mat_GetVec4f(Mat m, int row, int col, Vec4f *rval) -{ +CvStatus *Mat_GetVec4f(Mat m, int row, int col, Vec4f *rval) { BEGIN_WRAP auto v = m.ptr->at(row, col); *rval = {v.val[0], v.val[1], v.val[2], v.val[3]}; END_WRAP } -CvStatus *Mat_GetVec6f(Mat m, int row, int col, Vec6f *rval) -{ +CvStatus *Mat_GetVec6f(Mat m, int row, int col, Vec6f *rval) { BEGIN_WRAP auto v = m.ptr->at(row, col); *rval = {v.val[0], v.val[1], v.val[2], v.val[3], v.val[4], v.val[5]}; END_WRAP } -CvStatus *Mat_GetVec2d(Mat m, int row, int col, Vec2d *rval) -{ +CvStatus *Mat_GetVec2d(Mat m, int row, int col, Vec2d *rval) { BEGIN_WRAP auto v = m.ptr->at(row, col); *rval = {v.val[0], v.val[1]}; END_WRAP } -CvStatus *Mat_GetVec3d(Mat m, int row, int col, Vec3d *rval) -{ +CvStatus *Mat_GetVec3d(Mat m, int row, int col, Vec3d *rval) { BEGIN_WRAP auto v = m.ptr->at(row, col); *rval = {v.val[0], v.val[1], v.val[2]}; END_WRAP } -CvStatus *Mat_GetVec4d(Mat m, int row, int col, Vec4d *rval) -{ +CvStatus *Mat_GetVec4d(Mat m, int row, int col, Vec4d *rval) { BEGIN_WRAP auto v = m.ptr->at(row, col); *rval = {v.val[0], v.val[1], v.val[2], v.val[3]}; END_WRAP } -CvStatus *Mat_GetVec6d(Mat m, int row, int col, Vec6d *rval) -{ +CvStatus *Mat_GetVec6d(Mat m, int row, int col, Vec6d *rval) { BEGIN_WRAP auto v = m.ptr->at(row, col); *rval = {v.val[0], v.val[1], v.val[2], v.val[3], v.val[4], v.val[5]}; @@ -722,62 +645,53 @@ CvStatus *Mat_GetVec6d(Mat m, int row, int col, Vec6d *rval) #pragma region Mat_setter -CvStatus *Mat_SetTo(Mat m, Scalar value) -{ +CvStatus *Mat_SetTo(Mat m, Scalar value) { BEGIN_WRAP cv::Scalar c_value(value.val1, value.val2, value.val3, value.val4); m.ptr->setTo(c_value); END_WRAP } -CvStatus *Mat_SetUChar(Mat m, int row, int col, uint8_t val) -{ +CvStatus *Mat_SetUChar(Mat m, int row, int col, uint8_t val) { BEGIN_WRAP m.ptr->at(row, col) = val; END_WRAP } -CvStatus *Mat_SetUChar3(Mat m, int x, int y, int z, uint8_t val) -{ +CvStatus *Mat_SetUChar3(Mat m, int x, int y, int z, uint8_t val) { BEGIN_WRAP m.ptr->at(x, y, z) = val; END_WRAP } -CvStatus *Mat_SetSChar(Mat m, int row, int col, int8_t val) -{ +CvStatus *Mat_SetSChar(Mat m, int row, int col, int8_t val) { BEGIN_WRAP m.ptr->at(row, col) = val; END_WRAP } -CvStatus *Mat_SetSChar3(Mat m, int x, int y, int z, int8_t val) -{ +CvStatus *Mat_SetSChar3(Mat m, int x, int y, int z, int8_t val) { BEGIN_WRAP m.ptr->at(x, y, z) = val; END_WRAP } // Mat_SetShort set a specific row/col value from this Mat expecting // each element to contain a short aka CV_16S. -CvStatus *Mat_SetShort(Mat m, int row, int col, int16_t val) -{ +CvStatus *Mat_SetShort(Mat m, int row, int col, int16_t val) { BEGIN_WRAP m.ptr->at(row, col) = val; END_WRAP } -CvStatus *Mat_SetShort3(Mat m, int x, int y, int z, int16_t val) -{ +CvStatus *Mat_SetShort3(Mat m, int x, int y, int z, int16_t val) { BEGIN_WRAP m.ptr->at(x, y, z) = val; END_WRAP } -CvStatus *Mat_SetUShort(Mat m, int row, int col, uint16_t val) -{ +CvStatus *Mat_SetUShort(Mat m, int row, int col, uint16_t val) { BEGIN_WRAP m.ptr->at(row, col) = val; END_WRAP } -CvStatus *Mat_SetUShort3(Mat m, int x, int y, int z, uint16_t val) -{ +CvStatus *Mat_SetUShort3(Mat m, int x, int y, int z, uint16_t val) { BEGIN_WRAP m.ptr->at(x, y, z) = val; END_WRAP @@ -785,15 +699,13 @@ CvStatus *Mat_SetUShort3(Mat m, int x, int y, int z, uint16_t val) // Mat_SetInt set a specific row/col value from this Mat expecting // each element to contain an int aka CV_32S. -CvStatus *Mat_SetInt(Mat m, int row, int col, int32_t val) -{ +CvStatus *Mat_SetInt(Mat m, int row, int col, int32_t val) { BEGIN_WRAP m.ptr->at(row, col) = val; END_WRAP } -CvStatus *Mat_SetInt3(Mat m, int x, int y, int z, int32_t val) -{ +CvStatus *Mat_SetInt3(Mat m, int x, int y, int z, int32_t val) { BEGIN_WRAP m.ptr->at(x, y, z) = val; END_WRAP @@ -801,15 +713,13 @@ CvStatus *Mat_SetInt3(Mat m, int x, int y, int z, int32_t val) // Mat_SetFloat set a specific row/col value from this Mat expecting // each element to contain a float aka CV_32F. -CvStatus *Mat_SetFloat(Mat m, int row, int col, float val) -{ +CvStatus *Mat_SetFloat(Mat m, int row, int col, float val) { BEGIN_WRAP m.ptr->at(row, col) = val; END_WRAP } -CvStatus *Mat_SetFloat3(Mat m, int x, int y, int z, float val) -{ +CvStatus *Mat_SetFloat3(Mat m, int x, int y, int z, float val) { BEGIN_WRAP m.ptr->at(x, y, z) = val; END_WRAP @@ -817,169 +727,146 @@ CvStatus *Mat_SetFloat3(Mat m, int x, int y, int z, float val) // Mat_SetDouble set a specific row/col value from this Mat expecting // each element to contain a double aka CV_64F. -CvStatus *Mat_SetDouble(Mat m, int row, int col, double val) -{ +CvStatus *Mat_SetDouble(Mat m, int row, int col, double val) { BEGIN_WRAP m.ptr->at(row, col) = val; END_WRAP } -CvStatus *Mat_SetDouble3(Mat m, int x, int y, int z, double val) -{ +CvStatus *Mat_SetDouble3(Mat m, int x, int y, int z, double val) { BEGIN_WRAP m.ptr->at(x, y, z) = val; END_WRAP } -CvStatus *Mat_SetVec2b(Mat m, int row, int col, Vec2b val) -{ +CvStatus *Mat_SetVec2b(Mat m, int row, int col, Vec2b val) { BEGIN_WRAP auto v = cv::Vec2b(val.val1, val.val2); m.ptr->at(row, col) = v; END_WRAP } -CvStatus *Mat_SetVec3b(Mat m, int row, int col, Vec3b val) -{ +CvStatus *Mat_SetVec3b(Mat m, int row, int col, Vec3b val) { BEGIN_WRAP auto v = cv::Vec3b(val.val1, val.val2, val.val3); m.ptr->at(row, col) = v; END_WRAP } -CvStatus *Mat_SetVec4b(Mat m, int row, int col, Vec4b val) -{ +CvStatus *Mat_SetVec4b(Mat m, int row, int col, Vec4b val) { BEGIN_WRAP auto v = cv::Vec4b(val.val1, val.val2, val.val3, val.val4); m.ptr->at(row, col) = v; END_WRAP } -CvStatus *Mat_SetVec2s(Mat m, int row, int col, Vec2s val) -{ +CvStatus *Mat_SetVec2s(Mat m, int row, int col, Vec2s val) { BEGIN_WRAP auto v = cv::Vec2s(val.val1, val.val2); m.ptr->at(row, col) = v; END_WRAP } -CvStatus *Mat_SetVec3s(Mat m, int row, int col, Vec3s val) -{ +CvStatus *Mat_SetVec3s(Mat m, int row, int col, Vec3s val) { BEGIN_WRAP auto v = cv::Vec3s(val.val1, val.val2, val.val3); m.ptr->at(row, col) = v; END_WRAP } -CvStatus *Mat_SetVec4s(Mat m, int row, int col, Vec4s val) -{ +CvStatus *Mat_SetVec4s(Mat m, int row, int col, Vec4s val) { BEGIN_WRAP auto v = cv::Vec4s(val.val1, val.val2, val.val3, val.val4); m.ptr->at(row, col) = v; END_WRAP } -CvStatus *Mat_SetVec2w(Mat m, int row, int col, Vec2w val) -{ +CvStatus *Mat_SetVec2w(Mat m, int row, int col, Vec2w val) { BEGIN_WRAP auto v = cv::Vec2w(val.val1, val.val2); m.ptr->at(row, col) = v; END_WRAP } -CvStatus *Mat_SetVec3w(Mat m, int row, int col, Vec3w val) -{ +CvStatus *Mat_SetVec3w(Mat m, int row, int col, Vec3w val) { BEGIN_WRAP auto v = cv::Vec3w(val.val1, val.val2, val.val3); m.ptr->at(row, col) = v; END_WRAP } -CvStatus *Mat_SetVec4w(Mat m, int row, int col, Vec4w val) -{ +CvStatus *Mat_SetVec4w(Mat m, int row, int col, Vec4w val) { BEGIN_WRAP auto v = cv::Vec4w(val.val1, val.val2, val.val3, val.val4); m.ptr->at(row, col) = v; END_WRAP } -CvStatus *Mat_SetVec2i(Mat m, int row, int col, Vec2i val) -{ +CvStatus *Mat_SetVec2i(Mat m, int row, int col, Vec2i val) { BEGIN_WRAP auto v = cv::Vec2i(val.val1, val.val2); m.ptr->at(row, col) = v; END_WRAP } -CvStatus *Mat_SetVec3i(Mat m, int row, int col, Vec3i val) -{ +CvStatus *Mat_SetVec3i(Mat m, int row, int col, Vec3i val) { BEGIN_WRAP auto v = cv::Vec3i(val.val1, val.val2, val.val3); m.ptr->at(row, col) = v; END_WRAP } -CvStatus *Mat_SetVec4i(Mat m, int row, int col, Vec4i val) -{ +CvStatus *Mat_SetVec4i(Mat m, int row, int col, Vec4i val) { BEGIN_WRAP auto v = cv::Vec4i(val.val1, val.val2, val.val3, val.val4); m.ptr->at(row, col) = v; END_WRAP } -CvStatus *Mat_SetVec6i(Mat m, int row, int col, Vec6i val) -{ +CvStatus *Mat_SetVec6i(Mat m, int row, int col, Vec6i val) { BEGIN_WRAP auto v = cv::Vec6i(val.val1, val.val2, val.val3, val.val4, val.val5, val.val6); m.ptr->at(row, col) = v; END_WRAP } -CvStatus *Mat_SetVec8i(Mat m, int row, int col, Vec8i val) -{ +CvStatus *Mat_SetVec8i(Mat m, int row, int col, Vec8i val) { BEGIN_WRAP - auto v = cv::Vec8i(val.val1, val.val2, val.val3, val.val4, val.val5, val.val6, val.val7, val.val8); + auto v = + cv::Vec8i(val.val1, val.val2, val.val3, val.val4, val.val5, val.val6, val.val7, val.val8); m.ptr->at(row, col) = v; END_WRAP } -CvStatus *Mat_SetVec2f(Mat m, int row, int col, Vec2f val) -{ +CvStatus *Mat_SetVec2f(Mat m, int row, int col, Vec2f val) { BEGIN_WRAP auto v = cv::Vec2f(val.val1, val.val2); m.ptr->at(row, col) = v; END_WRAP } -CvStatus *Mat_SetVec3f(Mat m, int row, int col, Vec3f val) -{ +CvStatus *Mat_SetVec3f(Mat m, int row, int col, Vec3f val) { BEGIN_WRAP auto v = cv::Vec3f(val.val1, val.val2, val.val3); m.ptr->at(row, col) = v; END_WRAP } -CvStatus *Mat_SetVec4f(Mat m, int row, int col, Vec4f val) -{ +CvStatus *Mat_SetVec4f(Mat m, int row, int col, Vec4f val) { BEGIN_WRAP auto v = cv::Vec4f(val.val1, val.val2, val.val3, val.val4); m.ptr->at(row, col) = v; END_WRAP } -CvStatus *Mat_SetVec6f(Mat m, int row, int col, Vec6f val) -{ +CvStatus *Mat_SetVec6f(Mat m, int row, int col, Vec6f val) { BEGIN_WRAP auto v = cv::Vec6f(val.val1, val.val2, val.val3, val.val4, val.val5, val.val6); m.ptr->at(row, col) = v; END_WRAP } -CvStatus *Mat_SetVec2d(Mat m, int row, int col, Vec2d val) -{ +CvStatus *Mat_SetVec2d(Mat m, int row, int col, Vec2d val) { BEGIN_WRAP auto v = cv::Vec2d(val.val1, val.val2); m.ptr->at(row, col) = v; END_WRAP } -CvStatus *Mat_SetVec3d(Mat m, int row, int col, Vec3d val) -{ +CvStatus *Mat_SetVec3d(Mat m, int row, int col, Vec3d val) { BEGIN_WRAP auto v = cv::Vec3d(val.val1, val.val2, val.val3); m.ptr->at(row, col) = v; END_WRAP } -CvStatus *Mat_SetVec4d(Mat m, int row, int col, Vec4d val) -{ +CvStatus *Mat_SetVec4d(Mat m, int row, int col, Vec4d val) { BEGIN_WRAP auto v = cv::Vec4d(val.val1, val.val2, val.val3, val.val4); m.ptr->at(row, col) = v; END_WRAP } -CvStatus *Mat_SetVec6d(Mat m, int row, int col, Vec6d val) -{ +CvStatus *Mat_SetVec6d(Mat m, int row, int col, Vec6d val) { BEGIN_WRAP auto v = cv::Vec6d(val.val1, val.val2, val.val3, val.val4, val.val5, val.val6); m.ptr->at(row, col) = v; @@ -990,263 +877,236 @@ CvStatus *Mat_SetVec6d(Mat m, int row, int col, Vec6d val) #pragma region Mat_operation -CvStatus *Mat_AddUChar(Mat m, uint8_t val) -{ +CvStatus *Mat_AddUChar(Mat m, uint8_t val) { BEGIN_WRAP *m.ptr += val; END_WRAP } -CvStatus *Mat_SubtractUChar(Mat m, uint8_t val) -{ +CvStatus *Mat_SubtractUChar(Mat m, uint8_t val) { BEGIN_WRAP *m.ptr -= val; END_WRAP } -CvStatus *Mat_MultiplyUChar(Mat m, uint8_t val) -{ +CvStatus *Mat_MultiplyUChar(Mat m, uint8_t val) { BEGIN_WRAP *m.ptr *= val; END_WRAP } -CvStatus *Mat_DivideUChar(Mat m, uint8_t val) -{ +CvStatus *Mat_DivideUChar(Mat m, uint8_t val) { BEGIN_WRAP *m.ptr /= val; END_WRAP } -CvStatus *Mat_AddSChar(Mat m, int8_t val) -{ +CvStatus *Mat_AddSChar(Mat m, int8_t val) { BEGIN_WRAP *m.ptr += val; END_WRAP } -CvStatus *Mat_SubtractSChar(Mat m, int8_t val) -{ +CvStatus *Mat_SubtractSChar(Mat m, int8_t val) { BEGIN_WRAP *m.ptr -= val; END_WRAP } -CvStatus *Mat_MultiplySChar(Mat m, int8_t val) -{ +CvStatus *Mat_MultiplySChar(Mat m, int8_t val) { BEGIN_WRAP *m.ptr *= val; END_WRAP } -CvStatus *Mat_DivideSChar(Mat m, int8_t val) -{ +CvStatus *Mat_DivideSChar(Mat m, int8_t val) { BEGIN_WRAP *m.ptr /= val; END_WRAP } -CvStatus *Mat_AddI32(Mat m, int32_t val) -{ +CvStatus *Mat_AddI32(Mat m, int32_t val) { BEGIN_WRAP *m.ptr += val; END_WRAP } -CvStatus *Mat_SubtractI32(Mat m, int32_t val) -{ +CvStatus *Mat_SubtractI32(Mat m, int32_t val) { BEGIN_WRAP *m.ptr -= val; END_WRAP } -CvStatus *Mat_MultiplyI32(Mat m, int32_t val) -{ +CvStatus *Mat_MultiplyI32(Mat m, int32_t val) { BEGIN_WRAP *m.ptr *= val; END_WRAP } -CvStatus *Mat_DivideI32(Mat m, int32_t val) -{ +CvStatus *Mat_DivideI32(Mat m, int32_t val) { BEGIN_WRAP *m.ptr /= val; END_WRAP } -CvStatus *Mat_AddFloat(Mat m, float val) -{ +CvStatus *Mat_AddFloat(Mat m, float val) { BEGIN_WRAP *m.ptr += val; END_WRAP } -CvStatus *Mat_SubtractFloat(Mat m, float val) -{ +CvStatus *Mat_SubtractFloat(Mat m, float val) { BEGIN_WRAP *m.ptr -= val; END_WRAP } -CvStatus *Mat_MultiplyFloat(Mat m, float val) -{ +CvStatus *Mat_MultiplyFloat(Mat m, float val) { BEGIN_WRAP *m.ptr *= val; END_WRAP } -CvStatus *Mat_DivideFloat(Mat m, float val) -{ +CvStatus *Mat_DivideFloat(Mat m, float val) { BEGIN_WRAP *m.ptr /= val; END_WRAP } -CvStatus *Mat_AddF64(Mat m, double_t val) -{ +CvStatus *Mat_AddF64(Mat m, double_t val) { BEGIN_WRAP *m.ptr += val; END_WRAP } -CvStatus *Mat_SubtractF64(Mat m, double_t val) -{ +CvStatus *Mat_SubtractF64(Mat m, double_t val) { BEGIN_WRAP *m.ptr -= val; END_WRAP } -CvStatus *Mat_MultiplyF64(Mat m, double_t val) -{ +CvStatus *Mat_MultiplyF64(Mat m, double_t val) { BEGIN_WRAP *m.ptr *= val; END_WRAP } -CvStatus *Mat_DivideF64(Mat m, double_t val) -{ +CvStatus *Mat_DivideF64(Mat m, double_t val) { BEGIN_WRAP *m.ptr /= val; END_WRAP } -CvStatus *Mat_MultiplyMatrix(Mat x, Mat y, Mat *rval) -{ +CvStatus *Mat_MultiplyMatrix(Mat x, Mat y, Mat *rval) { BEGIN_WRAP *rval = {new cv::Mat((*x.ptr) * (*y.ptr))}; END_WRAP } -CvStatus *Mat_AbsDiff(Mat src1, Mat src2, Mat dst) -{ +CvStatus *Mat_AbsDiff(Mat src1, Mat src2, Mat dst) { BEGIN_WRAP cv::absdiff(*src1.ptr, *src2.ptr, *dst.ptr); END_WRAP } -CvStatus *Mat_Add(Mat src1, Mat src2, Mat dst) -{ +CvStatus *Mat_Add(Mat src1, Mat src2, Mat dst) { BEGIN_WRAP cv::add(*src1.ptr, *src2.ptr, *dst.ptr); END_WRAP } -CvStatus *Mat_AddWeighted(Mat src1, double alpha, Mat src2, double beta, double gamma, Mat dst) -{ +CvStatus *Mat_AddWeighted(Mat src1, double alpha, Mat src2, double beta, double gamma, Mat dst) { BEGIN_WRAP cv::addWeighted(*src1.ptr, alpha, *src2.ptr, beta, gamma, *dst.ptr); END_WRAP } -CvStatus *Mat_BitwiseAnd(Mat src1, Mat src2, Mat dst) -{ +CvStatus *Mat_BitwiseAnd(Mat src1, Mat src2, Mat dst) { BEGIN_WRAP cv::bitwise_and(*src1.ptr, *src2.ptr, *dst.ptr); END_WRAP } -CvStatus *Mat_BitwiseAndWithMask(Mat src1, Mat src2, Mat dst, Mat mask) -{ +CvStatus *Mat_BitwiseAndWithMask(Mat src1, Mat src2, Mat dst, Mat mask) { BEGIN_WRAP cv::bitwise_and(*src1.ptr, *src2.ptr, *dst.ptr, *mask.ptr); END_WRAP } -CvStatus *Mat_BitwiseNot(Mat src1, Mat dst) -{ +CvStatus *Mat_BitwiseNot(Mat src1, Mat dst) { BEGIN_WRAP cv::bitwise_not(*src1.ptr, *dst.ptr); END_WRAP } -CvStatus *Mat_BitwiseNotWithMask(Mat src1, Mat dst, Mat mask) -{ +CvStatus *Mat_BitwiseNotWithMask(Mat src1, Mat dst, Mat mask) { BEGIN_WRAP cv::bitwise_not(*src1.ptr, *dst.ptr, *mask.ptr); END_WRAP } -CvStatus *Mat_BitwiseOr(Mat src1, Mat src2, Mat dst) -{ +CvStatus *Mat_BitwiseOr(Mat src1, Mat src2, Mat dst) { BEGIN_WRAP cv::bitwise_or(*src1.ptr, *src2.ptr, *dst.ptr); END_WRAP } -CvStatus *Mat_BitwiseOrWithMask(Mat src1, Mat src2, Mat dst, Mat mask) -{ +CvStatus *Mat_BitwiseOrWithMask(Mat src1, Mat src2, Mat dst, Mat mask) { BEGIN_WRAP cv::bitwise_or(*src1.ptr, *src2.ptr, *dst.ptr, *mask.ptr); END_WRAP } -CvStatus *Mat_BitwiseXor(Mat src1, Mat src2, Mat dst) -{ +CvStatus *Mat_BitwiseXor(Mat src1, Mat src2, Mat dst) { BEGIN_WRAP cv::bitwise_xor(*src1.ptr, *src2.ptr, *dst.ptr); END_WRAP } -CvStatus *Mat_BitwiseXorWithMask(Mat src1, Mat src2, Mat dst, Mat mask) -{ +CvStatus *Mat_BitwiseXorWithMask(Mat src1, Mat src2, Mat dst, Mat mask) { BEGIN_WRAP cv::bitwise_xor(*src1.ptr, *src2.ptr, *dst.ptr, *mask.ptr); END_WRAP } -CvStatus *Mat_Compare(Mat src1, Mat src2, Mat dst, int ct) -{ +CvStatus *Mat_Compare(Mat src1, Mat src2, Mat dst, int ct) { BEGIN_WRAP cv::compare(*src1.ptr, *src2.ptr, *dst.ptr, ct); END_WRAP } -CvStatus *Mat_BatchDistance(Mat src1, Mat src2, Mat dist, int dtype, Mat nidx, int normType, int K, Mat mask, - int update, bool crosscheck) -{ +CvStatus *Mat_BatchDistance( + Mat src1, + Mat src2, + Mat dist, + int dtype, + Mat nidx, + int normType, + int K, + Mat mask, + int update, + bool crosscheck +) { BEGIN_WRAP - cv::batchDistance(*src1.ptr, *src2.ptr, *dist.ptr, dtype, *nidx.ptr, normType, K, *mask.ptr, update, - crosscheck); + cv::batchDistance( + *src1.ptr, *src2.ptr, *dist.ptr, dtype, *nidx.ptr, normType, K, *mask.ptr, update, crosscheck + ); END_WRAP } -CvStatus *Mat_BorderInterpolate(int p, int len, int borderType, int *rval) -{ +CvStatus *Mat_BorderInterpolate(int p, int len, int borderType, int *rval) { BEGIN_WRAP *rval = cv::borderInterpolate(p, len, borderType); END_WRAP } -CvStatus *Mat_CalcCovarMatrix(Mat samples, Mat covar, Mat mean, int flags, int ctype) -{ +CvStatus *Mat_CalcCovarMatrix(Mat samples, Mat covar, Mat mean, int flags, int ctype) { BEGIN_WRAP cv::calcCovarMatrix(*samples.ptr, *covar.ptr, *mean.ptr, flags, ctype); END_WRAP } -CvStatus *Mat_CartToPolar(Mat x, Mat y, Mat magnitude, Mat angle, bool angleInDegrees) -{ +CvStatus *Mat_CartToPolar(Mat x, Mat y, Mat magnitude, Mat angle, bool angleInDegrees) { BEGIN_WRAP cv::cartToPolar(*x.ptr, *y.ptr, *magnitude.ptr, *angle.ptr, angleInDegrees); END_WRAP } -CvStatus *Mat_CheckRange(Mat m, bool quiet, Point *pos, double minVal, double maxVal, bool *rval) -{ +CvStatus *Mat_CheckRange(Mat m, bool quiet, Point *pos, double minVal, double maxVal, bool *rval) { BEGIN_WRAP cv::Point pos1; *rval = cv::checkRange(*m.ptr, quiet, &pos1, minVal, maxVal); @@ -1254,160 +1114,138 @@ CvStatus *Mat_CheckRange(Mat m, bool quiet, Point *pos, double minVal, double ma pos->y = pos1.y; END_WRAP } -CvStatus *Mat_CompleteSymm(Mat m, bool lowerToUpper) -{ +CvStatus *Mat_CompleteSymm(Mat m, bool lowerToUpper) { BEGIN_WRAP cv::completeSymm(*m.ptr, lowerToUpper); END_WRAP } -CvStatus *Mat_ConvertScaleAbs(Mat src, Mat dst, double alpha, double beta) -{ +CvStatus *Mat_ConvertScaleAbs(Mat src, Mat dst, double alpha, double beta) { BEGIN_WRAP cv::convertScaleAbs(*src.ptr, *dst.ptr, alpha, beta); END_WRAP } -CvStatus *Mat_CopyMakeBorder(Mat src, Mat dst, int top, int bottom, int left, int right, int borderType, - Scalar value) -{ +CvStatus *Mat_CopyMakeBorder( + Mat src, Mat dst, int top, int bottom, int left, int right, int borderType, Scalar value +) { BEGIN_WRAP cv::Scalar c_value(value.val1, value.val2, value.val3, value.val4); cv::copyMakeBorder(*src.ptr, *dst.ptr, top, bottom, left, right, borderType, c_value); END_WRAP } -CvStatus *Mat_CountNonZero(Mat src, int *rval) -{ +CvStatus *Mat_CountNonZero(Mat src, int *rval) { BEGIN_WRAP *rval = cv::countNonZero(*src.ptr); END_WRAP } -CvStatus *Mat_DCT(Mat src, Mat dst, int flags) -{ +CvStatus *Mat_DCT(Mat src, Mat dst, int flags) { BEGIN_WRAP cv::dct(*src.ptr, *dst.ptr, flags); END_WRAP } -CvStatus *Mat_Determinant(Mat m, double *rval) -{ +CvStatus *Mat_Determinant(Mat m, double *rval) { BEGIN_WRAP *rval = cv::determinant(*m.ptr); END_WRAP } -CvStatus *Mat_DFT(Mat m, Mat dst, int flags) -{ +CvStatus *Mat_DFT(Mat m, Mat dst, int flags) { BEGIN_WRAP cv::dft(*m.ptr, *dst.ptr, flags); END_WRAP } -CvStatus *Mat_Divide(Mat src1, Mat src2, Mat dst) -{ +CvStatus *Mat_Divide(Mat src1, Mat src2, Mat dst) { BEGIN_WRAP cv::divide(*src1.ptr, *src2.ptr, *dst.ptr); END_WRAP } -CvStatus *Mat_Eigen(Mat src, Mat eigenvalues, Mat eigenvectors, bool *rval) -{ +CvStatus *Mat_Eigen(Mat src, Mat eigenvalues, Mat eigenvectors, bool *rval) { BEGIN_WRAP *rval = cv::eigen(*src.ptr, *eigenvalues.ptr, *eigenvectors.ptr); END_WRAP } -CvStatus *Mat_EigenNonSymmetric(Mat src, Mat eigenvalues, Mat eigenvectors) -{ +CvStatus *Mat_EigenNonSymmetric(Mat src, Mat eigenvalues, Mat eigenvectors) { BEGIN_WRAP cv::eigenNonSymmetric(*src.ptr, *eigenvalues.ptr, *eigenvectors.ptr); END_WRAP } -CvStatus *Mat_PCACompute(Mat src, Mat mean, Mat eigenvectors, Mat eigenvalues, int maxComponents) -{ +CvStatus *Mat_PCACompute(Mat src, Mat mean, Mat eigenvectors, Mat eigenvalues, int maxComponents) { BEGIN_WRAP cv::PCACompute(*src.ptr, *mean.ptr, *eigenvectors.ptr, *eigenvalues.ptr, maxComponents); END_WRAP } -CvStatus *Mat_Exp(Mat src, Mat dst) -{ +CvStatus *Mat_Exp(Mat src, Mat dst) { BEGIN_WRAP cv::exp(*src.ptr, *dst.ptr); END_WRAP } -CvStatus *Mat_ExtractChannel(Mat src, Mat dst, int coi) -{ +CvStatus *Mat_ExtractChannel(Mat src, Mat dst, int coi) { BEGIN_WRAP cv::extractChannel(*src.ptr, *dst.ptr, coi); END_WRAP } -CvStatus *Mat_FindNonZero(Mat src, Mat idx) -{ +CvStatus *Mat_FindNonZero(Mat src, Mat idx) { BEGIN_WRAP cv::findNonZero(*src.ptr, *idx.ptr); END_WRAP } -CvStatus *Mat_Flip(Mat src, Mat dst, int flipCode) -{ +CvStatus *Mat_Flip(Mat src, Mat dst, int flipCode) { BEGIN_WRAP cv::flip(*src.ptr, *dst.ptr, flipCode); END_WRAP } -CvStatus *Mat_Gemm(Mat src1, Mat src2, double alpha, Mat src3, double beta, Mat dst, int flags) -{ +CvStatus *Mat_Gemm(Mat src1, Mat src2, double alpha, Mat src3, double beta, Mat dst, int flags) { BEGIN_WRAP cv::gemm(*src1.ptr, *src2.ptr, alpha, *src3.ptr, beta, *dst.ptr, flags); END_WRAP } -CvStatus *Mat_GetOptimalDFTSize(int vecsize, int *rval) -{ +CvStatus *Mat_GetOptimalDFTSize(int vecsize, int *rval) { BEGIN_WRAP *rval = cv::getOptimalDFTSize(vecsize); END_WRAP } -CvStatus *Mat_Hconcat(Mat src1, Mat src2, Mat dst) -{ +CvStatus *Mat_Hconcat(Mat src1, Mat src2, Mat dst) { BEGIN_WRAP cv::hconcat(*src1.ptr, *src2.ptr, *dst.ptr); END_WRAP } -CvStatus *Mat_Vconcat(Mat src1, Mat src2, Mat dst) -{ +CvStatus *Mat_Vconcat(Mat src1, Mat src2, Mat dst) { BEGIN_WRAP cv::vconcat(*src1.ptr, *src2.ptr, *dst.ptr); END_WRAP } -CvStatus *Mat_Idct(Mat src, Mat dst, int flags) -{ +CvStatus *Mat_Idct(Mat src, Mat dst, int flags) { BEGIN_WRAP cv::idct(*src.ptr, *dst.ptr, flags); END_WRAP } -CvStatus *Mat_Idft(Mat src, Mat dst, int flags, int nonzeroRows) -{ +CvStatus *Mat_Idft(Mat src, Mat dst, int flags, int nonzeroRows) { BEGIN_WRAP cv::idft(*src.ptr, *dst.ptr, flags, nonzeroRows); END_WRAP } -CvStatus *Mat_InRange(Mat src, Mat lowerb, Mat upperb, Mat dst) -{ +CvStatus *Mat_InRange(Mat src, Mat lowerb, Mat upperb, Mat dst) { BEGIN_WRAP cv::inRange(*src.ptr, *lowerb.ptr, *upperb.ptr, *dst.ptr); END_WRAP } -CvStatus *Mat_InRangeWithScalar(Mat src, Scalar lowerb, Scalar upperb, Mat dst) -{ +CvStatus *Mat_InRangeWithScalar(Mat src, Scalar lowerb, Scalar upperb, Mat dst) { BEGIN_WRAP cv::Scalar lb = cv::Scalar(lowerb.val1, lowerb.val2, lowerb.val3, lowerb.val4); cv::Scalar ub = cv::Scalar(upperb.val1, upperb.val2, upperb.val3, upperb.val4); @@ -1415,42 +1253,36 @@ CvStatus *Mat_InRangeWithScalar(Mat src, Scalar lowerb, Scalar upperb, Mat dst) END_WRAP } -CvStatus *Mat_InsertChannel(Mat src, Mat dst, int coi) -{ +CvStatus *Mat_InsertChannel(Mat src, Mat dst, int coi) { BEGIN_WRAP cv::insertChannel(*src.ptr, *dst.ptr, coi); END_WRAP } -CvStatus *Mat_Invert(Mat src, Mat dst, int flags, double *rval) -{ +CvStatus *Mat_Invert(Mat src, Mat dst, int flags, double *rval) { BEGIN_WRAP *rval = cv::invert(*src.ptr, *dst.ptr, flags); END_WRAP } -CvStatus *Mat_Log(Mat src, Mat dst) -{ +CvStatus *Mat_Log(Mat src, Mat dst) { BEGIN_WRAP cv::log(*src.ptr, *dst.ptr); END_WRAP } -CvStatus *Mat_Magnitude(Mat x, Mat y, Mat magnitude) -{ +CvStatus *Mat_Magnitude(Mat x, Mat y, Mat magnitude) { BEGIN_WRAP cv::magnitude(*x.ptr, *y.ptr, *magnitude.ptr); END_WRAP } -CvStatus *Mat_Max(Mat src1, Mat src2, Mat dst) -{ +CvStatus *Mat_Max(Mat src1, Mat src2, Mat dst) { BEGIN_WRAP cv::max(*src1.ptr, *src2.ptr, *dst.ptr); END_WRAP } -CvStatus *Mat_MeanStdDev(Mat src, Scalar *dstMean, Scalar *dstStdDev) -{ +CvStatus *Mat_MeanStdDev(Mat src, Scalar *dstMean, Scalar *dstStdDev) { BEGIN_WRAP cv::Scalar mean, sd; cv::meanStdDev(*src.ptr, mean, sd); @@ -1459,8 +1291,7 @@ CvStatus *Mat_MeanStdDev(Mat src, Scalar *dstMean, Scalar *dstStdDev) END_WRAP } -CvStatus *Mat_MeanStdDevWithMask(Mat src, Scalar *dstMean, Scalar *dstStdDev, Mat mask) -{ +CvStatus *Mat_MeanStdDevWithMask(Mat src, Scalar *dstMean, Scalar *dstStdDev, Mat mask) { BEGIN_WRAP cv::Scalar mean, sd; cv::meanStdDev(*src.ptr, mean, sd, *mask.ptr); @@ -1469,29 +1300,25 @@ CvStatus *Mat_MeanStdDevWithMask(Mat src, Scalar *dstMean, Scalar *dstStdDev, Ma END_WRAP } -CvStatus *Mat_Merge(VecMat vec, Mat dst) -{ +CvStatus *Mat_Merge(VecMat vec, Mat dst) { BEGIN_WRAP cv::merge(*vec.ptr, *dst.ptr); END_WRAP } -CvStatus *Mat_Min(Mat src1, Mat src2, Mat dst) -{ +CvStatus *Mat_Min(Mat src1, Mat src2, Mat dst) { BEGIN_WRAP cv::min(*src1.ptr, *src2.ptr, *dst.ptr); END_WRAP } -CvStatus *Mat_MinMaxIdx(Mat m, double *minVal, double *maxVal, int *minIdx, int *maxIdx) -{ +CvStatus *Mat_MinMaxIdx(Mat m, double *minVal, double *maxVal, int *minIdx, int *maxIdx) { BEGIN_WRAP cv::minMaxIdx(*m.ptr, minVal, maxVal, minIdx, maxIdx); END_WRAP } -CvStatus *Mat_MinMaxLoc(Mat m, double *minVal, double *maxVal, Point *minLoc, Point *maxLoc) -{ +CvStatus *Mat_MinMaxLoc(Mat m, double *minVal, double *maxVal, Point *minLoc, Point *maxLoc) { BEGIN_WRAP cv::Point cMinLoc, cMaxLoc; cv::minMaxLoc(*m.ptr, minVal, maxVal, &cMinLoc, &cMaxLoc); @@ -1501,126 +1328,108 @@ CvStatus *Mat_MinMaxLoc(Mat m, double *minVal, double *maxVal, Point *minLoc, Po END_WRAP } -CvStatus *Mat_MixChannels(VecMat src, VecMat dst, VecInt fromTo) -{ +CvStatus *Mat_MixChannels(VecMat src, VecMat dst, VecInt fromTo) { BEGIN_WRAP cv::mixChannels(*src.ptr, *dst.ptr, *fromTo.ptr); END_WRAP } -CvStatus *Mat_MulSpectrums(Mat a, Mat b, Mat c, int flags) -{ +CvStatus *Mat_MulSpectrums(Mat a, Mat b, Mat c, int flags) { BEGIN_WRAP cv::mulSpectrums(*a.ptr, *b.ptr, *c.ptr, flags); END_WRAP } -CvStatus *Mat_Multiply(Mat src1, Mat src2, Mat dst) -{ +CvStatus *Mat_Multiply(Mat src1, Mat src2, Mat dst) { BEGIN_WRAP cv::multiply(*src1.ptr, *src2.ptr, *dst.ptr); END_WRAP } -CvStatus *Mat_MultiplyWithParams(Mat src1, Mat src2, Mat dst, double scale, int dtype) -{ +CvStatus *Mat_MultiplyWithParams(Mat src1, Mat src2, Mat dst, double scale, int dtype) { BEGIN_WRAP cv::multiply(*src1.ptr, *src2.ptr, *dst.ptr, scale, dtype); END_WRAP } -CvStatus *Mat_Normalize(Mat src, Mat dst, double alpha, double beta, int typ) -{ +CvStatus *Mat_Normalize(Mat src, Mat dst, double alpha, double beta, int typ) { BEGIN_WRAP cv::normalize(*src.ptr, *dst.ptr, alpha, beta, typ); END_WRAP } -CvStatus *Mat_PerspectiveTransform(Mat src, Mat dst, Mat tm) -{ +CvStatus *Mat_PerspectiveTransform(Mat src, Mat dst, Mat tm) { BEGIN_WRAP cv::perspectiveTransform(*src.ptr, *dst.ptr, *tm.ptr); END_WRAP } -CvStatus *Mat_Solve(Mat src1, Mat src2, Mat dst, int flags, bool *rval) -{ +CvStatus *Mat_Solve(Mat src1, Mat src2, Mat dst, int flags, bool *rval) { BEGIN_WRAP *rval = cv::solve(*src1.ptr, *src2.ptr, *dst.ptr, flags); END_WRAP } -CvStatus *Mat_SolveCubic(Mat coeffs, Mat roots, int *rval) -{ +CvStatus *Mat_SolveCubic(Mat coeffs, Mat roots, int *rval) { BEGIN_WRAP *rval = cv::solveCubic(*coeffs.ptr, *roots.ptr); END_WRAP } -CvStatus *Mat_SolvePoly(Mat coeffs, Mat roots, int maxIters, double *rval) -{ +CvStatus *Mat_SolvePoly(Mat coeffs, Mat roots, int maxIters, double *rval) { BEGIN_WRAP *rval = cv::solvePoly(*coeffs.ptr, *roots.ptr, maxIters); END_WRAP } -CvStatus *Mat_Reduce(Mat src, Mat dst, int dim, int rType, int dType) -{ +CvStatus *Mat_Reduce(Mat src, Mat dst, int dim, int rType, int dType) { BEGIN_WRAP cv::reduce(*src.ptr, *dst.ptr, dim, rType, dType); END_WRAP } -CvStatus *Mat_ReduceArgMax(Mat src, Mat dst, int axis, bool lastIndex) -{ +CvStatus *Mat_ReduceArgMax(Mat src, Mat dst, int axis, bool lastIndex) { BEGIN_WRAP cv::reduceArgMax(*src.ptr, *dst.ptr, axis, lastIndex); END_WRAP } -CvStatus *Mat_ReduceArgMin(Mat src, Mat dst, int axis, bool lastIndex) -{ +CvStatus *Mat_ReduceArgMin(Mat src, Mat dst, int axis, bool lastIndex) { BEGIN_WRAP cv::reduceArgMin(*src.ptr, *dst.ptr, axis, lastIndex); END_WRAP } -CvStatus *Mat_Repeat(Mat src, int nY, int nX, Mat dst) -{ +CvStatus *Mat_Repeat(Mat src, int nY, int nX, Mat dst) { BEGIN_WRAP cv::repeat(*src.ptr, nY, nX, *dst.ptr); END_WRAP } -CvStatus *Mat_ScaleAdd(Mat src1, double alpha, Mat src2, Mat dst) -{ +CvStatus *Mat_ScaleAdd(Mat src1, double alpha, Mat src2, Mat dst) { BEGIN_WRAP cv::scaleAdd(*src1.ptr, alpha, *src2.ptr, *dst.ptr); END_WRAP } -CvStatus *Mat_SetIdentity(Mat src, double scalar) -{ +CvStatus *Mat_SetIdentity(Mat src, double scalar) { BEGIN_WRAP cv::setIdentity(*src.ptr, scalar); END_WRAP } -CvStatus *Mat_Sort(Mat src, Mat dst, int flags) -{ +CvStatus *Mat_Sort(Mat src, Mat dst, int flags) { BEGIN_WRAP cv::sort(*src.ptr, *dst.ptr, flags); END_WRAP } -CvStatus *Mat_SortIdx(Mat src, Mat dst, int flags) -{ +CvStatus *Mat_SortIdx(Mat src, Mat dst, int flags) { BEGIN_WRAP cv::sortIdx(*src.ptr, *dst.ptr, flags); END_WRAP } -CvStatus *Mat_Split(Mat src, VecMat *rval) -{ +CvStatus *Mat_Split(Mat src, VecMat *rval) { BEGIN_WRAP std::vector channels; cv::split(*src.ptr, channels); @@ -1628,132 +1437,134 @@ CvStatus *Mat_Split(Mat src, VecMat *rval) END_WRAP } -CvStatus *Mat_Subtract(Mat src1, Mat src2, Mat dst) -{ +CvStatus *Mat_Subtract(Mat src1, Mat src2, Mat dst) { BEGIN_WRAP cv::subtract(*src1.ptr, *src2.ptr, *dst.ptr); END_WRAP } CvStatus *Mat_T(Mat x, Mat *rval); -CvStatus *Mat_Trace(Mat src, Scalar *rval) -{ +CvStatus *Mat_Trace(Mat src, Scalar *rval) { BEGIN_WRAP cv::Scalar c = cv::trace(*src.ptr); - Scalar scal = Scalar(); + Scalar scal = Scalar(); *rval = {c.val[0], c.val[1], c.val[2], c.val[3]}; END_WRAP } -CvStatus *Mat_Transform(Mat src, Mat dst, Mat tm) -{ +CvStatus *Mat_Transform(Mat src, Mat dst, Mat tm) { BEGIN_WRAP cv::transform(*src.ptr, *dst.ptr, *tm.ptr); END_WRAP } -CvStatus *Mat_Transpose(Mat src, Mat dst) -{ +CvStatus *Mat_Transpose(Mat src, Mat dst) { BEGIN_WRAP cv::transpose(*src.ptr, *dst.ptr); END_WRAP } -CvStatus *Mat_PolarToCart(Mat magnitude, Mat degree, Mat x, Mat y, bool angleInDegrees) -{ +CvStatus *Mat_PolarToCart(Mat magnitude, Mat degree, Mat x, Mat y, bool angleInDegrees) { BEGIN_WRAP cv::polarToCart(*magnitude.ptr, *degree.ptr, *x.ptr, *y.ptr, angleInDegrees); END_WRAP } -CvStatus *Mat_Pow(Mat src, double power, Mat dst) -{ +CvStatus *Mat_Pow(Mat src, double power, Mat dst) { BEGIN_WRAP cv::pow(*src.ptr, power, *dst.ptr); END_WRAP } -CvStatus *Mat_Phase(Mat x, Mat y, Mat angle, bool angleInDegrees) -{ +CvStatus *Mat_Phase(Mat x, Mat y, Mat angle, bool angleInDegrees) { BEGIN_WRAP cv::phase(*x.ptr, *y.ptr, *angle.ptr, angleInDegrees); END_WRAP } -CvStatus *Mat_Sum(Mat src, Scalar *rval) -{ +CvStatus *Mat_Sum(Mat src, Scalar *rval) { BEGIN_WRAP cv::Scalar c = cv::sum(*src.ptr); *rval = {c.val[0], c.val[1], c.val[2], c.val[3]}; END_WRAP } -CvStatus *Mat_rowRange(Mat m, int start, int end, Mat *rval) -{ +CvStatus *Mat_rowRange(Mat m, int start, int end, Mat *rval) { BEGIN_WRAP *rval = {new cv::Mat(m.ptr->rowRange(start, end))}; END_WRAP } -CvStatus *Mat_colRange(Mat m, int start, int end, Mat *rval) -{ +CvStatus *Mat_colRange(Mat m, int start, int end, Mat *rval) { BEGIN_WRAP *rval = {new cv::Mat(m.ptr->colRange(start, end))}; END_WRAP } // https://docs.opencv.org/4.x/db/da5/tutorial_how_to_scan_images.html#:~:text=Goal -CvStatus *LUT(Mat src, Mat lut, Mat dst) -{ +CvStatus *LUT(Mat src, Mat lut, Mat dst) { BEGIN_WRAP auto cn = src.ptr->channels(), depth = src.ptr->depth(); if (depth == CV_8U || depth == CV_8S) { cv::LUT(*src.ptr, *lut.ptr, *dst.ptr); } else { - int lutcn = lut.ptr->channels(), lut_depth = lut.ptr->depth(); + int lutcn = lut.ptr->channels(), lut_depth = lut.ptr->depth(); size_t lut_total = lut.ptr->total(), expect_total = 0; switch (depth) { case CV_8U: - case CV_8S: - expect_total = 256; - break; + case CV_8S: expect_total = 256; break; case CV_16U: - case CV_16S: - expect_total = 65536; - break; + case CV_16S: expect_total = 65536; break; // TODO: can't create a mat with 4294967296 rows, maybe use vector instead // case CV_32S: // expect_total = 4294967296; // break; default: - throw cv::Exception(cv::Error::StsNotImplemented, "source Mat Type not supported", __func__, __FILE__, - __LINE__); + throw cv::Exception( + cv::Error::StsNotImplemented, + "source Mat Type not supported", + __func__, + __FILE__, + __LINE__ + ); } CV_Assert((lutcn == cn || lutcn == 1) && lut_total == expect_total && lut.ptr->isContinuous()); dst.ptr->create(src.ptr->dims, src.ptr->size, CV_MAKETYPE(lut.ptr->depth(), cn)); - const cv::Mat *arrays[] = {src.ptr, dst.ptr, 0}; - uchar *ptrs[2] = {}; + const cv::Mat *arrays[] = {src.ptr, dst.ptr, 0}; + uchar *ptrs[2] = {}; cv::NAryMatIterator it(arrays, ptrs); - int len = (int)it.size; + int len = (int)it.size; switch (depth) { case CV_16U: switch (lut_depth) { case CV_8U: - cvd::LUT16u_8u(src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn); + cvd::LUT16u_8u( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn + ); break; case CV_8S: - cvd::LUT16u_8s(src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn); + cvd::LUT16u_8s( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn + ); break; case CV_16U: - cvd::LUT16u_16u(src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, - lutcn); + cvd::LUT16u_16u( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn + ); break; case CV_16S: - cvd::LUT16u_16s(src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn); + cvd::LUT16u_16s( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn + ); break; case CV_32S: - cvd::LUT16u_32s(src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn); + cvd::LUT16u_32s( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn + ); break; case CV_32F: - cvd::LUT16u_32f(src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn); + cvd::LUT16u_32f( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn + ); break; case CV_64F: - cvd::LUT16u_64f(src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, - lutcn); + cvd::LUT16u_64f( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn + ); break; default: cv::String err = "lut Mat Type not supported for CV_16U"; @@ -1763,27 +1574,39 @@ CvStatus *LUT(Mat src, Mat lut, Mat dst) case CV_16S: switch (lut_depth) { case CV_8U: - cvd::LUT16s_8u(src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn); + cvd::LUT16s_8u( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn + ); break; case CV_8S: - cvd::LUT16s_8s(src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn); + cvd::LUT16s_8s( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn + ); break; case CV_16U: - cvd::LUT16s_16u(src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, - lutcn); + cvd::LUT16s_16u( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn + ); break; case CV_16S: - cvd::LUT16s_16s(src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn); + cvd::LUT16s_16s( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn + ); break; case CV_32S: - cvd::LUT16s_32s(src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn); + cvd::LUT16s_32s( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn + ); break; case CV_32F: - cvd::LUT16s_32f(src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn); + cvd::LUT16s_32f( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn + ); break; case CV_64F: - cvd::LUT16s_64f(src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, - lutcn); + cvd::LUT16s_64f( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn + ); break; default: cv::String err = "lut Mat Type not supported for CV_16S"; @@ -1793,13 +1616,19 @@ CvStatus *LUT(Mat src, Mat lut, Mat dst) case CV_32S: switch (lut_depth) { case CV_32S: - cvd::LUT32s_32s(src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn); + cvd::LUT32s_32s( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn + ); break; case CV_32F: - cvd::LUT32s_32f(src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn); + cvd::LUT32s_32f( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn + ); break; case CV_64F: - cvd::LUT32s_64f(src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn); + cvd::LUT32s_64f( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr->ptr(), len, cn, lutcn + ); break; default: cv::String err = "lut Mat Type not supported for CV_32S"; @@ -1814,36 +1643,47 @@ CvStatus *LUT(Mat src, Mat lut, Mat dst) END_WRAP } -CvStatus *KMeans(Mat data, int k, Mat bestLabels, TermCriteria criteria, int attempts, int flags, Mat centers, - double *rval) -{ +CvStatus *KMeans( + Mat data, + int k, + Mat bestLabels, + TermCriteria criteria, + int attempts, + int flags, + Mat centers, + double *rval +) { BEGIN_WRAP auto tc = cv::TermCriteria(criteria.type, criteria.maxCount, criteria.epsilon); *rval = cv::kmeans(*data.ptr, k, *bestLabels.ptr, tc, attempts, flags, *centers.ptr); END_WRAP } -CvStatus *KMeansPoints(VecPoint2f pts, int k, Mat bestLabels, TermCriteria criteria, int attempts, int flags, - Mat centers, double *rval) -{ +CvStatus *KMeansPoints( + VecPoint2f pts, + int k, + Mat bestLabels, + TermCriteria criteria, + int attempts, + int flags, + Mat centers, + double *rval +) { BEGIN_WRAP auto tc = cv::TermCriteria(criteria.type, criteria.maxCount, criteria.epsilon); *rval = cv::kmeans(*pts.ptr, k, *bestLabels.ptr, tc, attempts, flags, *centers.ptr); END_WRAP } -CvStatus *Rotate(Mat src, Mat dst, int rotateCode) -{ +CvStatus *Rotate(Mat src, Mat dst, int rotateCode) { BEGIN_WRAP cv::rotate(*src.ptr, *dst.ptr, rotateCode); END_WRAP } -CvStatus *Norm(Mat src1, int normType, double *rval) -{ +CvStatus *Norm(Mat src1, int normType, double *rval) { BEGIN_WRAP *rval = cv::norm(*src1.ptr, normType); END_WRAP } -CvStatus *NormWithMats(Mat src1, Mat src2, int normType, double *rval) -{ +CvStatus *NormWithMats(Mat src1, Mat src2, int normType, double *rval) { BEGIN_WRAP *rval = cv::norm(*src1.ptr, *src2.ptr, normType); END_WRAP @@ -1852,84 +1692,71 @@ CvStatus *NormWithMats(Mat src1, Mat src2, int normType, double *rval) #pragma region RNG -CvStatus *Rng_New(RNG *rval) -{ +CvStatus *Rng_New(RNG *rval) { BEGIN_WRAP *rval = {new cv::RNG()}; END_WRAP } -CvStatus *Rng_NewWithState(uint64_t state, RNG *rval) -{ +CvStatus *Rng_NewWithState(uint64_t state, RNG *rval) { BEGIN_WRAP *rval = {new cv::RNG(state)}; END_WRAP } -void Rng_Close(RNGPtr rng){CVD_FREE(rng)} +void Rng_Close(RNGPtr rng) { CVD_FREE(rng); } -CvStatus *TheRNG(RNG *rval) -{ +CvStatus *TheRNG(RNG *rval) { BEGIN_WRAP *rval = {new cv::RNG(cv::theRNG())}; END_WRAP } -CvStatus *SetRNGSeed(int seed) -{ +CvStatus *SetRNGSeed(int seed) { BEGIN_WRAP cv::setRNGSeed(seed); END_WRAP } -CvStatus *RNG_Fill(RNG rng, Mat mat, int distType, double a, double b, bool saturateRange) -{ +CvStatus *RNG_Fill(RNG rng, Mat mat, int distType, double a, double b, bool saturateRange) { BEGIN_WRAP rng.ptr->fill(*mat.ptr, distType, a, b, saturateRange); END_WRAP } -CvStatus *RNG_Gaussian(RNG rng, double sigma, double *rval) -{ +CvStatus *RNG_Gaussian(RNG rng, double sigma, double *rval) { BEGIN_WRAP *rval = rng.ptr->gaussian(sigma); END_WRAP } -CvStatus *RNG_Uniform(RNG rng, int a, int b, int *rval) -{ +CvStatus *RNG_Uniform(RNG rng, int a, int b, int *rval) { BEGIN_WRAP *rval = rng.ptr->uniform(a, b); END_WRAP } -CvStatus *RNG_UniformDouble(RNG rng, double a, double b, double *rval) -{ +CvStatus *RNG_UniformDouble(RNG rng, double a, double b, double *rval) { BEGIN_WRAP *rval = rng.ptr->uniform(a, b); END_WRAP } -CvStatus *RNG_Next(RNG rng, uint32_t *rval) -{ +CvStatus *RNG_Next(RNG rng, uint32_t *rval) { BEGIN_WRAP *rval = rng.ptr->next(); END_WRAP } -CvStatus *RandN(Mat mat, Scalar mean, Scalar stddev) -{ +CvStatus *RandN(Mat mat, Scalar mean, Scalar stddev) { BEGIN_WRAP auto c_mean = cv::Scalar(mean.val1, mean.val2, mean.val3, mean.val4); auto c_stddev = cv::Scalar(stddev.val1, stddev.val2, stddev.val3, stddev.val4); cv::randn(*mat.ptr, c_mean, c_stddev); END_WRAP } -CvStatus *RandShuffle(Mat mat) -{ +CvStatus *RandShuffle(Mat mat) { BEGIN_WRAP cv::randShuffle(*mat.ptr); END_WRAP } -CvStatus *RandShuffleWithParams(Mat mat, double iterFactor, RNG rng) -{ +CvStatus *RandShuffleWithParams(Mat mat, double iterFactor, RNG rng) { BEGIN_WRAP cv::randShuffle(*mat.ptr, iterFactor, rng.ptr); END_WRAP } -CvStatus *RandU(Mat mat, Scalar low, Scalar high) -{ +CvStatus *RandU(Mat mat, Scalar low, Scalar high) { BEGIN_WRAP auto c_low = cv::Scalar(low.val1, low.val2, low.val3, low.val4); auto c_high = cv::Scalar(high.val1, high.val2, high.val3, high.val4); @@ -1938,26 +1765,22 @@ CvStatus *RandU(Mat mat, Scalar low, Scalar high) } #pragma endregion -CvStatus *GetCVTickCount(int64_t *rval) -{ +CvStatus *GetCVTickCount(int64_t *rval) { BEGIN_WRAP *rval = cv::getTickCount(); END_WRAP } -CvStatus *GetTickFrequency(double *rval) -{ +CvStatus *GetTickFrequency(double *rval) { BEGIN_WRAP *rval = cv::getTickFrequency(); END_WRAP } -CvStatus *SetNumThreads(int n) -{ +CvStatus *SetNumThreads(int n) { BEGIN_WRAP cv::setNumThreads(n); END_WRAP } -CvStatus *GetNumThreads(int *rval) -{ +CvStatus *GetNumThreads(int *rval) { BEGIN_WRAP *rval = cv::getNumThreads(); END_WRAP diff --git a/src/core/core.h b/src/core/core.h index c237c4d1..2fea54e0 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -9,394 +9,12 @@ #ifndef _OPENCV3_CORE_H_ #define _OPENCV3_CORE_H_ -#include -#include -#include +#include "types.h" #ifdef __cplusplus -#include -#include extern "C" { #endif -#define CVD_OUT - -#define BEGIN_WRAP try { -#define END_WRAP \ - CvStatus *s = new CvStatus{ \ - .code = 0, \ - .msg = strdup("success"), \ - .err = strdup(""), \ - .func = strdup(__FUNCTION__), \ - .file = strdup(__FILE__), \ - .line = __LINE__, \ - }; \ - return s; \ - } \ - catch (cv::Exception & e) \ - { \ - CvStatus *s = new CvStatus{ \ - .code = e.code, \ - .msg = strdup(e.msg.c_str()), \ - .err = strdup(e.err.c_str()), \ - .func = strdup(e.func.c_str()), \ - .file = strdup(e.file.c_str()), \ - .line = e.line, \ - }; \ - return s; \ - } \ - catch (std::exception & e) \ - { \ - CvStatus *s = new CvStatus{ \ - .code = 1, \ - .msg = strdup(e.what()), \ - .err = strdup(e.what()), \ - .func = strdup(__FUNCTION__), \ - .file = strdup(__FILE__), \ - .line = __LINE__, \ - }; \ - return s; \ - } \ - catch (...) \ - { \ - CvStatus *s = new CvStatus{ \ - .code = 1, \ - .msg = strdup("Unknown error"), \ - .err = strdup("Unknown error"), \ - .func = strdup(__FUNCTION__), \ - .file = strdup(__FILE__), \ - .line = __LINE__, \ - }; \ - return s; \ - } - -#define CVD_TYPECAST_C(value) reinterpret_cast(value); - -#ifdef __cplusplus -#define CVD_TYPECAST_CPP(TYPE, value) reinterpret_cast(value->ptr) -// for test, value should not be freed here -#ifdef CVD_ENABLE_TEST -#define CVD_FREE(value) \ - delete value->ptr; \ - value->ptr = nullptr; -#else -// for dart ffi, value should be freed here or a memory leak will occur -#define CVD_FREE(value) \ - delete value->ptr; \ - value->ptr = nullptr; \ - delete value; \ - value = nullptr; -#endif - -#define CVD_TYPEDEF(TYPE, NAME) \ - typedef TYPE *NAME##_CPP; \ - typedef struct NAME { \ - TYPE *ptr; \ - } NAME; \ - typedef NAME *NAME##Ptr; - -CVD_TYPEDEF(cv::Mat, Mat) -CVD_TYPEDEF(cv::_InputOutputArray, InputOutputArray) -CVD_TYPEDEF(cv::RNG, RNG) -CVD_TYPEDEF(std::vector, VecPoint) -CVD_TYPEDEF(std::vector>, VecVecPoint) -CVD_TYPEDEF(std::vector, VecPoint2f) -CVD_TYPEDEF(std::vector>, VecVecPoint2f) -CVD_TYPEDEF(std::vector, VecPoint3f) -CVD_TYPEDEF(std::vector>, VecVecPoint3f) -CVD_TYPEDEF(std::vector, VecUChar) -CVD_TYPEDEF(std::vector, VecChar) -CVD_TYPEDEF(std::vector, VecInt) -CVD_TYPEDEF(std::vector, VecFloat) -CVD_TYPEDEF(std::vector, VecDouble) -CVD_TYPEDEF(std::vector>, VecVecChar) -CVD_TYPEDEF(std::vector, VecMat) -CVD_TYPEDEF(std::vector, VecRect) -CVD_TYPEDEF(std::vector, VecKeyPoint) -CVD_TYPEDEF(std::vector, VecDMatch) -CVD_TYPEDEF(std::vector>, VecVecDMatch) -#else -#define CVD_TYPEDEF(TYPE, NAME) \ - typedef struct NAME { \ - TYPE *ptr; \ - } NAME; \ - typedef NAME *NAME##Ptr; - -typedef unsigned char uchar; -typedef unsigned short ushort; - -CVD_TYPEDEF(void, Mat) -CVD_TYPEDEF(void, InputOutputArray) -CVD_TYPEDEF(void, RNG) -CVD_TYPEDEF(void, VecPoint) -CVD_TYPEDEF(void, VecVecPoint) -CVD_TYPEDEF(void, VecPoint2f) -CVD_TYPEDEF(void, VecVecPoint2f) -CVD_TYPEDEF(void, VecPoint3f) -CVD_TYPEDEF(void, VecVecPoint3f) -CVD_TYPEDEF(void, VecUChar) -CVD_TYPEDEF(void, VecChar) -CVD_TYPEDEF(void, VecInt) -CVD_TYPEDEF(void, VecFloat) -CVD_TYPEDEF(void, VecDouble) -CVD_TYPEDEF(void, VecVecChar) -CVD_TYPEDEF(void, VecMat) -CVD_TYPEDEF(void, VecRect) -CVD_TYPEDEF(void, VecKeyPoint) -CVD_TYPEDEF(void, VecDMatch) -CVD_TYPEDEF(void, VecVecDMatch) -#endif - -// Wrapper for an individual cv::cvPoint -typedef struct Point { - int x; - int y; -} Point; - -// Wrapper for an individual cv::Point2f -typedef struct Point2f { - float x; - float y; -} Point2f; - -typedef struct Point3f { - float x; - float y; - float z; -} Point3f; - -// Wrapper for an individual cv::cvRect -typedef struct Rect { - int x; - int y; - int width; - int height; -} Rect; - -typedef struct Rect2f { - float x; - float y; - float width; - float height; -} Rect2f; - -// Wrapper for an individual cv::cvSize -typedef struct Size { - int width; - int height; -} Size; - -typedef struct Size2f { - float width; - float height; -} Size2f; - -// Wrapper for an individual cv::RotatedRect -typedef struct RotatedRect { - Point2f center; - Size2f size; - double angle; -} RotatedRect; - -// Wrapper for an individual cv::cvScalar -typedef struct Scalar { - double val1; - double val2; - double val3; - double val4; -} Scalar; - -// Wrapper for a individual cv::KeyPoint -typedef struct KeyPoint { - double x; - double y; - double size; - double angle; - double response; - int octave; - int classID; -} KeyPoint; - -// Wrapper for an individual cv::DMatch -typedef struct DMatch { - int queryIdx; - int trainIdx; - int imgIdx; - float distance; -} DMatch; - -// Wrapper for an individual cv::Moment -typedef struct Moment { - double m00; - double m10; - double m01; - double m20; - double m11; - double m02; - double m30; - double m21; - double m12; - double m03; - - double mu20; - double mu11; - double mu02; - double mu30; - double mu21; - double mu12; - double mu03; - - double nu20; - double nu11; - double nu02; - double nu30; - double nu21; - double nu12; - double nu03; -} Moment; - -typedef struct CvStatus { - int code; - char *msg; - char *err; - char *func; - char *file; - int line; -} CvStatus; - -typedef struct Vec2b { - uchar val1; - uchar val2; -} Vec2b; -typedef struct Vec3b { - uchar val1; - uchar val2; - uchar val3; -} Vec3b; -typedef struct Vec4b { - uchar val1; - uchar val2; - uchar val3; - uchar val4; -} Vec4b; -typedef struct Vec2s { - short val1; - short val2; -} Vec2s; -typedef struct Vec3s { - short val1; - short val2; - short val3; -} Vec3s; -typedef struct Vec4s { - short val1; - short val2; - short val3; - short val4; -} Vec4s; -typedef struct Vec2w { - ushort val1; - ushort val2; -} Vec2w; -typedef struct Vec3w { - ushort val1; - ushort val2; - ushort val3; -} Vec3w; -typedef struct Vec4w { - ushort val1; - ushort val2; - ushort val3; - ushort val4; -} Vec4w; -typedef struct Vec2i { - int val1; - int val2; -} Vec2i; -typedef struct Vec3i { - int val1; - int val2; - int val3; -} Vec3i; -typedef struct Vec4i { - int val1; - int val2; - int val3; - int val4; -} Vec4i; -typedef struct Vec6i { - int val1; - int val2; - int val3; - int val4; - int val5; - int val6; -} Vec6i; -typedef struct Vec8i { - int val1; - int val2; - int val3; - int val4; - int val5; - int val6; - int val7; - int val8; -} Vec8i; -typedef struct Vec2f { - float val1; - float val2; -} Vec2f; -typedef struct Vec3f { - float val1; - float val2; - float val3; -} Vec3f; -typedef struct Vec4f { - float val1; - float val2; - float val3; - float val4; -} Vec4f; -typedef struct Vec6f { - float val1; - float val2; - float val3; - float val4; - float val5; - float val6; -} Vec6f; -typedef struct Vec2d { - double val1; - double val2; -} Vec2d; -typedef struct Vec3d { - double val1; - double val2; - double val3; -} Vec3d; -typedef struct Vec4d { - double val1; - double val2; - double val3; - double val4; -} Vec4d; -typedef struct Vec6d { - double val1; - double val2; - double val3; - double val4; - double val5; - double val6; -} Vec6d; - -// Contour is alias for Points -typedef VecPoint Contour; -typedef VecPoint2f Contour2f; -typedef VecPoint3f Contour3f; -typedef VecVecPoint Contours; -typedef VecVecPoint2f Contours2f; -typedef VecVecPoint3f Contours3f; - CvStatus *RotatedRect_Points(RotatedRect rect, VecPoint2f *pts); CvStatus *RotatedRect_BoundingRect(RotatedRect rect, Rect *rval); CvStatus *RotatedRect_BoundingRect2f(RotatedRect rect, Rect2f *rval); @@ -405,12 +23,6 @@ CvStatus *RotatedRect_BoundingRect2f(RotatedRect rect, Rect2f *rval); // internal use // VecPoint2f vecPointToVecPoint2f(VecPoint src); -typedef struct TermCriteria { - int type; - int maxCount; - double epsilon; -} TermCriteria; - void CvStatus_Close(CvStatus *self); /** @@ -433,7 +45,7 @@ CvStatus *Mat_NewWithSizesFromScalar(VecInt sizes, int type, Scalar ar, Mat *rva CvStatus *Mat_NewWithSizesFromBytes(VecInt sizes, int type, VecChar buf, Mat *rval); CvStatus *Mat_NewFromScalar(const Scalar ar, int type, Mat *rval); CvStatus *Mat_NewWithSizeFromScalar(const Scalar ar, int rows, int cols, int type, Mat *rval); -CvStatus *Mat_NewFromBytes(int rows, int cols, int type, void *buf, int step, Mat *rval); +CvStatus *Mat_NewFromBytes(int rows, int cols, int type, void *buf, Mat *rval); CvStatus *Mat_NewFromVecPoint(VecPoint vec, Mat *rval); CvStatus *Mat_NewFromVecPoint2f(VecPoint2f vec, Mat *rval); CvStatus *Mat_NewFromVecPoint3f(VecPoint3f vec, Mat *rval); diff --git a/src/core/core_async.cpp b/src/core/core_async.cpp new file mode 100644 index 00000000..7bf7ac21 --- /dev/null +++ b/src/core/core_async.cpp @@ -0,0 +1,1215 @@ +#include "core_async.h" +#include "core/types.h" +#include "lut.hpp" +#include "opencv2/core.hpp" +#include "opencv2/core/types.hpp" +#pragma region Mat_Constructors +CvStatus *Mat_New_Async(CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat()}); + END_WRAP +} +CvStatus *Mat_NewWithSize_Async(int rows, int cols, int type, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(rows, cols, type)}); + END_WRAP +} +CvStatus *Mat_NewWithSizes_Async(VecInt sizes, int type, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(*sizes.ptr, type)}); + END_WRAP +} +CvStatus *Mat_NewWithSizesScalar_Async(VecInt sizes, int type, Scalar s, CvCallback_1 callback) { + BEGIN_WRAP + cv::Scalar c = cv::Scalar(s.val1, s.val2, s.val3, s.val4); + callback(new Mat{new cv::Mat(*sizes.ptr, type, c)}); + END_WRAP +} +CvStatus * +Mat_NewWithSizesFromBytes_Async(VecInt sizes, int type, VecChar buf, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(*sizes.ptr, type, buf.ptr)}); + END_WRAP +} +CvStatus * +Mat_NewFromScalar_Async(const Scalar s, int rows, int cols, int type, CvCallback_1 callback) { + BEGIN_WRAP + cv::Scalar c = cv::Scalar(s.val1, s.val2, s.val3, s.val4); + callback(new Mat{new cv::Mat(rows, cols, type, c)}); + END_WRAP +} +CvStatus * +Mat_NewFromBytes_Async(int rows, int cols, int type, void *buf, int step, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(rows, cols, type, buf, step)}); + END_WRAP +} +CvStatus *Mat_NewFromVecPoint_Async(VecPoint vec, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(*vec.ptr)}); + END_WRAP +} +CvStatus *Mat_NewFromVecPoint2f_Async(VecPoint2f vec, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(*vec.ptr)}); + END_WRAP +} +CvStatus *Mat_NewFromVecPoint3f_Async(VecPoint3f vec, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(*vec.ptr)}); + END_WRAP +} + +CvStatus *Mat_Eye_Async(int rows, int cols, int type, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(cv::Mat::eye(rows, cols, type))}); + END_WRAP +} +CvStatus *Mat_Zeros_Async(int rows, int cols, int type, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(cv::Mat::zeros(rows, cols, type))}); + END_WRAP +} +CvStatus *Mat_Ones_Async(int rows, int cols, int type, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(cv::Mat::ones(rows, cols, type))}); + END_WRAP +} + +#pragma endregion + +#pragma region Mat_functions +CvStatus *Mat_Release_Async(MatPtr self, CvCallback_0 callback) { + BEGIN_WRAP + self->ptr->release(); + callback(); + END_WRAP +} +// bool *rval +CvStatus *Mat_Empty_Async(Mat self, CvCallback_1 callback) { + BEGIN_WRAP + callback(new bool(self.ptr->empty())); + END_WRAP +} +CvStatus *Mat_IsContinuous_Async(Mat self, CvCallback_1 callback) { + BEGIN_WRAP + callback(new bool(self.ptr->isContinuous())); + END_WRAP +} +CvStatus *Mat_Clone_Async(Mat self, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(self.ptr->clone())}); + END_WRAP +} +CvStatus *Mat_CopyTo_Async(Mat self, Mat dst, CvCallback_0 callback) { + BEGIN_WRAP + self.ptr->copyTo(*dst.ptr); + callback(); + END_WRAP +} +CvStatus *Mat_CopyToWithMask_Async(Mat self, Mat dst, Mat mask, CvCallback_0 callback) { + BEGIN_WRAP + self.ptr->copyTo(*dst.ptr, *mask.ptr); + callback(); + END_WRAP +} +CvStatus *Mat_ConvertTo_Async(Mat self, int type, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + self.ptr->convertTo(dst, type); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} +CvStatus * +Mat_ConvertToWithParams_Async(Mat self, int type, float alpha, float beta, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + self.ptr->convertTo(dst, type, alpha, beta); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} +CvStatus *Mat_ToVecUChar_Async(Mat self, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + self.ptr->convertTo(dst, CV_8UC1); + callback(new VecUChar{new std::vector(dst)}); + END_WRAP +} +CvStatus *Mat_ToVecChar_Async(Mat self, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + self.ptr->convertTo(dst, CV_8SC1); + callback(new VecChar{new std::vector(dst)}); + END_WRAP +} +CvStatus *Mat_Region_Async(Mat self, Rect r, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(*self.ptr, cv::Rect(r.x, r.y, r.width, r.height))}); + END_WRAP +} +CvStatus *Mat_Reshape_Async(Mat self, int cn, int rows, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(self.ptr->reshape(cn, rows))}); + END_WRAP +} + +#pragma endregion + +CvStatus *core_PatchNaNs_Async(Mat self, double val, CvCallback_0 callback) { + BEGIN_WRAP + cv::patchNaNs(*self.ptr, val); + callback(); + END_WRAP +} +// Deprecated: +// Use Mat::convertTo with CV_16F instead. +// CvStatus *Mat_ConvertFp16_Async(Mat self, CvCallback_1 callback); +CvStatus *core_Mean_Async(Mat self, CvCallback_1 callback) { + BEGIN_WRAP + cv::Scalar c = cv::mean(*self.ptr); + callback(new Scalar{c.val[0], c.val[1], c.val[2], c.val[3]}); + END_WRAP +} +CvStatus *core_MeanWithMask_Async(Mat self, Mat mask, CvCallback_1 callback) { + BEGIN_WRAP + cv::Scalar c = cv::mean(*self.ptr, *mask.ptr); + callback(new Scalar{c.val[0], c.val[1], c.val[2], c.val[3]}); + END_WRAP +} +CvStatus *core_Sqrt_Async(Mat self, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::sqrt(*self.ptr, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} +CvStatus *core_AbsDiff_Async(Mat src1, Mat src2, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::absdiff(*src1.ptr, *src2.ptr, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} +CvStatus *core_Add_Async(Mat src1, Mat src2, Mat mask, int dtype, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::add(*src1.ptr, *src2.ptr, dst, *mask.ptr, dtype); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} +CvStatus *core_AddWeighted_Async( + Mat src1, double alpha, Mat src2, double beta, double gamma, int dtype, CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat dst; + cv::addWeighted(*src1.ptr, alpha, *src2.ptr, beta, gamma, dst, dtype); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} +CvStatus *core_BitwiseAnd_Async(Mat src1, Mat src2, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::bitwise_and(*src1.ptr, *src2.ptr, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} +CvStatus *core_BitwiseAndWithMask_Async(Mat src1, Mat src2, Mat mask, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::bitwise_and(*src1.ptr, *src2.ptr, dst, *mask.ptr); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} +CvStatus *core_BitwiseNot_Async(Mat src1, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::bitwise_not(*src1.ptr, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} +CvStatus *core_BitwiseNotWithMask_Async(Mat src1, Mat mask, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::bitwise_not(*src1.ptr, dst, *mask.ptr); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} +CvStatus *core_BitwiseOr_Async(Mat src1, Mat src2, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::bitwise_or(*src1.ptr, *src2.ptr, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} +CvStatus *core_BitwiseOrWithMask_Async(Mat src1, Mat src2, Mat mask, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::bitwise_or(*src1.ptr, *src2.ptr, dst, *mask.ptr); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} +CvStatus *core_BitwiseXor_Async(Mat src1, Mat src2, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::bitwise_xor(*src1.ptr, *src2.ptr, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} +CvStatus *core_BitwiseXorWithMask_Async(Mat src1, Mat src2, Mat mask, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::bitwise_xor(*src1.ptr, *src2.ptr, dst, *mask.ptr); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} +CvStatus *core_Compare_Async(Mat src1, Mat src2, int ct, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::compare(*src1.ptr, *src2.ptr, dst, ct); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_BatchDistance_Async( + Mat src1, + Mat src2, + int dtype, + int normType, + int K, + Mat mask, + int update, + bool crosscheck, + CvCallback_2 callback +) { + BEGIN_WRAP + cv::Mat dist, nidx; + cv::batchDistance( + *src1.ptr, *src2.ptr, dist, dtype, nidx, normType, K, *mask.ptr, update, crosscheck + ); + callback(new Mat{new cv::Mat(dist)}, new Mat{new cv::Mat(nidx)}); + END_WRAP +} + +CvStatus *core_BorderInterpolate_Async(int p, int len, int borderType, CvCallback_1 callback) { + BEGIN_WRAP + callback(new int(cv::borderInterpolate(p, len, borderType))); + END_WRAP +} + +CvStatus * +core_CalcCovarMatrix_Async(Mat samples, Mat mean, int flags, int ctype, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat cov; + cv::calcCovarMatrix(*samples.ptr, cov, *mean.ptr, flags, ctype); + callback(new Mat{new cv::Mat(cov)}); + END_WRAP +} + +CvStatus *core_CartToPolar_Async(Mat x, Mat y, bool angleInDegrees, CvCallback_2 callback) { + BEGIN_WRAP + cv::Mat mag, ang; + cv::cartToPolar(*x.ptr, *y.ptr, mag, ang, angleInDegrees); + callback(new Mat{new cv::Mat(mag)}, new Mat{new cv::Mat(ang)}); + END_WRAP +} + +CvStatus * +core_CheckRange_Async(Mat self, bool quiet, double minVal, double maxVal, CvCallback_2 callback) { + BEGIN_WRAP + cv::Point point; + bool rval = cv::checkRange(*self.ptr, quiet, &point, minVal, maxVal); + callback(new bool(rval), new Point{point.x, point.y}); + END_WRAP +} + +CvStatus *core_CompleteSymm_Async(Mat self, bool lowerToUpper, CvCallback_0 callback) { + BEGIN_WRAP + cv::completeSymm(*self.ptr, lowerToUpper); + callback(); + END_WRAP +} + +CvStatus *core_ConvertScaleAbs_Async(Mat src, double alpha, double beta, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::convertScaleAbs(*src.ptr, dst, alpha, beta); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_CopyMakeBorder_Async( + Mat src, + int top, + int bottom, + int left, + int right, + int borderType, + Scalar value, + CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat dst; + cv::Scalar val = cv::Scalar(value.val1, value.val2, value.val3, value.val4); + cv::copyMakeBorder(*src.ptr, dst, top, bottom, left, right, borderType, val); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_CountNonZero_Async(Mat src, CvCallback_1 callback) { + BEGIN_WRAP + callback(new int(cv::countNonZero(*src.ptr))); + END_WRAP +} + +CvStatus *core_DCT_Async(Mat src, int flags, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::dct(*src.ptr, dst, flags); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_Determinant_Async(Mat self, CvCallback_1 callback) { + BEGIN_WRAP + callback(new double(cv::determinant(*self.ptr))); + END_WRAP +} + +CvStatus *core_DFT_Async(Mat self, int flags, int nonzeroRows, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::dft(*self.ptr, dst, flags, nonzeroRows); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_Divide_Async(Mat src1, Mat src2, double scale, int dtype, CvCallback_1 callback) { + BEGIN_WRAP + cv::divide(*src1.ptr, *src2.ptr, *src1.ptr); + callback(new Mat{new cv::Mat(*src1.ptr)}); + END_WRAP +} + +// Mat eigenvalues, Mat eigenvectors, bool *rval +CvStatus *core_Eigen_Async(Mat src, CvCallback_3 callback) { + BEGIN_WRAP + cv::Mat eigenvalues, eigenvectors; + bool rval = cv::eigen(*src.ptr, eigenvalues, eigenvectors); + callback(new bool(rval), new Mat{new cv::Mat(eigenvalues)}, new Mat{new cv::Mat(eigenvectors)}); + END_WRAP +} + +CvStatus *core_EigenNonSymmetric_Async(Mat src, CvCallback_2 callback) { + BEGIN_WRAP + cv::Mat eigenvalues, eigenvectors; + cv::eigenNonSymmetric(*src.ptr, eigenvalues, eigenvectors); + callback(new Mat{new cv::Mat(eigenvalues)}, new Mat{new cv::Mat(eigenvectors)}); + END_WRAP +} + +CvStatus *core_PCABackProject_Async(Mat src, Mat mean, Mat eigenvectors, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat result; + cv::PCABackProject(*src.ptr, *mean.ptr, *eigenvectors.ptr, result); + callback(new Mat{new cv::Mat(result)}); + END_WRAP +} + +CvStatus * +core_PCACompute_3_Async(Mat src, Mat mean, double retainedVariance, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat eigenvectors; + cv::PCACompute(*src.ptr, *mean.ptr, eigenvectors, retainedVariance); + callback(new Mat{new cv::Mat(eigenvectors)}); + END_WRAP +} + +CvStatus *core_PCACompute_1_Async(Mat src, Mat mean, int maxComponents, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat eigenvectors; + cv::PCACompute(*src.ptr, *mean.ptr, eigenvectors, maxComponents); + callback(new Mat{new cv::Mat(eigenvectors)}); + END_WRAP +} + +CvStatus * +core_PCACompute_2_Async(Mat src, Mat mean, double retainedVariance, CvCallback_2 callback) { + BEGIN_WRAP + cv::Mat eigenvectors, eigenValues; + cv::PCACompute(*src.ptr, *mean.ptr, eigenvectors, eigenValues, retainedVariance); + callback(new Mat{new cv::Mat(eigenvectors)}, new Mat{new cv::Mat(eigenValues)}); + END_WRAP +} + +CvStatus *core_PCACompute_Async(Mat src, Mat mean, int maxComponents, CvCallback_2 callback) { + BEGIN_WRAP + cv::Mat eigenvectors, eigenValues; + cv::PCACompute(*src.ptr, *mean.ptr, eigenvectors, eigenValues, maxComponents); + callback(new Mat{new cv::Mat(eigenvectors)}, new Mat{new cv::Mat(eigenValues)}); + END_WRAP +} + +CvStatus *core_PCAProject_Async(Mat src, Mat mean, Mat eigenvectors, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat result; + cv::PCAProject(*src.ptr, *mean.ptr, *eigenvectors.ptr, result); + callback(new Mat{new cv::Mat(result)}); + END_WRAP +} + +CvStatus *core_Exp_Async(Mat src, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::exp(*src.ptr, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_ExtractChannel_Async(Mat src, int coi, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::extractChannel(*src.ptr, dst, coi); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_FindNonZero_Async(Mat src, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat indices; + cv::findNonZero(*src.ptr, indices); + callback(new Mat{new cv::Mat(indices)}); + END_WRAP +} + +CvStatus *core_Flip_Async(Mat src, int flipCode, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::flip(*src.ptr, dst, flipCode); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_Gemm_Async( + Mat src1, Mat src2, double alpha, Mat src3, double beta, int flags, CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat dst; + cv::gemm(*src1.ptr, *src2.ptr, alpha, *src3.ptr, beta, dst, flags); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_GetOptimalDFTSize_Async(int vecsize, CvCallback_1 callback) { + BEGIN_WRAP + callback(new int(cv::getOptimalDFTSize(vecsize))); + END_WRAP +} + +CvStatus *core_Hconcat_Async(Mat src1, Mat src2, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::hconcat(*src1.ptr, *src2.ptr, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_Vconcat_Async(Mat src1, Mat src2, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::vconcat(*src1.ptr, *src2.ptr, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_Idct_Async(Mat src, int flags, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::idct(*src.ptr, dst, flags); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_Idft_Async(Mat src, int flags, int nonzeroRows, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::idft(*src.ptr, dst, flags, nonzeroRows); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_InRange_Async(Mat src, Mat lowerb, Mat upperb, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::inRange(*src.ptr, *lowerb.ptr, *upperb.ptr, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_InRangeWithScalar_Async( + Mat src, const Scalar lowerb, const Scalar upperb, CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat dst; + cv::Scalar lowb(lowerb.val1, lowerb.val2, lowerb.val3, lowerb.val4); + cv::Scalar upb(upperb.val1, upperb.val2, upperb.val3, upperb.val4); + cv::inRange(*src.ptr, lowb, upb, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_InsertChannel_Async(Mat src, Mat dst, int coi, CvCallback_0 callback) { + BEGIN_WRAP + cv::insertChannel(*src.ptr, *dst.ptr, coi); + callback(); + END_WRAP +} + +CvStatus *core_Invert_Async(Mat src, int flags, CvCallback_2 callback) { + BEGIN_WRAP + cv::Mat dst; + double rval = cv::invert(*src.ptr, dst, flags); + callback(new double(rval), new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_Log_Async(Mat src, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::log(*src.ptr, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_Magnitude_Async(Mat x, Mat y, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::magnitude(*x.ptr, *y.ptr, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_Max_Async(Mat src1, Mat src2, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::max(*src1.ptr, *src2.ptr, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_MeanStdDev_Async(Mat src, CvCallback_2 callback) { + BEGIN_WRAP + cv::Scalar mean, stddev; + cv::meanStdDev(*src.ptr, mean, stddev); + callback( + new Scalar{mean.val[0], mean.val[1], mean.val[2], mean.val[3]}, + new Scalar{stddev.val[0], stddev.val[1], stddev.val[2], stddev.val[3]} + ); + END_WRAP +} + +CvStatus *core_MeanStdDevWithMask_Async(Mat src, Mat mask, CvCallback_2 callback) { + BEGIN_WRAP + cv::Scalar mean, stddev; + cv::meanStdDev(*src.ptr, mean, stddev, *mask.ptr); + callback( + new Scalar{mean.val[0], mean.val[1], mean.val[2], mean.val[3]}, + new Scalar{stddev.val[0], stddev.val[1], stddev.val[2], stddev.val[3]} + ); + END_WRAP +} + +CvStatus *core_Merge_Async(VecMat mats, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::merge(*mats.ptr, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_Min_Async(Mat src1, Mat src2, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::min(*src1.ptr, *src2.ptr, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_MinMaxIdx_Async(Mat self, CvCallback_4 callback) { + BEGIN_WRAP + double minVal, maxVal; + int minLoc, maxLoc; + cv::minMaxIdx(*self.ptr, &minVal, &maxVal, &minLoc, &maxLoc); + callback(new double(minVal), new double(maxVal), new int(minLoc), new int(maxLoc)); + END_WRAP +} + +CvStatus *core_MinMaxIdx_Mask_Async(Mat self, Mat mask, CvCallback_4 callback) { + BEGIN_WRAP + double minVal, maxVal; + int minLoc, maxLoc; + cv::minMaxIdx(*self.ptr, &minVal, &maxVal, &minLoc, &maxLoc, *mask.ptr); + callback(new double(minVal), new double(maxVal), new int(minLoc), new int(maxLoc)); + END_WRAP +} + +CvStatus *core_MinMaxLoc_Async(Mat self, CvCallback_4 callback) { + BEGIN_WRAP + double minVal, maxVal; + cv::Point minLoc, maxLoc; + cv::minMaxLoc(*self.ptr, &minVal, &maxVal, &minLoc, &maxLoc); + callback( + new double(minVal), + new double(maxVal), + new Point{minLoc.x, minLoc.y}, + new Point{maxLoc.x, maxLoc.y} + ); + END_WRAP +} + +CvStatus *core_MinMaxLoc_Mask_Async(Mat self, Mat mask, CvCallback_4 callback) { + BEGIN_WRAP + double minVal, maxVal; + cv::Point minLoc, maxLoc; + cv::minMaxLoc(*self.ptr, &minVal, &maxVal, &minLoc, &maxLoc, *mask.ptr); + callback( + new double(minVal), + new double(maxVal), + new Point{minLoc.x, minLoc.y}, + new Point{maxLoc.x, maxLoc.y} + ); + END_WRAP +} + +CvStatus *core_MixChannels_Async(VecMat src, VecMat dst, VecInt fromTo, CvCallback_0 callback) { + BEGIN_WRAP + cv::mixChannels(*src.ptr, *dst.ptr, *fromTo.ptr); + callback(); + END_WRAP +} + +CvStatus *core_MulSpectrums_Async(Mat a, Mat b, int flags, bool conjB, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::mulSpectrums(*a.ptr, *b.ptr, dst, flags); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_Multiply_Async(Mat src1, Mat src2, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::multiply(*src1.ptr, *src2.ptr, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus * +core_MultiplyWithParams_Async(Mat src1, Mat src2, double scale, int dtype, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::multiply(*src1.ptr, *src2.ptr, dst, scale, dtype); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_Normalize_Async( + Mat src, Mat dst, double alpha, double beta, int typ, int dtype, CvCallback_0 callback +) { + BEGIN_WRAP + cv::normalize(*src.ptr, *dst.ptr, alpha, beta, typ, dtype); + callback(); + END_WRAP +} + +CvStatus *core_Normalize_Mask_Async( + Mat src, Mat dst, double alpha, double beta, int typ, int dtype, Mat mask, CvCallback_0 callback +) { + BEGIN_WRAP + cv::normalize(*src.ptr, *dst.ptr, alpha, beta, typ, dtype, *mask.ptr); + callback(); + END_WRAP +} + +CvStatus *core_PerspectiveTransform_Async(Mat src, Mat tm, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::perspectiveTransform(*src.ptr, dst, *tm.ptr); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_Solve_Async(Mat src1, Mat src2, int flags, CvCallback_2 callback) { + BEGIN_WRAP + cv::Mat dst; + bool rval = cv::solve(*src1.ptr, *src2.ptr, dst, flags); + callback(new bool(rval), new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_SolveCubic_Async(Mat coeffs, CvCallback_2 callback) { + BEGIN_WRAP + cv::Mat dst; + int rval = cv::solveCubic(*coeffs.ptr, dst); + callback(new int(rval), new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_SolvePoly_Async(Mat coeffs, int maxIters, CvCallback_2 callback) { + BEGIN_WRAP + cv::Mat dst; + double rval = cv::solvePoly(*coeffs.ptr, dst, maxIters); + callback(new double(rval), new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_Reduce_Async(Mat src, int dim, int rType, int dType, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::reduce(*src.ptr, dst, dim, rType, dType); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_ReduceArgMax_Async(Mat src, int axis, bool lastIndex, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::reduceArgMax(*src.ptr, dst, axis, lastIndex); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_ReduceArgMin_Async(Mat src, int axis, bool lastIndex, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::reduceArgMin(*src.ptr, dst, axis, lastIndex); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_Repeat_Async(Mat src, int nY, int nX, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::repeat(*src.ptr, nY, nX, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_ScaleAdd_Async(Mat src1, double alpha, Mat src2, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::scaleAdd(*src1.ptr, alpha, *src2.ptr, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_SetIdentity_Async(Mat src, Scalar scalar, CvCallback_0 callback) { + BEGIN_WRAP + cv::setIdentity(*src.ptr, *new cv::Scalar(scalar.val1, scalar.val2, scalar.val3, scalar.val4)); + callback(); + END_WRAP +} + +CvStatus *core_Sort_Async(Mat src, int flags, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::sort(*src.ptr, dst, flags); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_SortIdx_Async(Mat src, int flags, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::sortIdx(*src.ptr, dst, flags); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_Split_Async(Mat src, CvCallback_1 callback) { + BEGIN_WRAP + std::vector dst; + cv::split(*src.ptr, dst); + callback(new VecMat{new std::vector(dst)}); + END_WRAP +} + +CvStatus *core_Subtract_Async(Mat src1, Mat src2, Mat mask, int dtype, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::subtract(*src1.ptr, *src2.ptr, dst, *mask.ptr, dtype); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_T_Async(Mat x, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::transpose(*x.ptr, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_Trace_Async(Mat src, CvCallback_1 callback) { + BEGIN_WRAP + cv::Scalar dst = cv::trace(*src.ptr); + callback(new Scalar{dst.val[0], dst.val[1], dst.val[2], dst.val[3]}); + END_WRAP +} + +CvStatus *core_Transform_Async(Mat src, Mat tm, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::transform(*src.ptr, dst, *tm.ptr); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_Transpose_Async(Mat src, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::transpose(*src.ptr, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus * +core_PolarToCart_Async(Mat magnitude, Mat degree, bool angleInDegrees, CvCallback_2 callback) { + BEGIN_WRAP + cv::Mat x, y; + cv::polarToCart(*magnitude.ptr, *degree.ptr, x, y, angleInDegrees); + callback(new Mat{new cv::Mat(x)}, new Mat{new cv::Mat(y)}); + END_WRAP +} + +CvStatus *core_Pow_Async(Mat src, double power, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::pow(*src.ptr, power, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_Phase_Async(Mat x, Mat y, bool angleInDegrees, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::phase(*x.ptr, *y.ptr, dst, angleInDegrees); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_Sum_Async(Mat src, CvCallback_1 callback) { + BEGIN_WRAP + cv::Scalar dst = cv::sum(*src.ptr); + callback(new Scalar{dst.val[0], dst.val[1], dst.val[2], dst.val[3]}); + END_WRAP +} + +CvStatus *core_rowRange_Async(Mat self, int start, int end, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst = self.ptr->rowRange(start, end); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_colRange_Async(Mat self, int start, int end, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst = self.ptr->colRange(start, end); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_LUT_Async(Mat src, Mat lut, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + auto cn = src.ptr->channels(), depth = src.ptr->depth(); + if (depth == CV_8U || depth == CV_8S) { + cv::LUT(*src.ptr, *lut.ptr, dst); + } else { + int lutcn = lut.ptr->channels(), lut_depth = lut.ptr->depth(); + size_t lut_total = lut.ptr->total(), expect_total = 0; + switch (depth) { + case CV_8U: + case CV_8S: expect_total = 256; break; + case CV_16U: + case CV_16S: expect_total = 65536; break; + // TODO: can't create a mat with 4294967296 rows, maybe use vector instead + // case CV_32S: + // expect_total = 4294967296; + // break; + default: + throw cv::Exception( + cv::Error::StsNotImplemented, + "source Mat Type not supported", + __func__, + __FILE__, + __LINE__ + ); + } + + CV_Assert((lutcn == cn || lutcn == 1) && lut_total == expect_total && lut.ptr->isContinuous()); + dst.create(src.ptr->dims, src.ptr->size, CV_MAKETYPE(lut.ptr->depth(), cn)); + + const cv::Mat *arrays[] = {src.ptr, &dst, 0}; + uchar *ptrs[2] = {}; + cv::NAryMatIterator it(arrays, ptrs); + int len = (int)it.size; + + switch (depth) { + case CV_16U: + switch (lut_depth) { + case CV_8U: + cvd::LUT16u_8u( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr(), len, cn, lutcn + ); + break; + case CV_8S: + cvd::LUT16u_8s( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr(), len, cn, lutcn + ); + break; + case CV_16U: + cvd::LUT16u_16u( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr(), len, cn, lutcn + ); + break; + case CV_16S: + cvd::LUT16u_16s( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr(), len, cn, lutcn + ); + break; + case CV_32S: + cvd::LUT16u_32s( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr(), len, cn, lutcn + ); + break; + case CV_32F: + cvd::LUT16u_32f( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr(), len, cn, lutcn + ); + break; + case CV_64F: + cvd::LUT16u_64f( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr(), len, cn, lutcn + ); + break; + default: + cv::String err = "lut Mat Type not supported for CV_16U"; + throw cv::Exception(cv::Error::StsNotImplemented, err, __func__, __FILE__, __LINE__); + } + break; + case CV_16S: + switch (lut_depth) { + case CV_8U: + cvd::LUT16s_8u( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr(), len, cn, lutcn + ); + break; + case CV_8S: + cvd::LUT16s_8s( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr(), len, cn, lutcn + ); + break; + case CV_16U: + cvd::LUT16s_16u( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr(), len, cn, lutcn + ); + break; + case CV_16S: + cvd::LUT16s_16s( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr(), len, cn, lutcn + ); + break; + case CV_32S: + cvd::LUT16s_32s(src.ptr->ptr(), lut.ptr->ptr(), dst.ptr(), len, cn, lutcn); + break; + case CV_32F: + cvd::LUT16s_32f( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr(), len, cn, lutcn + ); + break; + case CV_64F: + cvd::LUT16s_64f( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr(), len, cn, lutcn + ); + break; + default: + cv::String err = "lut Mat Type not supported for CV_16S"; + throw cv::Exception(cv::Error::StsNotImplemented, err, __func__, __FILE__, __LINE__); + } + break; + case CV_32S: + switch (lut_depth) { + case CV_32S: + cvd::LUT32s_32s(src.ptr->ptr(), lut.ptr->ptr(), dst.ptr(), len, cn, lutcn); + break; + case CV_32F: + cvd::LUT32s_32f( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr(), len, cn, lutcn + ); + break; + case CV_64F: + cvd::LUT32s_64f( + src.ptr->ptr(), lut.ptr->ptr(), dst.ptr(), len, cn, lutcn + ); + break; + default: + cv::String err = "lut Mat Type not supported for CV_32S"; + throw cv::Exception(cv::Error::StsNotImplemented, err, __func__, __FILE__, __LINE__); + } + break; + default: + cv::String err = "src Mat Type not supported"; + throw cv::Exception(cv::Error::StsNotImplemented, err, __func__, __FILE__, __LINE__); + } + } + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_KMeans_Async( + Mat data, + int k, + Mat bestLabels, + TermCriteria criteria, + int attempts, + int flags, + CvCallback_2 callback +) { + BEGIN_WRAP + cv::TermCriteria tc = cv::TermCriteria(criteria.type, criteria.maxCount, criteria.epsilon); + cv::Mat centers; + double rval = cv::kmeans(*data.ptr, k, *bestLabels.ptr, tc, attempts, flags, centers); + callback(new double(rval), new Mat{new cv::Mat(centers)}); + END_WRAP +} + +CvStatus *core_KMeans_Points_Async( + VecPoint2f pts, + int k, + Mat bestLabels, + TermCriteria criteria, + int attempts, + int flags, + CvCallback_2 callback +) { + BEGIN_WRAP + cv::TermCriteria tc = cv::TermCriteria(criteria.type, criteria.maxCount, criteria.epsilon); + cv::Mat centers; + double rval = cv::kmeans(*pts.ptr, k, *bestLabels.ptr, tc, attempts, flags, centers); + callback(new double(rval), new Mat{new cv::Mat(centers)}); + END_WRAP +} + +CvStatus *core_Rotate_Async(Mat src, int rotateCode, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::rotate(*src.ptr, dst, rotateCode); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *core_Norm_Async(Mat src1, int normType, CvCallback_1 callback) { + BEGIN_WRAP + double rval = cv::norm(*src1.ptr, normType); + callback(new double(rval)); + END_WRAP +} + +CvStatus *core_Norm_Mask_Async(Mat src1, int normType, Mat mask, CvCallback_1 callback) { + BEGIN_WRAP + double rval = cv::norm(*src1.ptr, normType, *mask.ptr); + callback(new double(rval)); + END_WRAP +} + +CvStatus *core_NormWithMats_Async(Mat src1, Mat src2, int normType, CvCallback_1 callback) { + BEGIN_WRAP + double rval = cv::norm(*src1.ptr, *src2.ptr, normType); + callback(new double(rval)); + END_WRAP +} + +#pragma region RNG + +CvStatus *Rng_New_Async(CvCallback_1 callback) { + BEGIN_WRAP + callback(new RNG{new cv::RNG()}); + END_WRAP +} + +CvStatus *Rng_NewWithState_Async(uint64_t state, CvCallback_1 callback) { + BEGIN_WRAP + callback(new RNG{new cv::RNG(state)}); + END_WRAP +} + +CvStatus *RNG_Fill_Async( + RNG rng, Mat mat, int distType, double a, double b, bool saturateRange, CvCallback_0 callback +) { + BEGIN_WRAP + rng.ptr->fill(*mat.ptr, distType, a, b, saturateRange); + callback(); + END_WRAP +} + +CvStatus *RNG_Gaussian_Async(RNG rng, double sigma, CvCallback_1 callback) { + BEGIN_WRAP + double rval = rng.ptr->gaussian(sigma); + callback(new double(rval)); + END_WRAP +} + +CvStatus *RNG_Uniform_Async(RNG rng, int a, int b, CvCallback_1 callback) { + BEGIN_WRAP + int rval = rng.ptr->uniform(a, b); + callback(new int(rval)); + END_WRAP +} + +CvStatus *RNG_UniformDouble_Async(RNG rng, double a, double b, CvCallback_1 callback) { + BEGIN_WRAP + double rval = rng.ptr->uniform(a, b); + callback(new double(rval)); + END_WRAP +} + +CvStatus *RNG_Next_Async(RNG rng, CvCallback_1 callback) { + BEGIN_WRAP + uint32_t rval = rng.ptr->next(); + callback(new uint32_t(rval)); + END_WRAP +} + +CvStatus *RandN_Async(Mat mat, Scalar mean, Scalar stddev, CvCallback_0 callback) { + BEGIN_WRAP + cv::Scalar mean_ = cv::Scalar(mean.val1, mean.val2, mean.val3, mean.val4); + cv::Scalar stddev_ = cv::Scalar(stddev.val1, stddev.val2, stddev.val3, stddev.val4); + cv::randn(*mat.ptr, mean_, stddev_); + callback(); + END_WRAP +} + +CvStatus *RandShuffle_Async(Mat mat, CvCallback_0 callback) { + BEGIN_WRAP + cv::randShuffle(*mat.ptr); + callback(); + END_WRAP +} + +CvStatus *RandShuffleWithParams_Async(Mat mat, double iterFactor, RNG rng, CvCallback_0 callback) { + BEGIN_WRAP + cv::randShuffle(*mat.ptr, iterFactor, rng.ptr); + callback(); + END_WRAP +} + +CvStatus *RandU_Async(Mat mat, Scalar low, Scalar high, CvCallback_0 callback) { + BEGIN_WRAP + cv::Scalar low_ = cv::Scalar(low.val1, low.val2, low.val3, low.val4); + cv::Scalar high_ = cv::Scalar(high.val1, high.val2, high.val3, high.val4); + cv::randu(*mat.ptr, low_, high_); + callback(); + END_WRAP +} + +#pragma endregion diff --git a/src/core/core_async.h b/src/core/core_async.h new file mode 100644 index 00000000..4eeb2ec0 --- /dev/null +++ b/src/core/core_async.h @@ -0,0 +1,393 @@ +/* + Created by Rainyl. + Licensed: Apache 2.0 license. Copyright (c) 2024 Rainyl. +*/ + +#ifndef CVD_ASYNC_CORE_H +#define CVD_ASYNC_CORE_H + +#include "core/types.h" +#ifdef __cplusplus +extern "C" { +#endif + +#pragma region Mat_Constructors +CvStatus *Mat_New_Async(CvCallback_1 callback); +CvStatus *Mat_NewWithSize_Async(int rows, int cols, int type, CvCallback_1 callback); +CvStatus *Mat_NewWithSizes_Async(VecInt sizes, int type, CvCallback_1 callback); +CvStatus *Mat_NewWithSizesScalar_Async(VecInt sizes, int type, Scalar s, CvCallback_1 callback); +CvStatus * +Mat_NewWithSizesFromBytes_Async(VecInt sizes, int type, VecChar buf, CvCallback_1 callback); +CvStatus * +Mat_NewFromScalar_Async(const Scalar s, int rows, int cols, int type, CvCallback_1 callback); +CvStatus * +Mat_NewFromBytes_Async(int rows, int cols, int type, void *buf, int step, CvCallback_1 callback); +CvStatus *Mat_NewFromVecPoint_Async(VecPoint vec, CvCallback_1 callback); +CvStatus *Mat_NewFromVecPoint2f_Async(VecPoint2f vec, CvCallback_1 callback); +CvStatus *Mat_NewFromVecPoint3f_Async(VecPoint3f vec, CvCallback_1 callback); + +CvStatus *Mat_Eye_Async(int rows, int cols, int type, CvCallback_1 callback); +CvStatus *Mat_Zeros_Async(int rows, int cols, int type, CvCallback_1 callback); +CvStatus *Mat_Ones_Async(int rows, int cols, int type, CvCallback_1 callback); + +#pragma endregion + +#pragma region Mat_functions +// CvStatus *Mat_Release_Async(MatPtr self, CvCallback_0 callback); +// CvStatus *Mat_Empty_Async(Mat self, CvCallback_1 callback); // bool *rval +// CvStatus *Mat_IsContinuous_Async(Mat self, CvCallback_1 callback); // bool *rval +CvStatus *Mat_Clone_Async(Mat self, CvCallback_1 callback); // Mat *dst +CvStatus *Mat_CopyTo_Async(Mat self, Mat dst, CvCallback_0 callback); +CvStatus *Mat_CopyToWithMask_Async(Mat self, Mat dst, Mat mask, CvCallback_0 callback); +CvStatus *Mat_ConvertTo_Async(Mat self, int type, CvCallback_1 callback); // Mat dst +CvStatus *Mat_ConvertToWithParams_Async( + Mat self, int type, float alpha, float beta, CvCallback_1 callback +); // Mat dst +CvStatus *Mat_ToVecUChar_Async(Mat self, CvCallback_1 callback); // VecUChar *rval +CvStatus *Mat_ToVecChar_Async(Mat self, CvCallback_1 callback); // VecChar *rval +CvStatus *Mat_Region_Async(Mat self, Rect r, CvCallback_1 callback); +CvStatus *Mat_Reshape_Async(Mat self, int cn, int rows, CvCallback_1 callback); +#pragma endregion + +// properties, use sync +// CvStatus *Mat_Rows_Async(Mat self, CvCallback_1 callback); // int *rval +// CvStatus *Mat_Cols_Async(Mat self, CvCallback_1 callback); +// CvStatus *Mat_Channels_Async(Mat self, CvCallback_1 callback); +// CvStatus *Mat_Type_Async(Mat self, CvCallback_1 callback); +// CvStatus *Mat_Step_Async(Mat self, int *rval); +// CvStatus *Mat_Total_Async(Mat self, int *rval); +// CvStatus *Mat_Size_Async(Mat self, VecInt *rval); +// CvStatus *Mat_ElemSize_Async(Mat self, int *rval); +// CvStatus *Mat_Data_Async(Mat self, VecUChar *rval); +// CvStatus *Mat_DataPtr_Async(Mat self, uchar **data, int *length); + +// CvStatus *Mat_Ptr_u8_1_Async(Mat self, int i, uchar **rval); +// CvStatus *Mat_Ptr_u8_2_Async(Mat self, int i, int j, uchar **rval); +// CvStatus *Mat_Ptr_u8_3_Async(Mat self, int i, int j, int k, uchar **rval); +// CvStatus *Mat_Ptr_i8_1_Async(Mat self, int i, char **rval); +// CvStatus *Mat_Ptr_i8_2_Async(Mat self, int i, int j, char **rval); +// CvStatus *Mat_Ptr_i8_3_Async(Mat self, int i, int j, int k, char **rval); +// CvStatus *Mat_Ptr_u16_1_Async(Mat self, int i, ushort **rval); +// CvStatus *Mat_Ptr_u16_2_Async(Mat self, int i, int j, ushort **rval); +// CvStatus *Mat_Ptr_u16_3_Async(Mat self, int i, int j, int k, ushort **rval); +// CvStatus *Mat_Ptr_i16_1_Async(Mat self, int i, short **rval); +// CvStatus *Mat_Ptr_i16_2_Async(Mat self, int i, int j, short **rval); +// CvStatus *Mat_Ptr_i16_3_Async(Mat self, int i, int j, int k, short **rval); +// CvStatus *Mat_Ptr_i32_1_Async(Mat self, int i, int **rval); +// CvStatus *Mat_Ptr_i32_2_Async(Mat self, int i, int j, int **rval); +// CvStatus *Mat_Ptr_i32_3_Async(Mat self, int i, int j, int k, int **rval); +// CvStatus *Mat_Ptr_f32_1_Async(Mat self, int i, float **rval); +// CvStatus *Mat_Ptr_f32_2_Async(Mat self, int i, int j, float **rval); +// CvStatus *Mat_Ptr_f32_3_Async(Mat self, int i, int j, int k, float **rval); +// CvStatus *Mat_Ptr_f64_1_Async(Mat self, int i, double **rval); +// CvStatus *Mat_Ptr_f64_2_Async(Mat self, int i, int j, double **rval); +// CvStatus *Mat_Ptr_f64_3_Async(Mat self, int i, int j, int k, double **rval); + +// #pragma region Mat_getter + +// CvStatus *Mat_GetUChar_Async(Mat self, int row, int col, uint8_t *rval); +// CvStatus *Mat_GetUChar3_Async(Mat self, int x, int y, int z, uint8_t *rval); +// CvStatus *Mat_GetSChar_Async(Mat self, int row, int col, int8_t *rval); +// CvStatus *Mat_GetSChar3_Async(Mat self, int x, int y, int z, int8_t *rval); +// CvStatus *Mat_GetUShort_Async(Mat self, int row, int col, uint16_t *rval); +// CvStatus *Mat_GetUShort3_Async(Mat self, int x, int y, int z, uint16_t *rval); +// CvStatus *Mat_GetShort_Async(Mat self, int row, int col, int16_t *rval); +// CvStatus *Mat_GetShort3_Async(Mat self, int x, int y, int z, int16_t *rval); +// CvStatus *Mat_GetInt_Async(Mat self, int row, int col, int32_t *rval); +// CvStatus *Mat_GetInt3_Async(Mat self, int x, int y, int z, int32_t *rval); +// CvStatus *Mat_GetFloat_Async(Mat self, int row, int col, float *rval); +// CvStatus *Mat_GetFloat3_Async(Mat self, int x, int y, int z, float *rval); +// CvStatus *Mat_GetDouble_Async(Mat self, int row, int col, double *rval); +// CvStatus *Mat_GetDouble3_Async(Mat self, int x, int y, int z, double *rval); + +// CvStatus *Mat_GetVec2b_Async(Mat self, int row, int col, Vec2b *rval); +// CvStatus *Mat_GetVec3b_Async(Mat self, int row, int col, Vec3b *rval); +// CvStatus *Mat_GetVec4b_Async(Mat self, int row, int col, Vec4b *rval); +// CvStatus *Mat_GetVec2s_Async(Mat self, int row, int col, Vec2s *rval); +// CvStatus *Mat_GetVec3s_Async(Mat self, int row, int col, Vec3s *rval); +// CvStatus *Mat_GetVec4s_Async(Mat self, int row, int col, Vec4s *rval); +// CvStatus *Mat_GetVec2w_Async(Mat self, int row, int col, Vec2w *rval); +// CvStatus *Mat_GetVec3w_Async(Mat self, int row, int col, Vec3w *rval); +// CvStatus *Mat_GetVec4w_Async(Mat self, int row, int col, Vec4w *rval); +// CvStatus *Mat_GetVec2i_Async(Mat self, int row, int col, Vec2i *rval); +// CvStatus *Mat_GetVec3i_Async(Mat self, int row, int col, Vec3i *rval); +// CvStatus *Mat_GetVec4i_Async(Mat self, int row, int col, Vec4i *rval); +// CvStatus *Mat_GetVec6i_Async(Mat self, int row, int col, Vec6i *rval); +// CvStatus *Mat_GetVec8i_Async(Mat self, int row, int col, Vec8i *rval); +// CvStatus *Mat_GetVec2f_Async(Mat self, int row, int col, Vec2f *rval); +// CvStatus *Mat_GetVec3f_Async(Mat self, int row, int col, Vec3f *rval); +// CvStatus *Mat_GetVec4f_Async(Mat self, int row, int col, Vec4f *rval); +// CvStatus *Mat_GetVec6f_Async(Mat self, int row, int col, Vec6f *rval); +// CvStatus *Mat_GetVec2d_Async(Mat self, int row, int col, Vec2d *rval); +// CvStatus *Mat_GetVec3d_Async(Mat self, int row, int col, Vec3d *rval); +// CvStatus *Mat_GetVec4d_Async(Mat self, int row, int col, Vec4d *rval); +// CvStatus *Mat_GetVec6d_Async(Mat self, int row, int col, Vec6d *rval); + +// #pragma endregion + +// #pragma region Mat_setter + +// CvStatus *Mat_SetTo_Async(Mat self, Scalar value); +// CvStatus *Mat_SetUChar_Async(Mat self, int row, int col, uint8_t val); +// CvStatus *Mat_SetUChar3_Async(Mat self, int x, int y, int z, uint8_t val); +// CvStatus *Mat_SetSChar_Async(Mat self, int row, int col, int8_t val); +// CvStatus *Mat_SetSChar3_Async(Mat self, int x, int y, int z, int8_t val); +// CvStatus *Mat_SetShort_Async(Mat self, int row, int col, int16_t val); +// CvStatus *Mat_SetShort3_Async(Mat self, int x, int y, int z, int16_t val); +// CvStatus *Mat_SetUShort_Async(Mat self, int row, int col, uint16_t val); +// CvStatus *Mat_SetUShort3_Async(Mat self, int x, int y, int z, uint16_t val); +// CvStatus *Mat_SetInt_Async(Mat self, int row, int col, int32_t val); +// CvStatus *Mat_SetInt3_Async(Mat self, int x, int y, int z, int32_t val); +// CvStatus *Mat_SetFloat_Async(Mat self, int row, int col, float val); +// CvStatus *Mat_SetFloat3_Async(Mat self, int x, int y, int z, float val); +// CvStatus *Mat_SetDouble_Async(Mat self, int row, int col, double val); +// CvStatus *Mat_SetDouble3_Async(Mat self, int x, int y, int z, double val); + +// CvStatus *Mat_SetVec2b_Async(Mat self, int row, int col, Vec2b val); +// CvStatus *Mat_SetVec3b_Async(Mat self, int row, int col, Vec3b val); +// CvStatus *Mat_SetVec4b_Async(Mat self, int row, int col, Vec4b val); +// CvStatus *Mat_SetVec2s_Async(Mat self, int row, int col, Vec2s val); +// CvStatus *Mat_SetVec3s_Async(Mat self, int row, int col, Vec3s val); +// CvStatus *Mat_SetVec4s_Async(Mat self, int row, int col, Vec4s val); +// CvStatus *Mat_SetVec2w_Async(Mat self, int row, int col, Vec2w val); +// CvStatus *Mat_SetVec3w_Async(Mat self, int row, int col, Vec3w val); +// CvStatus *Mat_SetVec4w_Async(Mat self, int row, int col, Vec4w val); +// CvStatus *Mat_SetVec2i_Async(Mat self, int row, int col, Vec2i val); +// CvStatus *Mat_SetVec3i_Async(Mat self, int row, int col, Vec3i val); +// CvStatus *Mat_SetVec4i_Async(Mat self, int row, int col, Vec4i val); +// CvStatus *Mat_SetVec6i_Async(Mat self, int row, int col, Vec6i val); +// CvStatus *Mat_SetVec8i_Async(Mat self, int row, int col, Vec8i val); +// CvStatus *Mat_SetVec2f_Async(Mat self, int row, int col, Vec2f val); +// CvStatus *Mat_SetVec3f_Async(Mat self, int row, int col, Vec3f val); +// CvStatus *Mat_SetVec4f_Async(Mat self, int row, int col, Vec4f val); +// CvStatus *Mat_SetVec6f_Async(Mat self, int row, int col, Vec6f val); +// CvStatus *Mat_SetVec2d_Async(Mat self, int row, int col, Vec2d val); +// CvStatus *Mat_SetVec3d_Async(Mat self, int row, int col, Vec3d val); +// CvStatus *Mat_SetVec4d_Async(Mat self, int row, int col, Vec4d val); +// CvStatus *Mat_SetVec6d_Async(Mat self, int row, int col, Vec6d val); + +// #pragma endregion Mat_setter + +#pragma region Mat_operation + +// CvStatus *Mat_AddUChar_Async(Mat self, uint8_t val); +// CvStatus *Mat_SubtractUChar_Async(Mat self, uint8_t val); +// CvStatus *Mat_MultiplyUChar_Async(Mat self, uint8_t val); +// CvStatus *Mat_DivideUChar_Async(Mat self, uint8_t val); + +// CvStatus *Mat_AddSChar_Async(Mat self, int8_t val); +// CvStatus *Mat_SubtractSChar_Async(Mat self, int8_t val); +// CvStatus *Mat_MultiplySChar_Async(Mat self, int8_t val); +// CvStatus *Mat_DivideSChar_Async(Mat self, int8_t val); + +// CvStatus *Mat_AddI32_Async(Mat self, int32_t val); +// CvStatus *Mat_SubtractI32_Async(Mat self, int32_t val); +// CvStatus *Mat_MultiplyI32_Async(Mat self, int32_t val); +// CvStatus *Mat_DivideI32_Async(Mat self, int32_t val); + +// CvStatus *Mat_AddFloat_Async(Mat self, float_t val); +// CvStatus *Mat_SubtractFloat_Async(Mat self, float_t val); +// CvStatus *Mat_MultiplyFloat_Async(Mat self, float_t val); +// CvStatus *Mat_DivideFloat_Async(Mat self, float_t val); + +// CvStatus *Mat_AddF64_Async(Mat self, double_t val); +// CvStatus *Mat_SubtractF64_Async(Mat self, double_t val); +// CvStatus *Mat_MultiplyF64_Async(Mat self, double_t val); +// CvStatus *Mat_DivideF64_Async(Mat self, double_t val); +// CvStatus *Mat_MultiplyMatrix_Async(Mat x, Mat y, CvCallback_1 callback); + +CvStatus *core_PatchNaNs_Async(Mat self, double val, CvCallback_0 callback); +// Deprecated: +// Use Mat::convertTo with CV_16F instead. +// CvStatus *Mat_ConvertFp16_Async(Mat self, CvCallback_1 callback); +CvStatus *core_Mean_Async(Mat self, CvCallback_1 callback); // Scalar *rval +CvStatus *core_MeanWithMask_Async(Mat self, Mat mask, CvCallback_1 callback); // Scalar *rval +CvStatus *core_Sqrt_Async(Mat self, CvCallback_1 callback); +CvStatus *core_AbsDiff_Async(Mat src1, Mat src2, CvCallback_1 callback); +CvStatus *core_Add_Async(Mat src1, Mat src2, Mat mask, int dtype, CvCallback_1 callback); +CvStatus *core_AddWeighted_Async( + Mat src1, double alpha, Mat src2, double beta, double gamma, int dtype, CvCallback_1 callback +); +CvStatus *core_BitwiseAnd_Async(Mat src1, Mat src2, CvCallback_1 callback); +CvStatus *core_BitwiseAndWithMask_Async(Mat src1, Mat src2, Mat mask, CvCallback_1 callback); +CvStatus *core_BitwiseNot_Async(Mat src1, CvCallback_1 callback); +CvStatus *core_BitwiseNotWithMask_Async(Mat src1, Mat mask, CvCallback_1 callback); +CvStatus *core_BitwiseOr_Async(Mat src1, Mat src2, CvCallback_1 callback); +CvStatus *core_BitwiseOrWithMask_Async(Mat src1, Mat src2, Mat mask, CvCallback_1 callback); +CvStatus *core_BitwiseXor_Async(Mat src1, Mat src2, CvCallback_1 callback); +CvStatus *core_BitwiseXorWithMask_Async(Mat src1, Mat src2, Mat mask, CvCallback_1 callback); +CvStatus *core_Compare_Async(Mat src1, Mat src2, int ct, CvCallback_1 callback); +CvStatus *core_BatchDistance_Async( + Mat src1, + Mat src2, + int dtype, + int normType, + int K, + Mat mask, + int update, + bool crosscheck, + CvCallback_2 callback +); // Mat dist,Mat nidx, +CvStatus * +core_BorderInterpolate_Async(int p, int len, int borderType, CvCallback_1 callback); // int *rval +CvStatus *core_CalcCovarMatrix_Async( + Mat samples, Mat mean, int flags, int ctype, CvCallback_1 callback +); // Mat covar +CvStatus *core_CartToPolar_Async( + Mat x, Mat y, bool angleInDegrees, CvCallback_2 callback +); // Mat magnitude, Mat angle +CvStatus *core_CheckRange_Async( + Mat self, bool quiet, double minVal, double maxVal, CvCallback_2 callback +); // bool *rval, Point *pos +CvStatus *core_CompleteSymm_Async(Mat self, bool lowerToUpper, CvCallback_0 callback); +CvStatus *core_ConvertScaleAbs_Async(Mat src, double alpha, double beta, CvCallback_1 callback); +CvStatus *core_CopyMakeBorder_Async( + Mat src, + int top, + int bottom, + int left, + int right, + int borderType, + Scalar value, + CvCallback_1 callback +); +CvStatus *core_CountNonZero_Async(Mat src, CvCallback_1 callback); // int *rval +CvStatus *core_DCT_Async(Mat src, int flags, CvCallback_1 callback); +CvStatus *core_Determinant_Async(Mat self, CvCallback_1 callback); +CvStatus *core_DFT_Async(Mat self, int flags, int nonzeroRows, CvCallback_1 callback); +CvStatus *core_Divide_Async(Mat src1, Mat src2, double scale, int dtype, CvCallback_1 callback); +CvStatus * +core_Eigen_Async(Mat src, CvCallback_3 callback); // Mat eigenvalues, Mat eigenvectors, bool *rval +CvStatus * +core_EigenNonSymmetric_Async(Mat src, CvCallback_2 callback); // Mat eigenvalues, Mat eigenvectors + +CvStatus *core_PCABackProject_Async(Mat src, Mat mean, Mat eigenvectors, CvCallback_1 callback); +CvStatus * +core_PCACompute_3_Async(Mat src, Mat mean, double retainedVariance, CvCallback_1 callback); +CvStatus *core_PCACompute_1_Async(Mat src, Mat mean, int maxComponents, CvCallback_1 callback); +CvStatus * +core_PCACompute_2_Async(Mat src, Mat mean, double retainedVariance, CvCallback_2 callback); +CvStatus *core_PCACompute_Async(Mat src, Mat mean, int maxComponents, CvCallback_2 callback); +CvStatus *core_PCAProject_Async(Mat src, Mat mean, Mat eigenvectors, CvCallback_1 callback); + +CvStatus *core_Exp_Async(Mat src, CvCallback_1 callback); +CvStatus *core_ExtractChannel_Async(Mat src, int coi, CvCallback_1 callback); +CvStatus *core_FindNonZero_Async(Mat src, CvCallback_1 callback); +CvStatus *core_Flip_Async(Mat src, int flipCode, CvCallback_1 callback); +CvStatus *core_Gemm_Async( + Mat src1, Mat src2, double alpha, Mat src3, double beta, int flags, CvCallback_1 callback +); +CvStatus *core_GetOptimalDFTSize_Async(int vecsize, CvCallback_1 callback); +CvStatus *core_Hconcat_Async(Mat src1, Mat src2, CvCallback_1 callback); +CvStatus *core_Vconcat_Async(Mat src1, Mat src2, CvCallback_1 callback); +CvStatus *core_Idct_Async(Mat src, int flags, CvCallback_1 callback); +CvStatus *core_Idft_Async(Mat src, int flags, int nonzeroRows, CvCallback_1 callback); +CvStatus *core_InRange_Async(Mat src, Mat lowerb, Mat upperb, CvCallback_1 callback); +CvStatus *core_InRangeWithScalar_Async( + Mat src, const Scalar lowerb, const Scalar upperb, CvCallback_1 callback +); +CvStatus *core_InsertChannel_Async(Mat src, Mat dst, int coi, CvCallback_0 callback); +CvStatus *core_Invert_Async(Mat src, int flags, CvCallback_2 callback); +CvStatus *core_Log_Async(Mat src, CvCallback_1 callback); +CvStatus *core_Magnitude_Async(Mat x, Mat y, CvCallback_1 callback); +CvStatus *core_Max_Async(Mat src1, Mat src2, CvCallback_1 callback); +CvStatus *core_MeanStdDev_Async(Mat src, CvCallback_2 callback); // Scalar *dstMean, Scalar + // *dstStdDev +CvStatus *core_MeanStdDevWithMask_Async( + Mat src, Mat mask, CvCallback_2 callback +); // Scalar *dstMean, Scalar *dstStdDev +CvStatus *core_Merge_Async(VecMat mats, CvCallback_1 callback); +CvStatus *core_Min_Async(Mat src1, Mat src2, CvCallback_1 callback); +CvStatus *core_MinMaxIdx_Async( + Mat self, CvCallback_4 callback +); // double *minVal, double *maxVal, int *minIdx, int *maxIdx +CvStatus *core_MinMaxIdx_Mask_Async(Mat self, Mat mask, CvCallback_4 callback); +CvStatus *core_MinMaxLoc_Async( + Mat self, CvCallback_4 callback +); // double *minVal, double *maxVal, Point *minLoc, Point *maxLoc +CvStatus *core_MinMaxLoc_Mask_Async(Mat self, Mat mask, CvCallback_4 callback); +CvStatus *core_MixChannels_Async(VecMat src, VecMat dst, VecInt fromTo, CvCallback_0 callback); +CvStatus *core_MulSpectrums_Async(Mat a, Mat b, int flags, bool conjB, CvCallback_1 callback); +CvStatus *core_Multiply_Async(Mat src1, Mat src2, CvCallback_1 callback); +CvStatus * +core_MultiplyWithParams_Async(Mat src1, Mat src2, double scale, int dtype, CvCallback_1 callback); +CvStatus * +core_Normalize_Async(Mat src, Mat dst, double alpha, double beta, int typ, int dtype, CvCallback_0 callback); +CvStatus *core_Normalize_Mask_Async( + Mat src, Mat dst, double alpha, double beta, int typ, int dtype, Mat mask, CvCallback_0 callback +); +CvStatus *core_PerspectiveTransform_Async(Mat src, Mat tm, CvCallback_1 callback); +CvStatus * +core_Solve_Async(Mat src1, Mat src2, int flags, CvCallback_2 callback); // bool *rval, Mat dst +CvStatus *core_SolveCubic_Async(Mat coeffs, CvCallback_2 callback); // int *rval, Mat roots +CvStatus * +core_SolvePoly_Async(Mat coeffs, int maxIters, CvCallback_2 callback); // double *rval, Mat roots +CvStatus *core_Reduce_Async(Mat src, int dim, int rType, int dType, CvCallback_1 callback); +CvStatus *core_ReduceArgMax_Async(Mat src, int axis, bool lastIndex, CvCallback_1 callback); +CvStatus *core_ReduceArgMin_Async(Mat src, int axis, bool lastIndex, CvCallback_1 callback); +CvStatus *core_Repeat_Async(Mat src, int nY, int nX, CvCallback_1 callback); +CvStatus *core_ScaleAdd_Async(Mat src1, double alpha, Mat src2, CvCallback_1 callback); +CvStatus *core_SetIdentity_Async(Mat src, Scalar scalar, CvCallback_0 callback); +CvStatus *core_Sort_Async(Mat src, int flags, CvCallback_1 callback); +CvStatus *core_SortIdx_Async(Mat src, int flags, CvCallback_1 callback); +CvStatus *core_Split_Async(Mat src, CvCallback_1 callback); // VecMat *rval +CvStatus *core_Subtract_Async(Mat src1, Mat src2, Mat mask, int dtype, CvCallback_1 callback); +CvStatus *core_T_Async(Mat x, CvCallback_1 callback); +CvStatus *core_Trace_Async(Mat src, CvCallback_1 callback); +CvStatus *core_Transform_Async(Mat src, Mat tm, CvCallback_1 callback); +CvStatus *core_Transpose_Async(Mat src, CvCallback_1 callback); +CvStatus *core_PolarToCart_Async( + Mat magnitude, Mat degree, bool angleInDegrees, CvCallback_2 callback +); // Mat x, Mat y +CvStatus *core_Pow_Async(Mat src, double power, CvCallback_1 callback); +CvStatus *core_Phase_Async(Mat x, Mat y, bool angleInDegrees, CvCallback_1 callback); // Mat angle +CvStatus *core_Sum_Async(Mat src, CvCallback_1 callback); +CvStatus *core_rowRange_Async(Mat self, int start, int end, CvCallback_1 callback); +CvStatus *core_colRange_Async(Mat self, int start, int end, CvCallback_1 callback); + +CvStatus *core_LUT_Async(Mat src, Mat lut, CvCallback_1 callback); +CvStatus *core_KMeans_Async( + Mat data, + int k, + Mat bestLabels, + TermCriteria criteria, + int attempts, + int flags, + CvCallback_2 callback +); // double *rval, Mat centers +CvStatus *core_KMeans_Points_Async( + VecPoint2f pts, + int k, + Mat bestLabels, + TermCriteria criteria, + int attempts, + int flags, + CvCallback_2 callback +); // double *rval, Mat centers +CvStatus *core_Rotate_Async(Mat src, int rotateCode, CvCallback_1 callback); +CvStatus *core_Norm_Async(Mat src1, int normType, CvCallback_1 callback); +CvStatus *core_Norm_Mask_Async(Mat src1, int normType, Mat mask, CvCallback_1 callback); +CvStatus *core_NormWithMats_Async(Mat src1, Mat src2, int normType, CvCallback_1 callback); +#pragma endregion + +#pragma region RNG + +CvStatus *Rng_New_Async(CvCallback_1 callback); +CvStatus *Rng_NewWithState_Async(uint64_t state, CvCallback_1 callback); +CvStatus *RNG_Fill_Async(RNG rng, Mat mat, int distType, double a, double b, bool saturateRange, CvCallback_0 callback); +CvStatus *RNG_Gaussian_Async(RNG rng, double sigma, CvCallback_1 callback); +CvStatus *RNG_Uniform_Async(RNG rng, int a, int b, CvCallback_1 callback); +CvStatus *RNG_UniformDouble_Async(RNG rng, double a, double b, CvCallback_1 callback); +CvStatus *RNG_Next_Async(RNG rng, CvCallback_1 callback); // uint32_t *rval + +CvStatus *RandN_Async(Mat mat, Scalar mean, Scalar stddev, CvCallback_0 callback); +CvStatus *RandShuffle_Async(Mat mat, CvCallback_0 callback); +CvStatus *RandShuffleWithParams_Async(Mat mat, double iterFactor, RNG rng, CvCallback_0 callback); +CvStatus *RandU_Async(Mat mat, Scalar low, Scalar high, CvCallback_0 callback); +#pragma endregion + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/core/svd.cpp b/src/core/svd.cpp index f9ae6e66..b101affb 100644 --- a/src/core/svd.cpp +++ b/src/core/svd.cpp @@ -8,9 +8,20 @@ #include "svd.h" -CvStatus *SVD_Compute(Mat src, Mat w, Mat u, Mat vt, int flags) -{ +CvStatus *SVD_Compute(Mat src, Mat *w, Mat *u, Mat *vt, int flags) { BEGIN_WRAP - cv::SVD::compute(*src.ptr, *w.ptr, *u.ptr, *vt.ptr, flags); + cv::Mat _w, _u, _vt; + cv::SVD::compute(*src.ptr, _w, _u, _vt, flags); + *w = {new cv::Mat(_w)}; + *u = {new cv::Mat(_u)}; + *vt = {new cv::Mat(_vt)}; + END_WRAP +} + +CvStatus *SVD_backSubst(Mat w, Mat u, Mat vt, Mat rhs, Mat *dst) { + BEGIN_WRAP + cv::Mat _dst; + cv::SVD::backSubst(*w.ptr, *u.ptr, *vt.ptr, *rhs.ptr, _dst); + *dst = {new cv::Mat(_dst)}; END_WRAP } diff --git a/src/core/svd.h b/src/core/svd.h index d5fd92ac..76129742 100644 --- a/src/core/svd.h +++ b/src/core/svd.h @@ -17,7 +17,8 @@ extern "C" { #include "core.h" -CvStatus *SVD_Compute(Mat src, Mat w, Mat u, Mat vt, int flags); +CvStatus *SVD_Compute(Mat src, Mat *w, Mat *u, Mat *vt, int flags); +CvStatus *SVD_backSubst(Mat w, Mat u, Mat vt, Mat rhs, Mat *dst); #ifdef __cplusplus } diff --git a/src/core/svd_async.cpp b/src/core/svd_async.cpp new file mode 100644 index 00000000..1b7733fa --- /dev/null +++ b/src/core/svd_async.cpp @@ -0,0 +1,17 @@ +#include "svd_async.h" +#include "core/types.h" + +CvStatus *SVD_Compute_Async(Mat src, int flags, CvCallback_3 callback) { + BEGIN_WRAP + cv::Mat w, u, vt; + cv::SVD::compute(*src.ptr, w, u, vt, flags); + callback(new Mat{new cv::Mat(w)}, new Mat{new cv::Mat(u)}, new Mat{new cv::Mat(vt)}); + END_WRAP +} +CvStatus *SVD_backSubst_Async(Mat w, Mat u, Mat vt, Mat rhs, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::SVD::backSubst(*w.ptr, *u.ptr, *vt.ptr, *rhs.ptr, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} diff --git a/src/core/svd_async.h b/src/core/svd_async.h new file mode 100644 index 00000000..38422bfe --- /dev/null +++ b/src/core/svd_async.h @@ -0,0 +1,24 @@ +/* + Created by Rainyl. + Licensed: Apache 2.0 license. Copyright (c) 2024 Rainyl. +*/ +#pragma once +#ifndef CVD_SVD_ASYNC_H_ +#define CVD_SVD_ASYNC_H_ + +#ifdef __cplusplus +#include + +extern "C" { +#endif + +#include "types.h" + +CvStatus *SVD_Compute_Async(Mat src, int flags, CvCallback_3 callback); +CvStatus *SVD_backSubst_Async(Mat w, Mat u, Mat vt, Mat rhs, CvCallback_1 callback); + +#ifdef __cplusplus +} +#endif + +#endif // CVD_SVD_ASYNC_H_ diff --git a/src/core/types.h b/src/core/types.h new file mode 100644 index 00000000..75b559fe --- /dev/null +++ b/src/core/types.h @@ -0,0 +1,478 @@ +/* + Created by Rainyl. + Licensed: Apache 2.0 license. Copyright (c) 2024 Rainyl. +*/ + +#ifndef CVD_CORE_TYPES_H_ +#define CVD_CORE_TYPES_H_ + +#include +#include +#include + +#ifdef __cplusplus +#include +#include +extern "C" { +#endif + +#define CVD_OUT + +#define BEGIN_WRAP try { +#define END_WRAP \ + CvStatus *s = new CvStatus{ \ + .code = 0, \ + .msg = strdup("success"), \ + .err = strdup(""), \ + .func = strdup(__FUNCTION__), \ + .file = strdup(__FILE__), \ + .line = __LINE__, \ + }; \ + return s; \ + } \ + catch (cv::Exception & e) \ + { \ + CvStatus *s = new CvStatus{ \ + .code = e.code, \ + .msg = strdup(e.msg.c_str()), \ + .err = strdup(e.err.c_str()), \ + .func = strdup(e.func.c_str()), \ + .file = strdup(e.file.c_str()), \ + .line = e.line, \ + }; \ + return s; \ + } \ + catch (std::exception & e) \ + { \ + CvStatus *s = new CvStatus{ \ + .code = 1, \ + .msg = strdup(e.what()), \ + .err = strdup(e.what()), \ + .func = strdup(__FUNCTION__), \ + .file = strdup(__FILE__), \ + .line = __LINE__, \ + }; \ + return s; \ + } \ + catch (...) \ + { \ + CvStatus *s = new CvStatus{ \ + .code = 1, \ + .msg = strdup("Unknown error"), \ + .err = strdup("Unknown error"), \ + .func = strdup(__FUNCTION__), \ + .file = strdup(__FILE__), \ + .line = __LINE__, \ + }; \ + return s; \ + } + +#define CVD_TYPECAST_C(value) reinterpret_cast(value) +#define CVD_CALLBACK_DEF(value) typedef void (*value##Callback)(value *) + +#ifdef __cplusplus +#define CVD_TYPECAST_CPP(TYPE, value) reinterpret_cast(value->ptr) +// for test, value should not be freed here +#ifdef CVD_ENABLE_TEST +#define CVD_FREE(value) \ + delete value->ptr; \ + value->ptr = nullptr; +#else +// for dart ffi, value should be freed here or a memory leak will occur +#define CVD_FREE(value) \ + delete value->ptr; \ + value->ptr = nullptr; \ + delete value; \ + value = nullptr; +#endif + +#define CVD_TYPEDEF(TYPE, NAME) \ + typedef TYPE *NAME##_CPP; \ + typedef struct NAME { \ + TYPE *ptr; \ + } NAME; \ + typedef NAME *NAME##Ptr; \ + // CVD_CALLBACK_DEF(NAME) + +CVD_TYPEDEF(cv::Mat, Mat); +CVD_TYPEDEF(cv::_InputOutputArray, InputOutputArray); +CVD_TYPEDEF(cv::RNG, RNG); +CVD_TYPEDEF(std::vector, VecPoint); +CVD_TYPEDEF(std::vector>, VecVecPoint); +CVD_TYPEDEF(std::vector, VecPoint2f); +CVD_TYPEDEF(std::vector>, VecVecPoint2f); +CVD_TYPEDEF(std::vector, VecPoint3f); +CVD_TYPEDEF(std::vector>, VecVecPoint3f); +CVD_TYPEDEF(std::vector, VecUChar); +CVD_TYPEDEF(std::vector, VecChar); +CVD_TYPEDEF(std::vector, VecInt); +CVD_TYPEDEF(std::vector, VecFloat); +CVD_TYPEDEF(std::vector, VecDouble); +CVD_TYPEDEF(std::vector>, VecVecChar); +CVD_TYPEDEF(std::vector, VecMat); +CVD_TYPEDEF(std::vector, VecRect); +CVD_TYPEDEF(std::vector, VecKeyPoint); +CVD_TYPEDEF(std::vector, VecDMatch); +CVD_TYPEDEF(std::vector>, VecVecDMatch); +CVD_TYPEDEF(std::vector, VecVec4i); +CVD_TYPEDEF(std::vector, VecVec4f); +CVD_TYPEDEF(std::vector, VecVec6f); +#else +#define CVD_TYPEDEF(TYPE, NAME) \ + typedef struct NAME { \ + TYPE *ptr; \ + } NAME; \ + typedef NAME *NAME##Ptr; \ + // CVD_CALLBACK_DEF(NAME) + +typedef unsigned char uchar; +typedef unsigned short ushort; + +CVD_TYPEDEF(void, Mat); +CVD_TYPEDEF(void, InputOutputArray); +CVD_TYPEDEF(void, RNG); +CVD_TYPEDEF(void, VecPoint); +CVD_TYPEDEF(void, VecVecPoint); +CVD_TYPEDEF(void, VecPoint2f); +CVD_TYPEDEF(void, VecVecPoint2f); +CVD_TYPEDEF(void, VecPoint3f); +CVD_TYPEDEF(void, VecVecPoint3f); +CVD_TYPEDEF(void, VecUChar); +CVD_TYPEDEF(void, VecChar); +CVD_TYPEDEF(void, VecInt); +CVD_TYPEDEF(void, VecFloat); +CVD_TYPEDEF(void, VecDouble); +CVD_TYPEDEF(void, VecVecChar); +CVD_TYPEDEF(void, VecMat); +CVD_TYPEDEF(void, VecRect); +CVD_TYPEDEF(void, VecKeyPoint); +CVD_TYPEDEF(void, VecDMatch); +CVD_TYPEDEF(void, VecVecDMatch); +CVD_TYPEDEF(void, VecVec4i); +CVD_TYPEDEF(void, VecVec4f); +CVD_TYPEDEF(void, VecVec6f); +#endif + +// Wrapper for an individual cv::cvPoint +typedef struct Point { + int x; + int y; +} Point; +// CVD_CALLBACK_DEF(Point); + +// Wrapper for an individual cv::Point2f +typedef struct Point2f { + float x; + float y; +} Point2f; +// CVD_CALLBACK_DEF(Point2f); + +typedef struct Point3f { + float x; + float y; + float z; +} Point3f; +// CVD_CALLBACK_DEF(Point3f); + +// Wrapper for an individual cv::cvRect +typedef struct Rect { + int x; + int y; + int width; + int height; +} Rect; +// CVD_CALLBACK_DEF(Rect); + +typedef struct Rect2f { + float x; + float y; + float width; + float height; +} Rect2f; +// CVD_CALLBACK_DEF(Rect2f); + +// Wrapper for an individual cv::cvSize +typedef struct Size { + int width; + int height; +} Size; +// CVD_CALLBACK_DEF(Size); + +typedef struct Size2f { + float width; + float height; +} Size2f; +// CVD_CALLBACK_DEF(Size2f); + +// Wrapper for an individual cv::RotatedRect +typedef struct RotatedRect { + Point2f center; + Size2f size; + double angle; +} RotatedRect; +// CVD_CALLBACK_DEF(RotatedRect); + +// Wrapper for an individual cv::cvScalar +typedef struct Scalar { + double val1; + double val2; + double val3; + double val4; +} Scalar; +// CVD_CALLBACK_DEF(Scalar); + +// Wrapper for a individual cv::KeyPoint +typedef struct KeyPoint { + double x; + double y; + double size; + double angle; + double response; + int octave; + int classID; +} KeyPoint; +// CVD_CALLBACK_DEF(KeyPoint); + +// Wrapper for an individual cv::DMatch +typedef struct DMatch { + int queryIdx; + int trainIdx; + int imgIdx; + float distance; +} DMatch; +// CVD_CALLBACK_DEF(DMatch); + +// Wrapper for an individual cv::Moment +typedef struct Moment { + double m00; + double m10; + double m01; + double m20; + double m11; + double m02; + double m30; + double m21; + double m12; + double m03; + + double mu20; + double mu11; + double mu02; + double mu30; + double mu21; + double mu12; + double mu03; + + double nu20; + double nu11; + double nu02; + double nu30; + double nu21; + double nu12; + double nu03; +} Moment; +// CVD_CALLBACK_DEF(Moment); + +typedef struct CvStatus { + int code; + char *msg; + char *err; + char *func; + char *file; + int line; +} CvStatus; + +typedef struct Vec2b { + uchar val1; + uchar val2; +} Vec2b; +// CVD_CALLBACK_DEF(Vec2b); + +typedef struct Vec3b { + uchar val1; + uchar val2; + uchar val3; +} Vec3b; +// CVD_CALLBACK_DEF(Vec3b); + +typedef struct Vec4b { + uchar val1; + uchar val2; + uchar val3; + uchar val4; +} Vec4b; +// CVD_CALLBACK_DEF(Vec4b); + +typedef struct Vec2s { + short val1; + short val2; +} Vec2s; +typedef struct Vec3s { + short val1; + short val2; + short val3; +} Vec3s; +// CVD_CALLBACK_DEF(Vec3s); + +typedef struct Vec4s { + short val1; + short val2; + short val3; + short val4; +} Vec4s; +// CVD_CALLBACK_DEF(Vec4s); + +typedef struct Vec2w { + ushort val1; + ushort val2; +} Vec2w; +// CVD_CALLBACK_DEF(Vec2w); + +typedef struct Vec3w { + ushort val1; + ushort val2; + ushort val3; +} Vec3w; +// CVD_CALLBACK_DEF(Vec3w); + +typedef struct Vec4w { + ushort val1; + ushort val2; + ushort val3; + ushort val4; +} Vec4w; +// CVD_CALLBACK_DEF(Vec4w); + +typedef struct Vec2i { + int val1; + int val2; +} Vec2i; +// CVD_CALLBACK_DEF(Vec2i); +typedef struct Vec3i { + int val1; + int val2; + int val3; +} Vec3i; +// CVD_CALLBACK_DEF(Vec3i); + +typedef struct Vec4i { + int val1; + int val2; + int val3; + int val4; +} Vec4i; +// CVD_CALLBACK_DEF(Vec4i); +typedef struct Vec6i { + int val1; + int val2; + int val3; + int val4; + int val5; + int val6; +} Vec6i; +// CVD_CALLBACK_DEF(Vec6i); + +typedef struct Vec8i { + int val1; + int val2; + int val3; + int val4; + int val5; + int val6; + int val7; + int val8; +} Vec8i; +// CVD_CALLBACK_DEF(Vec8i); + +typedef struct Vec2f { + float val1; + float val2; +} Vec2f; +// CVD_CALLBACK_DEF(Vec2f); + +typedef struct Vec3f { + float val1; + float val2; + float val3; +} Vec3f; +// CVD_CALLBACK_DEF(Vec3f); + +typedef struct Vec4f { + float val1; + float val2; + float val3; + float val4; +} Vec4f; +// CVD_CALLBACK_DEF(Vec4f); + +typedef struct Vec6f { + float val1; + float val2; + float val3; + float val4; + float val5; + float val6; +} Vec6f; +// CVD_CALLBACK_DEF(Vec6f); + +typedef struct Vec2d { + double val1; + double val2; +} Vec2d; +// CVD_CALLBACK_DEF(Vec2d); + +typedef struct Vec3d { + double val1; + double val2; + double val3; +} Vec3d; +// CVD_CALLBACK_DEF(Vec3d); + +typedef struct Vec4d { + double val1; + double val2; + double val3; + double val4; +} Vec4d; +// CVD_CALLBACK_DEF(Vec4d); + +typedef struct Vec6d { + double val1; + double val2; + double val3; + double val4; + double val5; + double val6; +} Vec6d; +// CVD_CALLBACK_DEF(Vec6d); + +typedef void (*CvCallback_0)(); +typedef void (*CvCallback_1)(void *); +typedef void (*CvCallback_2)(void *, void *); +typedef void (*CvCallback_3)(void *, void *, void *); +typedef void (*CvCallback_4)(void *, void *, void *, void *); +typedef void (*CvCallback_5)(void *, void *, void *, void *, void *); +typedef void (*CvCallback_6)(void *, void *, void *, void *, void *, void *); +typedef void (*CvCallback_7)(void *, void *, void *, void *, void *, void *, void *); +typedef void (*CvCallback_8)(void *, void *, void *, void *, void *, void *, void *, void *); +typedef void (*CvCallback_9)(void *, void *, void *, void *, void *, void *, void *, void *, void *); + +// Contour is alias for Points +typedef VecPoint Contour; +typedef VecPoint2f Contour2f; +typedef VecPoint3f Contour3f; +typedef VecVecPoint Contours; +typedef VecVecPoint2f Contours2f; +typedef VecVecPoint3f Contours3f; + +typedef struct TermCriteria { + int type; + int maxCount; + double epsilon; +} TermCriteria; + +#ifdef __cplusplus +} +#endif + +#endif // CVD_CORE_TYPES_H_ diff --git a/src/core/vec.cpp b/src/core/vec.cpp index 4133b3ba..b949bdf5 100644 --- a/src/core/vec.cpp +++ b/src/core/vec.cpp @@ -1,77 +1,68 @@ #include "vec.h" +#include "core/core.h" +#include "opencv2/core/matx.hpp" #include #include -CvStatus *VecPoint_New(VecPoint *rval) -{ +CvStatus *VecPoint_New(VecPoint *rval) { BEGIN_WRAP *rval = {new std::vector()}; END_WRAP } -CvStatus *VecPoint_NewFromPointer(Point *points, int length, VecPoint *rval) -{ +CvStatus *VecPoint_NewFromPointer(Point *points, int length, VecPoint *rval) { BEGIN_WRAP std::vector vec; - for (int i = 0; i < length; i++) { - vec.push_back(cv::Point(points[i].x, points[i].y)); - } + for (int i = 0; i < length; i++) { vec.push_back(cv::Point(points[i].x, points[i].y)); } *rval = {new std::vector(vec)}; END_WRAP } -CvStatus *VecPoint_NewFromMat(Mat mat, VecPoint *rval) -{ +CvStatus *VecPoint_NewFromMat(Mat mat, VecPoint *rval) { BEGIN_WRAP std::vector pts = (std::vector)*mat.ptr; *rval = {new std::vector(pts)}; END_WRAP } -CvStatus *VecPoint_NewFromVec(VecPoint vec, VecPoint *rval) -{ +CvStatus *VecPoint_NewFromVec(VecPoint vec, VecPoint *rval) { BEGIN_WRAP *rval = {new std::vector(*vec.ptr)}; END_WRAP } -CvStatus *VecPoint_At(VecPoint vec, int idx, Point *rval) -{ +CvStatus *VecPoint_At(VecPoint vec, int idx, Point *rval) { BEGIN_WRAP auto p = vec.ptr->at(idx); *rval = {p.x, p.y}; END_WRAP } -CvStatus *VecPoint_Append(VecPoint vec, Point p) -{ +CvStatus *VecPoint_Append(VecPoint vec, Point p) { BEGIN_WRAP vec.ptr->push_back(cv::Point(p.x, p.y)); END_WRAP } -CvStatus *VecPoint_Size(VecPoint vec, int *rval) -{ +CvStatus *VecPoint_Size(VecPoint vec, int *rval) { BEGIN_WRAP *rval = static_cast(vec.ptr->size()); END_WRAP } -void VecPoint_Close(VecPointPtr vec) -{ +void VecPoint_Close(VecPointPtr vec) { vec->ptr->clear(); - CVD_FREE(vec) + CVD_FREE(vec); + ; } -CvStatus *VecVecPoint_New(VecVecPoint *rval) -{ +CvStatus *VecVecPoint_New(VecVecPoint *rval) { BEGIN_WRAP *rval = {new std::vector>()}; END_WRAP } -CvStatus *VecVecPoint_NewFromPointer(VecPoint *points, int length, VecVecPoint *rval) -{ +CvStatus *VecVecPoint_NewFromPointer(VecPoint *points, int length, VecVecPoint *rval) { BEGIN_WRAP std::vector> v; for (int i = 0; i < length; i++) { @@ -82,110 +73,94 @@ CvStatus *VecVecPoint_NewFromPointer(VecPoint *points, int length, VecVecPoint * END_WRAP } -CvStatus *VecVecPoint_NewFromVec(VecVecPoint vec, VecVecPoint *rval) -{ +CvStatus *VecVecPoint_NewFromVec(VecVecPoint vec, VecVecPoint *rval) { BEGIN_WRAP *rval = {new std::vector>(*vec.ptr)}; END_WRAP } -CvStatus *VecVecPoint_At(VecVecPoint vec, int idx, VecPoint *rval) -{ +CvStatus *VecVecPoint_At(VecVecPoint vec, int idx, VecPoint *rval) { BEGIN_WRAP *rval = {new std::vector(vec.ptr->at(idx))}; END_WRAP } -CvStatus *VecVecPoint_Append(VecVecPoint vec, VecPoint pv) -{ +CvStatus *VecVecPoint_Append(VecVecPoint vec, VecPoint pv) { BEGIN_WRAP vec.ptr->push_back(*pv.ptr); END_WRAP } -CvStatus *VecVecPoint_Size(VecVecPoint vec, int *rval) -{ +CvStatus *VecVecPoint_Size(VecVecPoint vec, int *rval) { BEGIN_WRAP *rval = static_cast(vec.ptr->size()); END_WRAP } -void VecVecPoint_Close(VecVecPointPtr vec) -{ +void VecVecPoint_Close(VecVecPointPtr vec) { vec->ptr->clear(); - CVD_FREE(vec) + CVD_FREE(vec); + ; } -CvStatus *VecPoint2f_New(VecPoint2f *rval) -{ +CvStatus *VecPoint2f_New(VecPoint2f *rval) { BEGIN_WRAP *rval = {new std::vector()}; END_WRAP } -void VecPoint2f_Close(VecPoint2fPtr vec) -{ +void VecPoint2f_Close(VecPoint2fPtr vec) { vec->ptr->clear(); - CVD_FREE(vec) + CVD_FREE(vec); } -CvStatus *VecPoint2f_NewFromPointer(Point2f *points, int length, VecPoint2f *rval) -{ +CvStatus *VecPoint2f_NewFromPointer(Point2f *points, int length, VecPoint2f *rval) { BEGIN_WRAP std::vector vec; - for (int i = 0; i < length; i++) { - vec.push_back(cv::Point2f(points[i].x, points[i].y)); - } + for (int i = 0; i < length; i++) { vec.push_back(cv::Point2f(points[i].x, points[i].y)); } *rval = {new std::vector(vec)}; END_WRAP } -CvStatus *VecPoint2f_NewFromMat(Mat mat, VecPoint2f *rval) -{ +CvStatus *VecPoint2f_NewFromMat(Mat mat, VecPoint2f *rval) { BEGIN_WRAP std::vector pts = (std::vector)*mat.ptr; *rval = {new std::vector(pts)}; END_WRAP } -CvStatus *VecPoint2f_NewFromVec(VecPoint2f vec, VecPoint2f *rval) -{ +CvStatus *VecPoint2f_NewFromVec(VecPoint2f vec, VecPoint2f *rval) { BEGIN_WRAP *rval = {new std::vector(*vec.ptr)}; END_WRAP } -CvStatus *VecPoint2f_At(VecPoint2f vec, int idx, Point2f *rval) -{ +CvStatus *VecPoint2f_At(VecPoint2f vec, int idx, Point2f *rval) { BEGIN_WRAP auto p = vec.ptr->at(idx); *rval = {p.x, p.y}; END_WRAP } -CvStatus *VecPoint2f_Append(VecPoint2f vec, Point2f p) -{ +CvStatus *VecPoint2f_Append(VecPoint2f vec, Point2f p) { BEGIN_WRAP vec.ptr->push_back(cv::Point2f(p.x, p.y)); END_WRAP } -CvStatus *VecPoint2f_Size(VecPoint2f vec, int *rval) -{ +CvStatus *VecPoint2f_Size(VecPoint2f vec, int *rval) { BEGIN_WRAP *rval = static_cast(vec.ptr->size()); END_WRAP } -CvStatus *VecVecPoint2f_New(VecVecPoint2f *rval) -{ +CvStatus *VecVecPoint2f_New(VecVecPoint2f *rval) { BEGIN_WRAP *rval = {new std::vector>()}; END_WRAP } -CvStatus *VecVecPoint2f_NewFromPointer(VecPoint2f *points, int length, VecVecPoint2f *rval) -{ +CvStatus *VecVecPoint2f_NewFromPointer(VecPoint2f *points, int length, VecVecPoint2f *rval) { BEGIN_WRAP std::vector> v; for (int i = 0; i < length; i++) { @@ -196,55 +171,47 @@ CvStatus *VecVecPoint2f_NewFromPointer(VecPoint2f *points, int length, VecVecPoi END_WRAP } -CvStatus *VecVecPoint2f_NewFromVec(VecVecPoint2f vec, VecVecPoint2f *rval) -{ +CvStatus *VecVecPoint2f_NewFromVec(VecVecPoint2f vec, VecVecPoint2f *rval) { BEGIN_WRAP *rval = {new std::vector>(*vec.ptr)}; END_WRAP } -CvStatus *VecVecPoint2f_At(VecVecPoint2f vec, int idx, VecPoint2f *rval) -{ +CvStatus *VecVecPoint2f_At(VecVecPoint2f vec, int idx, VecPoint2f *rval) { BEGIN_WRAP *rval = {new std::vector(vec.ptr->at(idx))}; END_WRAP } -CvStatus *VecVecPoint2f_Append(VecVecPoint2f vec, VecPoint2f pv) -{ +CvStatus *VecVecPoint2f_Append(VecVecPoint2f vec, VecPoint2f pv) { BEGIN_WRAP vec.ptr->push_back((std::vector)*pv.ptr); END_WRAP } -CvStatus *VecVecPoint2f_Size(VecVecPoint2f vec, int *rval) -{ +CvStatus *VecVecPoint2f_Size(VecVecPoint2f vec, int *rval) { BEGIN_WRAP *rval = static_cast(vec.ptr->size()); END_WRAP } -void VecVecPoint2f_Close(VecVecPoint2fPtr vec) -{ +void VecVecPoint2f_Close(VecVecPoint2fPtr vec) { vec->ptr->clear(); - CVD_FREE(vec) + CVD_FREE(vec); } -CvStatus *VecPoint3f_New(VecPoint3f *rval) -{ +CvStatus *VecPoint3f_New(VecPoint3f *rval) { BEGIN_WRAP *rval = {new std::vector()}; END_WRAP } -void VecPoint3f_Close(VecPoint3fPtr vec) -{ +void VecPoint3f_Close(VecPoint3fPtr vec) { vec->ptr->clear(); - CVD_FREE(vec) + CVD_FREE(vec); } -CvStatus *VecPoint3f_NewFromPointer(Point3f *points, int length, VecPoint3f *rval) -{ +CvStatus *VecPoint3f_NewFromPointer(Point3f *points, int length, VecPoint3f *rval) { BEGIN_WRAP std::vector vec; for (int i = 0; i < length; i++) { @@ -254,51 +221,44 @@ CvStatus *VecPoint3f_NewFromPointer(Point3f *points, int length, VecPoint3f *rva END_WRAP } -CvStatus *VecPoint3f_NewFromMat(Mat mat, VecPoint3f *rval) -{ +CvStatus *VecPoint3f_NewFromMat(Mat mat, VecPoint3f *rval) { BEGIN_WRAP *rval = {new std::vector((std::vector)*mat.ptr)}; END_WRAP } -CvStatus *VecPoint3f_NewFromVec(VecPoint3f vec, VecPoint3f *rval) -{ +CvStatus *VecPoint3f_NewFromVec(VecPoint3f vec, VecPoint3f *rval) { BEGIN_WRAP *rval = {new std::vector(*vec.ptr)}; END_WRAP } -CvStatus *VecPoint3f_At(VecPoint3f vec, int idx, Point3f *rval) -{ +CvStatus *VecPoint3f_At(VecPoint3f vec, int idx, Point3f *rval) { BEGIN_WRAP auto p = vec.ptr->at(idx); *rval = {p.x, p.y, p.z}; END_WRAP } -CvStatus *VecPoint3f_Append(VecPoint3f vec, Point3f p) -{ +CvStatus *VecPoint3f_Append(VecPoint3f vec, Point3f p) { BEGIN_WRAP vec.ptr->push_back(cv::Point3f(p.x, p.y, p.z)); END_WRAP } -CvStatus *VecPoint3f_Size(VecPoint3f vec, int *rval) -{ +CvStatus *VecPoint3f_Size(VecPoint3f vec, int *rval) { BEGIN_WRAP *rval = static_cast(vec.ptr->size()); END_WRAP } -CvStatus *VecVecPoint3f_New(VecVecPoint3f *rval) -{ +CvStatus *VecVecPoint3f_New(VecVecPoint3f *rval) { BEGIN_WRAP *rval = {new std::vector>()}; END_WRAP } -CvStatus *VecVecPoint3f_NewFromPointer(VecPoint3f *points, int length, VecVecPoint3f *rval) -{ +CvStatus *VecVecPoint3f_NewFromPointer(VecPoint3f *points, int length, VecVecPoint3f *rval) { BEGIN_WRAP std::vector> v; for (int i = 0; i < length; i++) { @@ -309,161 +269,135 @@ CvStatus *VecVecPoint3f_NewFromPointer(VecPoint3f *points, int length, VecVecPoi END_WRAP } -CvStatus *VecVecPoint3f_NewFromVec(VecVecPoint3f vec, VecVecPoint3f *rval) -{ +CvStatus *VecVecPoint3f_NewFromVec(VecVecPoint3f vec, VecVecPoint3f *rval) { BEGIN_WRAP *rval = {new std::vector>(*vec.ptr)}; END_WRAP } -CvStatus *VecVecPoint3f_At(VecVecPoint3f vec, int idx, VecPoint3f *rval) -{ +CvStatus *VecVecPoint3f_At(VecVecPoint3f vec, int idx, VecPoint3f *rval) { BEGIN_WRAP *rval = {new std::vector(vec.ptr->at(idx))}; END_WRAP } -CvStatus *VecVecPoint3f_Append(VecVecPoint3f vec, VecPoint3f pv) -{ +CvStatus *VecVecPoint3f_Append(VecVecPoint3f vec, VecPoint3f pv) { BEGIN_WRAP vec.ptr->push_back((std::vector)*pv.ptr); END_WRAP } -CvStatus *VecVecPoint3f_Size(VecVecPoint3f vec, int *rval) -{ +CvStatus *VecVecPoint3f_Size(VecVecPoint3f vec, int *rval) { BEGIN_WRAP *rval = static_cast(vec.ptr->size()); END_WRAP } -void VecVecPoint3f_Close(VecVecPoint3fPtr vec) -{ +void VecVecPoint3f_Close(VecVecPoint3fPtr vec) { vec->ptr->clear(); - CVD_FREE(vec) + CVD_FREE(vec); } -CvStatus *VecUChar_New(VecUChar *rval) -{ +CvStatus *VecUChar_New(VecUChar *rval) { BEGIN_WRAP *rval = {new std::vector()}; END_WRAP } -CvStatus *VecUChar_NewFromPointer(uchar *p, int length, VecUChar *rval) -{ +CvStatus *VecUChar_NewFromPointer(uchar *p, int length, VecUChar *rval) { BEGIN_WRAP std::vector v; - for (int i = 0; i < length; i++) { - v.push_back(p[i]); - } + for (int i = 0; i < length; i++) { v.push_back(p[i]); } *rval = {new std::vector(v)}; END_WRAP } -CvStatus *VecUChar_NewFromVec(VecUChar vec, VecUChar *rval) -{ +CvStatus *VecUChar_NewFromVec(VecUChar vec, VecUChar *rval) { BEGIN_WRAP *rval = {new std::vector(*vec.ptr)}; END_WRAP } -CvStatus *VecUChar_Append(VecUChar vec, uchar i) -{ +CvStatus *VecUChar_Append(VecUChar vec, uchar i) { BEGIN_WRAP vec.ptr->push_back(i); END_WRAP } -CvStatus *VecUChar_At(VecUChar vec, int idx, uchar *rval) -{ +CvStatus *VecUChar_At(VecUChar vec, int idx, uchar *rval) { BEGIN_WRAP *rval = vec.ptr->at(idx); END_WRAP } -CvStatus *VecUChar_Data(VecUChar vec, uchar **rval) -{ +CvStatus *VecUChar_Data(VecUChar vec, uchar **rval) { BEGIN_WRAP *rval = vec.ptr->data(); END_WRAP } -CvStatus *VecUChar_AtNoBoundCheck(VecUChar vec, int idx, uchar *rval) -{ +CvStatus *VecUChar_AtNoBoundCheck(VecUChar vec, int idx, uchar *rval) { BEGIN_WRAP *rval = vec.ptr->data()[idx]; END_WRAP } -CvStatus *VecUChar_Size(VecUChar vec, int *rval) -{ +CvStatus *VecUChar_Size(VecUChar vec, int *rval) { BEGIN_WRAP *rval = static_cast(vec.ptr->size()); END_WRAP } -void VecUChar_Close(VecUCharPtr vec) -{ +void VecUChar_Close(VecUCharPtr vec) { vec->ptr->clear(); - CVD_FREE(vec) + CVD_FREE(vec); } -CvStatus *VecChar_New(VecChar *rval) -{ +CvStatus *VecChar_New(VecChar *rval) { BEGIN_WRAP *rval = {new std::vector()}; END_WRAP } -CvStatus *VecChar_NewFromPointer(const char *p, int length, VecChar *rval) -{ +CvStatus *VecChar_NewFromPointer(const char *p, int length, VecChar *rval) { BEGIN_WRAP std::vector v; - for (int i = 0; i < length; i++) { - v.push_back(p[i]); - } + for (int i = 0; i < length; i++) { v.push_back(p[i]); } *rval = {new std::vector(v)}; END_WRAP } -CvStatus *VecChar_NewFromVec(VecChar vec, VecChar *rval) -{ +CvStatus *VecChar_NewFromVec(VecChar vec, VecChar *rval) { BEGIN_WRAP *rval = {new std::vector(*vec.ptr)}; END_WRAP } -CvStatus *VecChar_Append(VecChar vec, char i) -{ +CvStatus *VecChar_Append(VecChar vec, char i) { BEGIN_WRAP vec.ptr->push_back(i); END_WRAP } -CvStatus *VecChar_At(VecChar vec, int idx, char *rval) -{ +CvStatus *VecChar_At(VecChar vec, int idx, char *rval) { BEGIN_WRAP *rval = vec.ptr->at(idx); END_WRAP } -CvStatus *VecChar_Data(VecChar vec, char **rval) -{ +CvStatus *VecChar_Data(VecChar vec, char **rval) { BEGIN_WRAP *rval = vec.ptr->data(); END_WRAP } -CvStatus *VecChar_Size(VecChar vec, int *rval) -{ +CvStatus *VecChar_Size(VecChar vec, int *rval) { BEGIN_WRAP *rval = static_cast(vec.ptr->size()); END_WRAP } -CvStatus *VecChar_ToString(VecChar vec, char **rval, int *length) -{ +CvStatus *VecChar_ToString(VecChar vec, char **rval, int *length) { BEGIN_WRAP *length = static_cast(vec.ptr->size()); char *tempBuffer = new char[*length + 1]; @@ -473,32 +407,27 @@ CvStatus *VecChar_ToString(VecChar vec, char **rval, int *length) END_WRAP } -void VecChar_Close(VecCharPtr vec) -{ +void VecChar_Close(VecCharPtr vec) { vec->ptr->clear(); - CVD_FREE(vec) + CVD_FREE(vec); } -CvStatus *VecVecChar_New(VecVecChar *rval) -{ +CvStatus *VecVecChar_New(VecVecChar *rval) { BEGIN_WRAP *rval = {new std::vector>()}; END_WRAP } -CvStatus *VecVecChar_NewFromVec(VecVecChar vec, VecVecChar *rval) -{ +CvStatus *VecVecChar_NewFromVec(VecVecChar vec, VecVecChar *rval) { BEGIN_WRAP *rval = {new std::vector>(*vec.ptr)}; END_WRAP } -CvStatus *VecVecChar_Append(VecVecChar vec, VecChar v) -{ +CvStatus *VecVecChar_Append(VecVecChar vec, VecChar v) { BEGIN_WRAP vec.ptr->push_back(*v.ptr); END_WRAP } -CvStatus *VecVecChar_Append_Str(VecVecChar vec, const char *str) -{ +CvStatus *VecVecChar_Append_Str(VecVecChar vec, const char *str) { BEGIN_WRAP int len = strlen(str); @@ -506,14 +435,12 @@ CvStatus *VecVecChar_Append_Str(VecVecChar vec, const char *str) vec.ptr->push_back(v); END_WRAP } -CvStatus *VecVecChar_At(VecVecChar vec, int idx, VecChar *rval) -{ +CvStatus *VecVecChar_At(VecVecChar vec, int idx, VecChar *rval) { BEGIN_WRAP *rval = {new std::vector(vec.ptr->at(idx))}; END_WRAP } -CvStatus *VecVecChar_At_Str(VecVecChar vec, int idx, char **rval, int *length) -{ +CvStatus *VecVecChar_At_Str(VecVecChar vec, int idx, char **rval, int *length) { BEGIN_WRAP auto str = vec.ptr->at(idx); *length = static_cast(str.size()); @@ -523,263 +450,219 @@ CvStatus *VecVecChar_At_Str(VecVecChar vec, int idx, char **rval, int *length) *rval = tempBuffer; END_WRAP } -CvStatus *VecVecChar_Size(VecVecChar vec, int *rval) -{ +CvStatus *VecVecChar_Size(VecVecChar vec, int *rval) { BEGIN_WRAP *rval = vec.ptr->size(); END_WRAP } -void VecVecChar_Close(VecVecCharPtr vec) -{ +void VecVecChar_Close(VecVecCharPtr vec) { vec->ptr->clear(); - CVD_FREE(vec) + CVD_FREE(vec); } -CvStatus *VecInt_New(VecInt *rval) -{ +CvStatus *VecInt_New(VecInt *rval) { BEGIN_WRAP *rval = {new std::vector()}; END_WRAP } -CvStatus *VecInt_NewFromPointer(int *p, int length, VecInt *rval) -{ +CvStatus *VecInt_NewFromPointer(int *p, int length, VecInt *rval) { BEGIN_WRAP std::vector v; - for (int i = 0; i < length; i++) { - v.push_back(p[i]); - } + for (int i = 0; i < length; i++) { v.push_back(p[i]); } *rval = {new std::vector(v)}; END_WRAP } -CvStatus *VecInt_NewFromVec(VecInt vec, VecInt *rval) -{ +CvStatus *VecInt_NewFromVec(VecInt vec, VecInt *rval) { BEGIN_WRAP *rval = {new std::vector(*vec.ptr)}; END_WRAP } -CvStatus *VecInt_Append(VecInt vec, int i) -{ +CvStatus *VecInt_Append(VecInt vec, int i) { BEGIN_WRAP vec.ptr->push_back(i); END_WRAP } -CvStatus *VecInt_At(VecInt vec, int idx, int *rval) -{ +CvStatus *VecInt_At(VecInt vec, int idx, int *rval) { BEGIN_WRAP *rval = vec.ptr->at(idx); END_WRAP } -CvStatus *VecInt_AtNoBoundCheck(VecInt vec, int idx, int *rval) -{ +CvStatus *VecInt_AtNoBoundCheck(VecInt vec, int idx, int *rval) { BEGIN_WRAP *rval = vec.ptr->data()[idx]; END_WRAP } -CvStatus *VecInt_Data(VecInt vec, int **rval) -{ +CvStatus *VecInt_Data(VecInt vec, int **rval) { BEGIN_WRAP *rval = vec.ptr->data(); END_WRAP } -CvStatus *VecInt_Size(VecInt vec, int *rval) -{ +CvStatus *VecInt_Size(VecInt vec, int *rval) { BEGIN_WRAP *rval = static_cast(vec.ptr->size()); END_WRAP } -void VecInt_Close(VecIntPtr vec) -{ +void VecInt_Close(VecIntPtr vec) { vec->ptr->clear(); - CVD_FREE(vec) + CVD_FREE(vec); } -CvStatus *VecFloat_New(VecFloat *rval) -{ +CvStatus *VecFloat_New(VecFloat *rval) { BEGIN_WRAP *rval = {new std::vector()}; END_WRAP } -CvStatus *VecFloat_NewFromPointer(float *p, int length, VecFloat *rval) -{ +CvStatus *VecFloat_NewFromPointer(float *p, int length, VecFloat *rval) { BEGIN_WRAP std::vector v; - for (int i = 0; i < length; i++) { - v.push_back(p[i]); - } + for (int i = 0; i < length; i++) { v.push_back(p[i]); } *rval = {new std::vector(v)}; END_WRAP } -CvStatus *VecFloat_NewFromVec(VecFloat vec, VecFloat *rval) -{ +CvStatus *VecFloat_NewFromVec(VecFloat vec, VecFloat *rval) { BEGIN_WRAP *rval = {new std::vector(*vec.ptr)}; END_WRAP } -CvStatus *VecFloat_Append(VecFloat vec, float f) -{ +CvStatus *VecFloat_Append(VecFloat vec, float f) { BEGIN_WRAP vec.ptr->push_back(f); END_WRAP } -CvStatus *VecFloat_At(VecFloat vec, int idx, float *rval) -{ +CvStatus *VecFloat_At(VecFloat vec, int idx, float *rval) { BEGIN_WRAP *rval = vec.ptr->at(idx); END_WRAP } -CvStatus *VecFloat_Data(VecFloat vec, float **rval) -{ +CvStatus *VecFloat_Data(VecFloat vec, float **rval) { BEGIN_WRAP *rval = vec.ptr->data(); END_WRAP } -CvStatus *VecFloat_Size(VecFloat vec, int *rval) -{ +CvStatus *VecFloat_Size(VecFloat vec, int *rval) { BEGIN_WRAP *rval = static_cast(vec.ptr->size()); END_WRAP } -void VecFloat_Close(VecFloatPtr vec) -{ +void VecFloat_Close(VecFloatPtr vec) { vec->ptr->clear(); - CVD_FREE(vec) + CVD_FREE(vec); } -CvStatus *VecDouble_New(VecDouble *rval) -{ +CvStatus *VecDouble_New(VecDouble *rval) { BEGIN_WRAP *rval = {new std::vector()}; END_WRAP } -CvStatus *VecDouble_NewFromPointer(double *p, int length, VecDouble *rval) -{ +CvStatus *VecDouble_NewFromPointer(double *p, int length, VecDouble *rval) { BEGIN_WRAP std::vector v; - for (int i = 0; i < length; i++) { - v.push_back(p[i]); - } + for (int i = 0; i < length; i++) { v.push_back(p[i]); } *rval = {new std::vector(v)}; END_WRAP } -CvStatus *VecDouble_NewFromVec(VecDouble vec, VecDouble *rval) -{ +CvStatus *VecDouble_NewFromVec(VecDouble vec, VecDouble *rval) { BEGIN_WRAP *rval = {new std::vector(*vec.ptr)}; END_WRAP } -CvStatus *VecDouble_Append(VecDouble vec, double d) -{ +CvStatus *VecDouble_Append(VecDouble vec, double d) { BEGIN_WRAP vec.ptr->push_back(d); END_WRAP } -CvStatus *VecDouble_At(VecDouble vec, int idx, double *rval) -{ +CvStatus *VecDouble_At(VecDouble vec, int idx, double *rval) { BEGIN_WRAP *rval = vec.ptr->at(idx); END_WRAP } -CvStatus *VecDouble_Data(VecDouble vec, double **rval) -{ +CvStatus *VecDouble_Data(VecDouble vec, double **rval) { BEGIN_WRAP *rval = vec.ptr->data(); END_WRAP } -CvStatus *VecDouble_Size(VecDouble vec, int *rval) -{ +CvStatus *VecDouble_Size(VecDouble vec, int *rval) { BEGIN_WRAP *rval = static_cast(vec.ptr->size()); END_WRAP } -void VecDouble_Close(VecDoublePtr vec) -{ +void VecDouble_Close(VecDoublePtr vec) { vec->ptr->clear(); - CVD_FREE(vec) + CVD_FREE(vec); } -CvStatus *VecMat_New(VecMat *rval) -{ +CvStatus *VecMat_New(VecMat *rval) { BEGIN_WRAP *rval = {new std::vector()}; END_WRAP } -CvStatus *VecMat_NewFromPointer(Mat *mats, int length, VecMat *rval) -{ +CvStatus *VecMat_NewFromPointer(Mat *mats, int length, VecMat *rval) { BEGIN_WRAP std::vector v; - for (int i = 0; i < length; i++) { - v.push_back(*(mats[i].ptr)); - } + for (int i = 0; i < length; i++) { v.push_back(*(mats[i].ptr)); } *rval = {new std::vector(v)}; END_WRAP } -CvStatus *VecMat_NewFromVec(VecMat vec, VecMat *rval) -{ +CvStatus *VecMat_NewFromVec(VecMat vec, VecMat *rval) { BEGIN_WRAP *rval = {new std::vector(*vec.ptr)}; END_WRAP } -CvStatus *VecMat_Append(VecMat vec, Mat mat) -{ +CvStatus *VecMat_Append(VecMat vec, Mat mat) { BEGIN_WRAP vec.ptr->push_back(*mat.ptr); END_WRAP } -CvStatus *VecMat_At(VecMat vec, int i, Mat *rval) -{ +CvStatus *VecMat_At(VecMat vec, int i, Mat *rval) { BEGIN_WRAP *rval = {new cv::Mat(vec.ptr->at(i))}; END_WRAP } -CvStatus *VecMat_Size(VecMat vec, int *rval) -{ +CvStatus *VecMat_Size(VecMat vec, int *rval) { BEGIN_WRAP *rval = static_cast(vec.ptr->size()); END_WRAP } -void VecMat_Close(VecMatPtr vec) -{ +void VecMat_Close(VecMatPtr vec) { vec->ptr->clear(); - CVD_FREE(vec) + CVD_FREE(vec); } -CvStatus *VecRect_New(VecRect *rval) -{ +CvStatus *VecRect_New(VecRect *rval) { BEGIN_WRAP *rval = {new std::vector()}; END_WRAP } -CvStatus *VecRect_NewFromPointer(Rect *rects, int length, VecRect *rval) -{ +CvStatus *VecRect_NewFromPointer(Rect *rects, int length, VecRect *rval) { BEGIN_WRAP std::vector v; for (int i = 0; i < length; i++) { @@ -789,50 +672,43 @@ CvStatus *VecRect_NewFromPointer(Rect *rects, int length, VecRect *rval) END_WRAP } -CvStatus *VecRect_NewFromVec(VecRect vec, VecRect *rval) -{ +CvStatus *VecRect_NewFromVec(VecRect vec, VecRect *rval) { BEGIN_WRAP *rval = {new std::vector(*vec.ptr)}; END_WRAP } -CvStatus *VecRect_At(VecRect vec, int idx, Rect *rval) -{ +CvStatus *VecRect_At(VecRect vec, int idx, Rect *rval) { BEGIN_WRAP auto r = vec.ptr->at(idx); *rval = {r.x, r.y, r.width, r.height}; END_WRAP } -CvStatus *VecRect_Append(VecRect vec, Rect rect) -{ +CvStatus *VecRect_Append(VecRect vec, Rect rect) { BEGIN_WRAP vec.ptr->push_back(cv::Rect(rect.x, rect.y, rect.width, rect.height)); END_WRAP } -CvStatus *VecRect_Size(VecRect vec, int *rval) -{ +CvStatus *VecRect_Size(VecRect vec, int *rval) { BEGIN_WRAP *rval = static_cast(vec.ptr->size()); END_WRAP } -void VecRect_Close(VecRectPtr vec) -{ +void VecRect_Close(VecRectPtr vec) { vec->ptr->clear(); - CVD_FREE(vec) + CVD_FREE(vec); } -CvStatus *VecKeyPoint_New(VecKeyPoint *rval) -{ +CvStatus *VecKeyPoint_New(VecKeyPoint *rval) { BEGIN_WRAP *rval = {new std::vector()}; END_WRAP } -CvStatus *VecKeyPoint_NewFromPointer(KeyPoint *keypoints, int length, VecKeyPoint *rval) -{ +CvStatus *VecKeyPoint_NewFromPointer(KeyPoint *keypoints, int length, VecKeyPoint *rval) { BEGIN_WRAP std::vector v; for (int i = 0; i < length; i++) { @@ -843,50 +719,44 @@ CvStatus *VecKeyPoint_NewFromPointer(KeyPoint *keypoints, int length, VecKeyPoin END_WRAP } -CvStatus *VecKeyPoint_NewFromVec(VecKeyPoint vec, VecKeyPoint *rval) -{ +CvStatus *VecKeyPoint_NewFromVec(VecKeyPoint vec, VecKeyPoint *rval) { BEGIN_WRAP *rval = {new std::vector(*vec.ptr)}; END_WRAP } -CvStatus *VecKeyPoint_Append(VecKeyPoint vec, KeyPoint kp) -{ +CvStatus *VecKeyPoint_Append(VecKeyPoint vec, KeyPoint kp) { BEGIN_WRAP - vec.ptr->push_back(cv::KeyPoint(kp.x, kp.y, kp.size, kp.angle, kp.response, kp.octave, kp.classID)); + vec.ptr->push_back(cv::KeyPoint(kp.x, kp.y, kp.size, kp.angle, kp.response, kp.octave, kp.classID) + ); END_WRAP } -CvStatus *VecKeyPoint_At(VecKeyPoint vec, int idx, KeyPoint *rval) -{ +CvStatus *VecKeyPoint_At(VecKeyPoint vec, int idx, KeyPoint *rval) { BEGIN_WRAP auto kp = vec.ptr->at(idx); *rval = {kp.pt.x, kp.pt.y, kp.size, kp.angle, kp.response, kp.octave, kp.class_id}; END_WRAP } -CvStatus *VecKeyPoint_Size(VecKeyPoint vec, int *rval) -{ +CvStatus *VecKeyPoint_Size(VecKeyPoint vec, int *rval) { BEGIN_WRAP *rval = static_cast(vec.ptr->size()); END_WRAP } -void VecKeyPoint_Close(VecKeyPointPtr vec) -{ +void VecKeyPoint_Close(VecKeyPointPtr vec) { vec->ptr->clear(); - CVD_FREE(vec) + CVD_FREE(vec); } -CvStatus *VecDMatch_New(VecDMatch *rval) -{ +CvStatus *VecDMatch_New(VecDMatch *rval) { BEGIN_WRAP *rval = {new std::vector()}; END_WRAP } -CvStatus *VecDMatch_NewFromPointer(DMatch *matches, int length, VecDMatch *rval) -{ +CvStatus *VecDMatch_NewFromPointer(DMatch *matches, int length, VecDMatch *rval) { BEGIN_WRAP std::vector v; for (int i = 0; i < length; i++) { @@ -897,50 +767,43 @@ CvStatus *VecDMatch_NewFromPointer(DMatch *matches, int length, VecDMatch *rval) END_WRAP } -CvStatus *VecDMatch_NewFromVec(VecDMatch vec, VecDMatch *rval) -{ +CvStatus *VecDMatch_NewFromVec(VecDMatch vec, VecDMatch *rval) { BEGIN_WRAP *rval = {new std::vector(*vec.ptr)}; END_WRAP } -CvStatus *VecDMatch_Append(VecDMatch vec, DMatch dm) -{ +CvStatus *VecDMatch_Append(VecDMatch vec, DMatch dm) { BEGIN_WRAP vec.ptr->push_back(cv::DMatch(dm.queryIdx, dm.trainIdx, dm.imgIdx, dm.distance)); END_WRAP } -CvStatus *VecDMatch_At(VecDMatch vec, int idx, DMatch *rval) -{ +CvStatus *VecDMatch_At(VecDMatch vec, int idx, DMatch *rval) { BEGIN_WRAP auto dm = vec.ptr->at(idx); *rval = {dm.queryIdx, dm.trainIdx, dm.imgIdx, dm.distance}; END_WRAP } -CvStatus *VecDMatch_Size(VecDMatch vec, int *rval) -{ +CvStatus *VecDMatch_Size(VecDMatch vec, int *rval) { BEGIN_WRAP *rval = static_cast(vec.ptr->size()); END_WRAP } -void VecDMatch_Close(VecDMatchPtr vec) -{ +void VecDMatch_Close(VecDMatchPtr vec) { vec->ptr->clear(); - CVD_FREE(vec) + CVD_FREE(vec); } -CvStatus *VecVecDMatch_New(VecVecDMatch *rval) -{ +CvStatus *VecVecDMatch_New(VecVecDMatch *rval) { BEGIN_WRAP *rval = {new std::vector>()}; END_WRAP } -CvStatus *VecVecDMatch_NewFromPointer(VecDMatch *matches, int length, VecVecDMatch *rval) -{ +CvStatus *VecVecDMatch_NewFromPointer(VecDMatch *matches, int length, VecVecDMatch *rval) { BEGIN_WRAP std::vector> v; for (int i = 0; i < length; i++) { @@ -951,43 +814,157 @@ CvStatus *VecVecDMatch_NewFromPointer(VecDMatch *matches, int length, VecVecDMat END_WRAP } -CvStatus *VecVecDMatch_NewFromVec(VecVecDMatch vec, VecVecDMatch *rval) -{ +CvStatus *VecVecDMatch_NewFromVec(VecVecDMatch vec, VecVecDMatch *rval) { BEGIN_WRAP *rval = {new std::vector>(*vec.ptr)}; END_WRAP } -CvStatus *VecVecDMatch_At(VecVecDMatch vec, int idx, VecDMatch *rval) -{ +CvStatus *VecVecDMatch_At(VecVecDMatch vec, int idx, VecDMatch *rval) { BEGIN_WRAP *rval = {new std::vector(vec.ptr->at(idx))}; END_WRAP } -CvStatus *VecVecDMatch_Data(VecVecDMatch vec, VecDMatch **rval) -{ +CvStatus *VecVecDMatch_Data(VecVecDMatch vec, VecDMatch **rval) { BEGIN_WRAP *rval = {new VecDMatch{vec.ptr->data()}}; END_WRAP } -CvStatus *VecVecDMatch_Append(VecVecDMatch vec, VecDMatch dm) -{ +CvStatus *VecVecDMatch_Append(VecVecDMatch vec, VecDMatch dm) { BEGIN_WRAP vec.ptr->push_back(*dm.ptr); END_WRAP } -CvStatus *VecVecDMatch_Size(VecVecDMatch vec, int *rval) -{ +CvStatus *VecVecDMatch_Size(VecVecDMatch vec, int *rval) { + BEGIN_WRAP + *rval = static_cast(vec.ptr->size()); + END_WRAP +} + +void VecVecDMatch_Close(VecVecDMatchPtr vec) { + vec->ptr->clear(); + CVD_FREE(vec); +} + +CvStatus *VecVec4i_New(VecVec4i *rval) { + BEGIN_WRAP + *rval = {new std::vector()}; + END_WRAP +} + +CvStatus *VecVec4i_NewFromPointer(Vec4i *data, int length, VecVec4i *rval) { + BEGIN_WRAP + std::vector vec; + for (int i = 0; i < length; i++) { + Vec4i v = data[i]; + vec.push_back(cv::Vec4i(v.val1, v.val2, v.val3, v.val4)); + } + *rval = {new std::vector(vec)}; + END_WRAP +} + +// CvStatus *VecVec4i_NewFromVec(VecVec4i vec, VecVec4i *rval) +// { +// BEGIN_WRAP +// END_WRAP +// } + +CvStatus *VecVec4i_At(VecVec4i vec, int idx, Vec4i *rval) { + BEGIN_WRAP + cv::Vec4i v = vec.ptr->at(idx); + *rval = {v.val[0], v.val[1], v.val[2], v.val[3]}; + END_WRAP +} +CvStatus *VecVec4i_Append(VecVec4i vec, Vec4i v) { + BEGIN_WRAP + vec.ptr->push_back(cv::Vec4i(v.val1, v.val2, v.val3, v.val4)); + END_WRAP +} +CvStatus *VecVec4i_Size(VecVec4i vec, int *rval) { + BEGIN_WRAP + *rval = static_cast(vec.ptr->size()); + END_WRAP +} +void VecVec4i_Close(VecVec4iPtr vec) { + vec->ptr->clear(); + CVD_FREE(vec); +} + +CvStatus *VecVec4f_New(VecVec4f *rval) { + BEGIN_WRAP + *rval = {new std::vector()}; + END_WRAP +} +CvStatus *VecVec4f_NewFromPointer(Vec4f *data, int length, VecVec4f *rval) { + BEGIN_WRAP + std::vector vec; + for (int i = 0; i < length; i++) { + Vec4f v = data[i]; + vec.push_back(cv::Vec4f(v.val1, v.val2, v.val3, v.val4)); + } + *rval = {new std::vector(vec)}; + END_WRAP +} +// CvStatus VecVec4f_NewFromVec(VecVec4f vec, VecVec4f *rval); +CvStatus *VecVec4f_At(VecVec4f vec, int idx, Vec4f *rval) { + BEGIN_WRAP + cv::Vec4f v = vec.ptr->at(idx); + *rval = {v.val[0], v.val[1], v.val[2], v.val[3]}; + END_WRAP +} +// CvStatus VecVec4f_Data(VecVec4f vec, Vec4f **rval){} +CvStatus *VecVec4f_Append(VecVec4f vec, Vec4f v) { + BEGIN_WRAP + vec.ptr->push_back(cv::Vec4f(v.val1, v.val2, v.val3, v.val4)); + END_WRAP +} +CvStatus *VecVec4f_Size(VecVec4f vec, int *rval) { BEGIN_WRAP *rval = static_cast(vec.ptr->size()); END_WRAP } +void VecVec4f_Close(VecVec4fPtr vec) { + vec->ptr->clear(); + CVD_FREE(vec); +} -void VecVecDMatch_Close(VecVecDMatchPtr vec) -{ +CvStatus *VecVec6f_New(VecVec6f *rval) { + BEGIN_WRAP + *rval = {new std::vector()}; + END_WRAP +} +CvStatus *VecVec6f_NewFromPointer(Vec6f *data, int length, VecVec6f *rval) { + BEGIN_WRAP + std::vector vec; + for (int i = 0; i < length; i++) { + Vec6f v = data[i]; + vec.push_back(cv::Vec6f(v.val1, v.val2, v.val3, v.val4, v.val5, v.val6)); + } + *rval = {new std::vector(vec)}; + END_WRAP +} +// CvStatus VecVec6f_NewFromVec(VecVec6f vec, VecVec6f *rval); +CvStatus *VecVec6f_At(VecVec6f vec, int idx, Vec6f *rval) { + BEGIN_WRAP + cv::Vec6f v = vec.ptr->at(idx); + *rval = {v.val[0], v.val[1], v.val[2], v.val[3], v.val[4], v.val[5]}; + END_WRAP +} +// CvStatus VecVec6f_Data(VecVec6f vec, Vec6f **rval); +CvStatus *VecVec6f_Append(VecVec6f vec, Vec6f v) { + BEGIN_WRAP + vec.ptr->push_back(cv::Vec6f(v.val1, v.val2, v.val3, v.val4, v.val5, v.val6)); + END_WRAP +} +CvStatus *VecVec6f_Size(VecVec6f vec, int *rval) { + BEGIN_WRAP + *rval = static_cast(vec.ptr->size()); + END_WRAP +} +void VecVec6f_Close(VecVec6fPtr vec) { vec->ptr->clear(); - CVD_FREE(vec) + CVD_FREE(vec); } diff --git a/src/core/vec.h b/src/core/vec.h index dd9cb0ca..28c9e3f9 100644 --- a/src/core/vec.h +++ b/src/core/vec.h @@ -22,7 +22,7 @@ CvStatus *VecPoint_At(VecPoint vec, int idx, Point *rval); // CvStatus *VecPoint_Data(VecPoint vec, Point **rval); CvStatus *VecPoint_Append(VecPoint vec, Point p); CvStatus *VecPoint_Size(VecPoint vec, int *rval); -void VecPoint_Close(VecPointPtr vec); +void VecPoint_Close(VecPointPtr vec); CvStatus *VecVecPoint_New(VecVecPoint *rval); CvStatus *VecVecPoint_NewFromPointer(VecPoint *points, int length, VecVecPoint *rval); @@ -31,7 +31,7 @@ CvStatus *VecVecPoint_At(VecVecPoint vec, int idx, VecPoint *rval); // CvStatus *VecVecPoint_Data(VecVecPoint vec, VecPoint **rval); CvStatus *VecVecPoint_Append(VecVecPoint vec, VecPoint pv); CvStatus *VecVecPoint_Size(VecVecPoint vec, int *rval); -void VecVecPoint_Close(VecVecPointPtr vec); +void VecVecPoint_Close(VecVecPointPtr vec); CvStatus *VecPoint2f_New(VecPoint2f *rval); CvStatus *VecPoint2f_NewFromPointer(Point2f *pts, int length, VecPoint2f *rval); @@ -41,7 +41,7 @@ CvStatus *VecPoint2f_At(VecPoint2f vec, int idx, Point2f *rval); // CvStatus *VecPoint2f_Data(VecPoint2f vec, Point2f **rval); CvStatus *VecPoint2f_Append(VecPoint2f vec, Point2f p); CvStatus *VecPoint2f_Size(VecPoint2f vec, int *rval); -void VecPoint2f_Close(VecPoint2fPtr vec); +void VecPoint2f_Close(VecPoint2fPtr vec); CvStatus *VecVecPoint2f_New(VecVecPoint2f *rval); CvStatus *VecVecPoint2f_NewFromPointer(VecPoint2f *points, int length, VecVecPoint2f *rval); @@ -50,7 +50,7 @@ CvStatus *VecVecPoint2f_Size(VecVecPoint2f vec, int *rval); CvStatus *VecVecPoint2f_At(VecVecPoint2f vec, int idx, VecPoint2f *rval); // CvStatus *VecVecPoint2f_Data(VecVecPoint2f vec, VecPoint2f **rval); CvStatus *VecVecPoint2f_Append(VecVecPoint2f vec, VecPoint2f pv); -void VecVecPoint2f_Close(VecVecPoint2fPtr vec); +void VecVecPoint2f_Close(VecVecPoint2fPtr vec); CvStatus *VecPoint3f_New(VecPoint3f *rval); CvStatus *VecPoint3f_NewFromPointer(Point3f *points, int length, VecPoint3f *rval); @@ -60,7 +60,7 @@ CvStatus *VecPoint3f_Append(VecPoint3f vec, Point3f point); CvStatus *VecPoint3f_At(VecPoint3f vec, int idx, Point3f *rval); // CvStatus *VecPoint3f_Data(VecPoint3f vec, Point3f **rval); CvStatus *VecPoint3f_Size(VecPoint3f vec, int *rval); -void VecPoint3f_Close(VecPoint3fPtr vec); +void VecPoint3f_Close(VecPoint3fPtr vec); CvStatus *VecVecPoint3f_New(VecVecPoint3f *rval); CvStatus *VecVecPoint3f_NewFromPointer(VecPoint3f *points, int length, VecVecPoint3f *rval); @@ -69,7 +69,7 @@ CvStatus *VecVecPoint3f_Size(VecVecPoint3f vec, int *rval); CvStatus *VecVecPoint3f_At(VecVecPoint3f vec, int idx, VecPoint3f *rval); // CvStatus *VecVecPoint3f_Data(VecVecPoint3f vec, VecPoint3f **rval); CvStatus *VecVecPoint3f_Append(VecVecPoint3f vec, VecPoint3f pv); -void VecVecPoint3f_Close(VecVecPoint3fPtr vec); +void VecVecPoint3f_Close(VecVecPoint3fPtr vec); CvStatus *VecUChar_New(VecUChar *rval); CvStatus *VecUChar_NewFromPointer(uchar *p, int length, VecUChar *rval); @@ -79,7 +79,7 @@ CvStatus *VecUChar_At(VecUChar vec, int idx, uchar *rval); CvStatus *VecUChar_Data(VecUChar vec, uchar **rval); CvStatus *VecUChar_AtNoBoundCheck(VecUChar vec, int idx, uchar *rval); CvStatus *VecUChar_Size(VecUChar vec, int *rval); -void VecUChar_Close(VecUCharPtr vec); +void VecUChar_Close(VecUCharPtr vec); CvStatus *VecChar_New(VecChar *rval); CvStatus *VecChar_NewFromPointer(const char *p, int length, VecChar *rval); @@ -89,7 +89,7 @@ CvStatus *VecChar_At(VecChar vec, int idx, char *rval); CvStatus *VecChar_Data(VecChar vec, char **rval); CvStatus *VecChar_Size(VecChar vec, int *rval); CvStatus *VecChar_ToString(VecChar vec, char **rval, int *length); -void VecChar_Close(VecCharPtr vec); +void VecChar_Close(VecCharPtr vec); CvStatus *VecVecChar_New(VecVecChar *rval); CvStatus *VecVecChar_NewFromVec(VecVecChar vec, VecVecChar *rval); @@ -99,7 +99,7 @@ CvStatus *VecVecChar_At(VecVecChar vec, int idx, VecChar *rval); // CvStatus *VecVecChar_Data(VecVecChar vec, VecChar **rval); CvStatus *VecVecChar_At_Str(VecVecChar vec, int idx, char **rval, int *length); CvStatus *VecVecChar_Size(VecVecChar vec, int *rval); -void VecVecChar_Close(VecVecCharPtr vec); +void VecVecChar_Close(VecVecCharPtr vec); CvStatus *VecInt_New(VecInt *rval); /** @@ -112,7 +112,7 @@ CvStatus *VecInt_At(VecInt vec, int idx, int *rval); CvStatus *VecInt_AtNoBoundCheck(VecInt vec, int idx, int *rval); CvStatus *VecInt_Data(VecInt vec, int **rval); CvStatus *VecInt_Size(VecInt vec, int *rval); -void VecInt_Close(VecIntPtr vec); +void VecInt_Close(VecIntPtr vec); CvStatus *VecFloat_New(VecFloat *rval); CvStatus *VecFloat_NewFromPointer(float *p, int length, VecFloat *rval); @@ -121,7 +121,7 @@ CvStatus *VecFloat_Append(VecFloat vec, float f); CvStatus *VecFloat_At(VecFloat vec, int idx, float *rval); CvStatus *VecFloat_Data(VecFloat vec, float **rval); CvStatus *VecFloat_Size(VecFloat vec, int *rval); -void VecFloat_Close(VecFloatPtr vec); +void VecFloat_Close(VecFloatPtr vec); CvStatus *VecDouble_New(VecDouble *rval); CvStatus *VecDouble_NewFromPointer(double *p, int length, VecDouble *rval); @@ -130,7 +130,7 @@ CvStatus *VecDouble_Append(VecDouble vec, double d); CvStatus *VecDouble_At(VecDouble vec, int idx, double *rval); CvStatus *VecDouble_Data(VecDouble vec, double **rval); CvStatus *VecDouble_Size(VecDouble vec, int *rval); -void VecDouble_Close(VecDoublePtr vec); +void VecDouble_Close(VecDoublePtr vec); CvStatus *VecMat_New(VecMat *rval); CvStatus *VecMat_NewFromPointer(Mat *mats, int length, VecMat *rval); @@ -139,7 +139,7 @@ CvStatus *VecMat_Append(VecMat vec, Mat mat); CvStatus *VecMat_At(VecMat vec, int i, Mat *rval); // CvStatus *VecMat_Data(VecMat vec, Mat **rval); CvStatus *VecMat_Size(VecMat vec, int *rval); -void VecMat_Close(VecMatPtr vec); +void VecMat_Close(VecMatPtr vec); CvStatus *VecRect_New(VecRect *rval); CvStatus *VecRect_NewFromPointer(Rect *rects, int length, VecRect *rval); @@ -148,7 +148,7 @@ CvStatus *VecRect_At(VecRect vec, int idx, Rect *rval); // CvStatus *VecRect_Data(VecRect vec, Rect **rval); CvStatus *VecRect_Append(VecRect vec, Rect rect); CvStatus *VecRect_Size(VecRect vec, int *rval); -void VecRect_Close(VecRectPtr vec); +void VecRect_Close(VecRectPtr vec); CvStatus *VecKeyPoint_New(VecKeyPoint *rval); CvStatus *VecKeyPoint_NewFromPointer(KeyPoint *keypoints, int length, VecKeyPoint *rval); @@ -157,7 +157,7 @@ CvStatus *VecKeyPoint_Append(VecKeyPoint vec, KeyPoint kp); CvStatus *VecKeyPoint_At(VecKeyPoint vec, int idx, KeyPoint *rval); // CvStatus *VecKeyPoint_Data(VecKeyPoint vec, KeyPoint **rval); CvStatus *VecKeyPoint_Size(VecKeyPoint vec, int *rval); -void VecKeyPoint_Close(VecKeyPointPtr vec); +void VecKeyPoint_Close(VecKeyPointPtr vec); CvStatus *VecDMatch_New(VecDMatch *rval); CvStatus *VecDMatch_NewFromPointer(DMatch *matches, int length, VecDMatch *rval); @@ -166,7 +166,7 @@ CvStatus *VecDMatch_Append(VecDMatch vec, DMatch dm); CvStatus *VecDMatch_At(VecDMatch vec, int idx, DMatch *rval); // CvStatus *VecDMatch_Data(VecDMatch vec, DMatch **rval); CvStatus *VecDMatch_Size(VecDMatch vec, int *rval); -void VecDMatch_Close(VecDMatchPtr vec); +void VecDMatch_Close(VecDMatchPtr vec); CvStatus *VecVecDMatch_New(VecVecDMatch *rval); CvStatus *VecVecDMatch_NewFromPointer(VecDMatch *matches, int length, VecVecDMatch *rval); @@ -175,7 +175,34 @@ CvStatus *VecVecDMatch_At(VecVecDMatch vec, int idx, VecDMatch *rval); CvStatus *VecVecDMatch_Data(VecVecDMatch vec, VecDMatch **rval); CvStatus *VecVecDMatch_Append(VecVecDMatch vec, VecDMatch dm); CvStatus *VecVecDMatch_Size(VecVecDMatch vec, int *rval); -void VecVecDMatch_Close(VecVecDMatchPtr vec); +void VecVecDMatch_Close(VecVecDMatchPtr vec); + +CvStatus *VecVec4i_New(VecVec4i *rval); +CvStatus *VecVec4i_NewFromPointer(Vec4i *data, int length, VecVec4i *rval); +// CvStatus VecVec4i_NewFromVec(VecVec4i vec, VecVec4i *rval); +CvStatus *VecVec4i_At(VecVec4i vec, int idx, Vec4i *rval); +// CvStatus VecVec4i_Data(VecVec4i vec, Vec4i **rval); +CvStatus *VecVec4i_Append(VecVec4i vec, Vec4i v); +CvStatus *VecVec4i_Size(VecVec4i vec, int *rval); +void VecVec4i_Close(VecVec4iPtr vec); + +CvStatus *VecVec4f_New(VecVec4f *rval); +CvStatus *VecVec4f_NewFromPointer(Vec4f *data, int length, VecVec4f *rval); +// CvStatus VecVec4f_NewFromVec(VecVec4f vec, VecVec4f *rval); +CvStatus *VecVec4f_At(VecVec4f vec, int idx, Vec4f *rval); +// CvStatus VecVec4f_Data(VecVec4f vec, Vec4f **rval); +CvStatus *VecVec4f_Append(VecVec4f vec, Vec4f v); +CvStatus *VecVec4f_Size(VecVec4f vec, int *rval); +void VecVec4f_Close(VecVec4fPtr vec); + +CvStatus *VecVec6f_New(VecVec6f *rval); +CvStatus *VecVec6f_NewFromPointer(Vec6f *data, int length, VecVec6f *rval); +// CvStatus VecVec6f_NewFromVec(VecVec6f vec, VecVec6f *rval); +CvStatus *VecVec6f_At(VecVec6f vec, int idx, Vec6f *rval); +// CvStatus VecVec6f_Data(VecVec6f vec, Vec6f **rval); +CvStatus *VecVec6f_Append(VecVec6f vec, Vec6f v); +CvStatus *VecVec6f_Size(VecVec6f vec, int *rval); +void VecVec6f_Close(VecVec6fPtr vec); #ifdef __cplusplus } diff --git a/src/core/version.cpp b/src/core/version.cpp index dfcd942b..b1fa2f0d 100644 --- a/src/core/version.cpp +++ b/src/core/version.cpp @@ -7,17 +7,29 @@ */ #include "version.h" +#include -CvStatus *openCVVersion(const char **rval) -{ +CvStatus *openCVVersion(const char **rval) { BEGIN_WRAP *rval = CV_VERSION; END_WRAP } -CvStatus *getBuildInfo(const char **rval) -{ +CvStatus *openCVVersion_Async(CvCallback_1 callback) { + BEGIN_WRAP + callback(new char *(strdup(CV_VERSION))); + END_WRAP +} + +CvStatus *getBuildInfo(const char **rval) { BEGIN_WRAP *rval = cv::getBuildInformation().c_str(); END_WRAP } + +CvStatus *getBuildInfo_Async(CvCallback_1 callback) { + BEGIN_WRAP + const char *info = cv::getBuildInformation().c_str(); + callback(new char *(strdup(info))); + END_WRAP +} diff --git a/src/core/version.h b/src/core/version.h index f6ee58cd..4637c583 100644 --- a/src/core/version.h +++ b/src/core/version.h @@ -14,10 +14,13 @@ extern "C" { #endif -#include "core.h" +#include "core/types.h" CvStatus *openCVVersion(const char **rval); +CvStatus *openCVVersion_Async(CvCallback_1 callback); + CvStatus *getBuildInfo(const char **rval); +CvStatus *getBuildInfo_Async(CvCallback_1 callback); #ifdef __cplusplus } diff --git a/src/dnn/asyncarray.cpp b/src/dnn/asyncarray.cpp index 0696499d..e21e51e9 100644 --- a/src/dnn/asyncarray.cpp +++ b/src/dnn/asyncarray.cpp @@ -18,7 +18,7 @@ CvStatus *AsyncArray_New(AsyncArray *rval) } // AsyncArray_Close deletes an existing AsyncArray -void AsyncArray_Close(AsyncArrayPtr a){CVD_FREE(a)} +void AsyncArray_Close(AsyncArrayPtr a) { CVD_FREE(a); } CvStatus *AsyncArray_Get(AsyncArray async_out, Mat out) { diff --git a/src/dnn/asyncarray.h b/src/dnn/asyncarray.h index 3c5dba03..1ebc112d 100644 --- a/src/dnn/asyncarray.h +++ b/src/dnn/asyncarray.h @@ -16,7 +16,7 @@ extern "C" { #ifdef __cplusplus CVD_TYPEDEF(cv::AsyncArray, AsyncArray); #else -CVD_TYPEDEF(void, AsyncArray) +CVD_TYPEDEF(void, AsyncArray); #endif CvStatus *AsyncArray_New(AsyncArray *rval); diff --git a/src/dnn/dnn.cpp b/src/dnn/dnn.cpp index 09fcf07f..5a6be72f 100644 --- a/src/dnn/dnn.cpp +++ b/src/dnn/dnn.cpp @@ -89,7 +89,7 @@ CvStatus *Net_ReadNetFromONNXBytes(VecUChar model, Net *rval) END_WRAP } -void Net_Close(NetPtr net){CVD_FREE(net)} +void Net_Close(NetPtr net) { CVD_FREE(net); } CvStatus *Net_BlobFromImage(Mat image, Mat blob, double scalefactor, Size size, Scalar mean, bool swapRB, bool crop, int ddepth) @@ -279,7 +279,7 @@ CvStatus *Layer_GetType(Layer layer, char **rval) void Layer_Close(LayerPtr layer) { layer->ptr->reset(); - CVD_FREE(layer) + CVD_FREE(layer); } CvStatus *NMSBoxes(VecRect bboxes, VecFloat scores, float score_threshold, float nms_threshold, diff --git a/src/dnn/dnn.h b/src/dnn/dnn.h index 7a923f53..7e6430d2 100644 --- a/src/dnn/dnn.h +++ b/src/dnn/dnn.h @@ -20,11 +20,11 @@ extern "C" { #include "core/core.h" #ifdef __cplusplus -CVD_TYPEDEF(cv::dnn::Net, Net) -CVD_TYPEDEF(cv::Ptr, Layer) +CVD_TYPEDEF(cv::dnn::Net, Net); +CVD_TYPEDEF(cv::Ptr, Layer); #else -CVD_TYPEDEF(void, Net) -CVD_TYPEDEF(void, Layer) +CVD_TYPEDEF(void, Net); +CVD_TYPEDEF(void, Layer); #endif CvStatus *Net_Create(CVD_OUT Net *rval); diff --git a/src/dnn/dnn_async.cpp b/src/dnn/dnn_async.cpp new file mode 100644 index 00000000..e61b654d --- /dev/null +++ b/src/dnn/dnn_async.cpp @@ -0,0 +1,314 @@ +#include "dnn_async.h" +#include "core/types.h" + +// Asynchronous functions for Net +CvStatus *Net_Create_Async(CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new Net{new cv::dnn::Net()}); + END_WRAP +} + +CvStatus *Net_FromNet_Async(Net net, CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new Net{new cv::dnn::Net(*net.ptr)}); + END_WRAP +} + +CvStatus *Net_ReadNet_Async(const char *model, const char *config, const char *framework, CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new Net{new cv::dnn::Net(cv::dnn::readNet(model, config, framework))}); + END_WRAP +} + +CvStatus *Net_ReadNetBytes_Async(const char *framework, VecUChar model, VecUChar config, CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new Net{new cv::dnn::Net(cv::dnn::readNet(framework, *model.ptr, *config.ptr))}); + END_WRAP +} + +CvStatus *Net_ReadNetFromCaffe_Async(const char *prototxt, const char *caffeModel, CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new Net{new cv::dnn::Net(cv::dnn::readNetFromCaffe(prototxt, caffeModel))}); + END_WRAP +} + +CvStatus *Net_ReadNetFromCaffeBytes_Async(VecUChar prototxt, VecUChar caffeModel, CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new Net{new cv::dnn::Net(cv::dnn::readNetFromCaffe(*prototxt.ptr, *caffeModel.ptr))}); + END_WRAP +} + +CvStatus *Net_ReadNetFromTensorflow_Async(const char *model, const char *config, CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new Net{new cv::dnn::Net(cv::dnn::readNetFromTensorflow(model, config))}); + END_WRAP +} + +CvStatus *Net_ReadNetFromTensorflowBytes_Async(VecUChar model, VecUChar config, CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new Net{new cv::dnn::Net(cv::dnn::readNetFromTensorflow(*model.ptr, *config.ptr))}); + END_WRAP +} + +CvStatus *Net_ReadNetFromTFLite_Async(const char *model, CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new Net{new cv::dnn::Net(cv::dnn::readNetFromTFLite(model))}); + END_WRAP +} + +CvStatus *Net_ReadNetFromTFLiteBytes_Async(VecUChar bufferModel, CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new Net{new cv::dnn::Net(cv::dnn::readNetFromTFLite(*bufferModel.ptr))}); + END_WRAP +} + +CvStatus *Net_ReadNetFromTorch_Async(const char *model, bool isBinary, bool evaluate, CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new Net{new cv::dnn::Net(cv::dnn::readNetFromTorch(model, isBinary, evaluate))}); + END_WRAP +} + +CvStatus *Net_ReadNetFromONNX_Async(const char *model, CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new Net{new cv::dnn::Net(cv::dnn::readNetFromONNX(model))}); + END_WRAP +} + +CvStatus *Net_ReadNetFromONNXBytes_Async(VecUChar model, CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new Net{new cv::dnn::Net(cv::dnn::readNetFromONNX(*model.ptr))}); + END_WRAP +} + +void Net_Close_Async(NetPtr net, CvCallback_0 callback) +{ + CVD_FREE(net); + callback(); +} + +CvStatus *Net_BlobFromImage_Async(Mat image, double scalefactor, Size size, Scalar mean, bool swapRB, bool crop, int ddepth, CvCallback_1 callback) +{ + BEGIN_WRAP + cv::Size sz(size.width, size.height); + cv::Scalar cm(mean.val1, mean.val2, mean.val3, mean.val4); + Mat *blob = new Mat{new cv::Mat()}; + cv::dnn::blobFromImage(*image.ptr, *blob->ptr, scalefactor, sz, cm, swapRB, crop, ddepth); + callback(blob); + END_WRAP +} + +CvStatus *Net_BlobFromImages_Async(VecMat images, double scalefactor, Size size, Scalar mean, bool swapRB, bool crop, int ddepth, CvCallback_1 callback) +{ + BEGIN_WRAP + cv::Size sz(size.width, size.height); + cv::Scalar cm = cv::Scalar(mean.val1, mean.val2, mean.val3, mean.val4); + Mat *blob = new Mat{new cv::Mat()}; + cv::dnn::blobFromImages(*images.ptr, *blob->ptr, scalefactor, sz, cm, swapRB, crop, ddepth); + callback(blob); + END_WRAP +} + +CvStatus *Net_ImagesFromBlob_Async(Mat blob, CvCallback_1 callback) +{ + BEGIN_WRAP + std::vector imgs; + cv::dnn::imagesFromBlob(*blob.ptr, imgs); + callback(new VecMat{new std::vector(imgs)}); + END_WRAP +} + +CvStatus *Net_Empty_Async(Net net, CvCallback_1 callback) +{ + BEGIN_WRAP + bool rval = net.ptr->empty(); + callback(new bool(rval)); + END_WRAP +} + +CvStatus *Net_Dump_Async(Net net, CvCallback_1 callback) +{ + BEGIN_WRAP + auto ss = net.ptr->dump(); + callback(new char *(strdup(ss.c_str()))); + END_WRAP +} + +CvStatus *Net_SetInput_Async(Net net, Mat blob, const char *name, CvCallback_0 callback) +{ + BEGIN_WRAP + net.ptr->setInput(*blob.ptr, name); + callback(); + END_WRAP +} + +CvStatus *Net_Forward_Async(Net net, const char *outputName, CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new Mat{new cv::Mat(net.ptr->forward(outputName))}); + END_WRAP +} + +CvStatus *Net_ForwardLayers_Async(Net net, VecVecChar outBlobNames, CvCallback_1 callback) +{ + BEGIN_WRAP + std::vector blobs; + std::vector names; + for (int i = 0; i < outBlobNames.ptr->size(); ++i) + { + auto n = outBlobNames.ptr->at(i); + names.push_back(cv::String(n.begin(), n.end())); + } + net.ptr->forward(blobs, names); + callback(new VecMat{new std::vector(blobs)}); + END_WRAP +} + +CvStatus *Net_SetPreferableBackend_Async(Net net, int backend, CvCallback_0 callback) +{ + BEGIN_WRAP + net.ptr->setPreferableBackend(backend); + callback(); + END_WRAP +} + +CvStatus *Net_SetPreferableTarget_Async(Net net, int target, CvCallback_0 callback) +{ + BEGIN_WRAP + net.ptr->setPreferableTarget(target); + callback(); + END_WRAP +} + +CvStatus *Net_GetPerfProfile_Async(Net net, CvCallback_1 callback) +{ + BEGIN_WRAP + std::vector layersTimes; + int64_t rval = net.ptr->getPerfProfile(layersTimes); + callback(new int64_t(rval)); + END_WRAP +} + +CvStatus *Net_GetUnconnectedOutLayers_Async(Net net, CvCallback_1 callback) +{ + BEGIN_WRAP + std::vector layers = net.ptr->getUnconnectedOutLayers(); + callback(new VecInt{new std::vector(layers)}); + END_WRAP +} + +CvStatus *Net_GetLayerNames_Async(Net net, CvCallback_1 callback) +{ + BEGIN_WRAP + std::vector> vec; + std::vector cstrs = net.ptr->getLayerNames(); + for (size_t i = 0; i < cstrs.size(); i++) + { + std::vector cstr(cstrs[i].begin(), cstrs[i].end()); + vec.push_back(cstr); + } + callback(new VecVecChar{new std::vector>(vec)}); + END_WRAP +} + +CvStatus *Net_GetInputDetails_Async(Net net, CvCallback_2 callback) +{ + BEGIN_WRAP + std::vector sc; + std::vector zp; + net.ptr->getInputDetails(sc, zp); + callback(new VecFloat{new std::vector(sc)}, new VecInt{new std::vector(zp)}); + END_WRAP +} + +CvStatus *Net_GetBlobChannel_Async(Mat blob, int imgidx, int chnidx, CvCallback_1 callback) +{ + BEGIN_WRAP + size_t w = blob.ptr->size[3]; + size_t h = blob.ptr->size[2]; + callback(new Mat{new cv::Mat(h, w, CV_32F, blob.ptr->ptr(imgidx, chnidx))}); + END_WRAP +} + +CvStatus *Net_GetBlobSize_Async(Mat blob, CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new Scalar{(double)(blob.ptr->size[0]), (double)(blob.ptr->size[1]), (double)(blob.ptr->size[2]), (double)(blob.ptr->size[3])}); + END_WRAP +} + +CvStatus *Net_GetLayer_Async(Net net, int layerid, CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new Layer{new cv::Ptr(net.ptr->getLayer(layerid))}); + END_WRAP +} + +CvStatus *Layer_InputNameToIndex_Async(Layer layer, const char *name, CvCallback_1 callback) +{ + BEGIN_WRAP + int rval = (*layer.ptr)->inputNameToIndex(name); + callback(new int(rval)); + END_WRAP +} + +CvStatus *Layer_OutputNameToIndex_Async(Layer layer, const char *name, CvCallback_1 callback) +{ + BEGIN_WRAP + int rval = (*layer.ptr)->outputNameToIndex(name); + callback(new int(rval)); + END_WRAP +} + +CvStatus *Layer_GetName_Async(Layer layer, CvCallback_1 callback) +{ + BEGIN_WRAP + auto ss = (*layer.ptr)->name; + callback(new char *(strdup(ss.c_str()))); + END_WRAP +} + +CvStatus *Layer_GetType_Async(Layer layer, CvCallback_1 callback) +{ + BEGIN_WRAP + auto ss = (*layer.ptr)->type; + callback(new char *(strdup(ss.c_str()))); + END_WRAP +} + +void Layer_Close_Async(LayerPtr layer, CvCallback_0 callback) +{ + layer->ptr->reset(); + CVD_FREE(layer); + callback(); +} + +CvStatus *NMSBoxes_Async(VecRect bboxes, VecFloat scores, float score_threshold, float nms_threshold, CvCallback_1 callback) +{ + BEGIN_WRAP + std::vector v; + cv::dnn::NMSBoxes(*bboxes.ptr, *scores.ptr, score_threshold, nms_threshold, v, 1.f, 0); + callback(new VecInt{new std::vector(v)}); + END_WRAP +} + +CvStatus *NMSBoxesWithParams_Async(VecRect bboxes, VecFloat scores, const float score_threshold, const float nms_threshold, const float eta, const int top_k, CvCallback_1 callback) +{ + BEGIN_WRAP + std::vector v; + cv::dnn::NMSBoxes(*bboxes.ptr, *scores.ptr, score_threshold, nms_threshold, v, eta, top_k); + callback(new VecInt{new std::vector(v)}); + END_WRAP +} diff --git a/src/dnn/dnn_async.h b/src/dnn/dnn_async.h new file mode 100644 index 00000000..5de32dc6 --- /dev/null +++ b/src/dnn/dnn_async.h @@ -0,0 +1,58 @@ +#ifndef CVD_DNN_ASYNC_H_ +#define CVD_DNN_ASYNC_H_ + +#include "dnn.h" +#include "core/types.h" +#include + +#ifdef __cplusplus +#include +#include +extern "C" { +#endif + +// Asynchronous functions for Net +CvStatus *Net_Create_Async(CvCallback_1 callback); +CvStatus *Net_FromNet_Async(Net net, CvCallback_1 callback); +CvStatus *Net_ReadNet_Async(const char *model, const char *config, const char *framework, CvCallback_1 callback); +CvStatus *Net_ReadNetBytes_Async(const char *framework, VecUChar model, VecUChar config, CvCallback_1 callback); +CvStatus *Net_ReadNetFromCaffe_Async(const char *prototxt, const char *caffeModel, CvCallback_1 callback); +CvStatus *Net_ReadNetFromCaffeBytes_Async(VecUChar prototxt, VecUChar caffeModel, CvCallback_1 callback); +CvStatus *Net_ReadNetFromTensorflow_Async(const char *model, const char *config, CvCallback_1 callback); +CvStatus *Net_ReadNetFromTensorflowBytes_Async(VecUChar model, VecUChar config, CvCallback_1 callback); +CvStatus *Net_ReadNetFromTFLite_Async(const char *model, CvCallback_1 callback); +CvStatus *Net_ReadNetFromTFLiteBytes_Async(VecUChar bufferModel, CvCallback_1 callback); +CvStatus *Net_ReadNetFromTorch_Async(const char *model, bool isBinary, bool evaluate, CvCallback_1 callback); +CvStatus *Net_ReadNetFromONNX_Async(const char *model, CvCallback_1 callback); +CvStatus *Net_ReadNetFromONNXBytes_Async(VecUChar model, CvCallback_1 callback); +void Net_Close_Async(NetPtr net, CvCallback_0 callback); +CvStatus *Net_BlobFromImage_Async(Mat image, double scalefactor, Size size, Scalar mean, bool swapRB, bool crop, int ddepth, CvCallback_1 callback); +CvStatus *Net_BlobFromImages_Async(VecMat images, double scalefactor, Size size, Scalar mean, bool swapRB, bool crop, int ddepth, CvCallback_1 callback); +CvStatus *Net_ImagesFromBlob_Async(Mat blob, CvCallback_1 callback); +CvStatus *Net_Empty_Async(Net net, CvCallback_1 callback); +CvStatus *Net_Dump_Async(Net net, CvCallback_1 callback); +CvStatus *Net_SetInput_Async(Net net, Mat blob, const char *name, CvCallback_0 callback); +CvStatus *Net_Forward_Async(Net net, const char *outputName, CvCallback_1 callback); +CvStatus *Net_ForwardLayers_Async(Net net, VecVecChar outBlobNames, CvCallback_1 callback); +CvStatus *Net_SetPreferableBackend_Async(Net net, int backend, CvCallback_0 callback); +CvStatus *Net_SetPreferableTarget_Async(Net net, int target, CvCallback_0 callback); +CvStatus *Net_GetPerfProfile_Async(Net net, CvCallback_1 callback); +CvStatus *Net_GetUnconnectedOutLayers_Async(Net net, CvCallback_1 callback); +CvStatus *Net_GetLayerNames_Async(Net net, CvCallback_1 callback); +CvStatus *Net_GetInputDetails_Async(Net net, CvCallback_2 callback); +CvStatus *Net_GetBlobChannel_Async(Mat blob, int imgidx, int chnidx, CvCallback_1 callback); +CvStatus *Net_GetBlobSize_Async(Mat blob, CvCallback_1 callback); +CvStatus *Net_GetLayer_Async(Net net, int layerid, CvCallback_1 callback); +CvStatus *Layer_InputNameToIndex_Async(Layer layer, const char *name, CvCallback_1 callback); +CvStatus *Layer_OutputNameToIndex_Async(Layer layer, const char *name, CvCallback_1 callback); +CvStatus *Layer_GetName_Async(Layer layer, CvCallback_1 callback); +CvStatus *Layer_GetType_Async(Layer layer, CvCallback_1 callback); +void Layer_Close_Async(LayerPtr layer, CvCallback_0 callback); +CvStatus *NMSBoxes_Async(VecRect bboxes, VecFloat scores, float score_threshold, float nms_threshold, CvCallback_1 callback); +CvStatus *NMSBoxesWithParams_Async(VecRect bboxes, VecFloat scores, const float score_threshold, const float nms_threshold, const float eta, const int top_k, CvCallback_1 callback); + +#ifdef __cplusplus +} +#endif + +#endif // CVD_DNN_ASYNC_H_ diff --git a/src/extra/aruco.cpp b/src/extra/aruco.cpp index 7a24634a..d2612def 100644 --- a/src/extra/aruco.cpp +++ b/src/extra/aruco.cpp @@ -13,7 +13,7 @@ CvStatus *ArucoDetectorParameters_Create(ArucoDetectorParameters *rval) *rval = {new cv::aruco::DetectorParameters()}; END_WRAP } -void ArucoDetectorParameters_Close(ArucoDetectorParametersPtr ap){CVD_FREE(ap)} +void ArucoDetectorParameters_Close(ArucoDetectorParametersPtr ap) { CVD_FREE(ap); } CvStatus *ArucoDetectorParameters_SetAdaptiveThreshWinSizeMin(ArucoDetectorParameters ap, int adaptiveThreshWinSizeMin) @@ -395,7 +395,7 @@ CvStatus *getPredefinedDictionary(int dictionaryId, ArucoDictionary *rval) *rval = {new cv::aruco::Dictionary(cv::aruco::getPredefinedDictionary(dictionaryId))}; END_WRAP } -void ArucoDictionary_Close(ArucoDictionaryPtr self){CVD_FREE(self)} +void ArucoDictionary_Close(ArucoDictionaryPtr self) { CVD_FREE(self); } CvStatus *ArucoDetector_New(ArucoDetector *rval) { @@ -410,7 +410,7 @@ CvStatus *ArucoDetector_NewWithParams(ArucoDictionary dictionary, ArucoDetectorP *rval = {new cv::aruco::ArucoDetector(*dictionary.ptr, *params.ptr)}; END_WRAP } -void ArucoDetector_Close(ArucoDetectorPtr ad){CVD_FREE(ad)} +void ArucoDetector_Close(ArucoDetectorPtr ad) { CVD_FREE(ad); } CvStatus *ArucoDetector_DetectMarkers(ArucoDetector ad, Mat inputArr, VecVecPoint2f *markerCorners, VecInt *markerIds, VecVecPoint2f *rejectedCandidates) diff --git a/src/extra/aruco.h b/src/extra/aruco.h index f9d21577..503479ff 100644 --- a/src/extra/aruco.h +++ b/src/extra/aruco.h @@ -17,13 +17,13 @@ extern "C" { #include "core/core.h" #ifdef __cplusplus -CVD_TYPEDEF(cv::aruco::Dictionary, ArucoDictionary) -CVD_TYPEDEF(cv::aruco::DetectorParameters, ArucoDetectorParameters) -CVD_TYPEDEF(cv::aruco::ArucoDetector, ArucoDetector) +CVD_TYPEDEF(cv::aruco::Dictionary, ArucoDictionary); +CVD_TYPEDEF(cv::aruco::DetectorParameters, ArucoDetectorParameters); +CVD_TYPEDEF(cv::aruco::ArucoDetector, ArucoDetector); #else -CVD_TYPEDEF(void, ArucoDictionary) -CVD_TYPEDEF(void, ArucoDetectorParameters) -CVD_TYPEDEF(void, ArucoDetector) +CVD_TYPEDEF(void, ArucoDictionary); +CVD_TYPEDEF(void, ArucoDetectorParameters); +CVD_TYPEDEF(void, ArucoDetector); #endif CvStatus *ArucoDetectorParameters_Create(ArucoDetectorParameters *rval); diff --git a/src/extra/img_hash.cpp b/src/extra/img_hash.cpp index 1c7d94e0..47470623 100644 --- a/src/extra/img_hash.cpp +++ b/src/extra/img_hash.cpp @@ -48,7 +48,7 @@ CvStatus *BlockMeanHash_SetMode(BlockMeanHash self, int mode) void BlockMeanHash_Close(BlockMeanHashPtr self) { self->ptr->reset(); - CVD_FREE(self) + CVD_FREE(self); } CvStatus *BlockMeanHash_Compute(BlockMeanHash self, Mat inputArr, Mat outputArr) diff --git a/src/extra/img_hash.h b/src/extra/img_hash.h index daed1e48..b326e289 100644 --- a/src/extra/img_hash.h +++ b/src/extra/img_hash.h @@ -18,14 +18,14 @@ extern "C" { #ifdef __cplusplus // typedef cv::Ptr *PHash; // typedef cv::Ptr *AverageHash; -CVD_TYPEDEF(cv::Ptr, BlockMeanHash) +CVD_TYPEDEF(cv::Ptr, BlockMeanHash); // typedef cv::Ptr *ColorMomentHash; // typedef cv::Ptr *MarrHildrethHash; // typedef cv::Ptr *RadialVarianceHash; #else // typedef void *PHash; // typedef void *AverageHash; -CVD_TYPEDEF(void, BlockMeanHash) +CVD_TYPEDEF(void, BlockMeanHash); // typedef void *ColorMomentHash; // typedef void *MarrHildrethHash; // typedef void *RadialVarianceHash; diff --git a/src/extra/wechat_qrcode.cpp b/src/extra/wechat_qrcode.cpp index 38e8c20d..e8a3e56c 100644 --- a/src/extra/wechat_qrcode.cpp +++ b/src/extra/wechat_qrcode.cpp @@ -19,7 +19,7 @@ CvStatus *WeChatQRCode_NewWithParams(const char *detector_prototxt_path, super_resolution_caffe_model_path)}; END_WRAP } -void WeChatQRCode_Close(WeChatQRCodePtr self){CVD_FREE(self)} +void WeChatQRCode_Close(WeChatQRCodePtr self) { CVD_FREE(self); } CvStatus *WeChatQRCode_DetectAndDecode(WeChatQRCode *self, Mat img, VecMat *points, VecVecChar *rval) { diff --git a/src/extra/wechat_qrcode.h b/src/extra/wechat_qrcode.h index 0980455f..80ef77be 100644 --- a/src/extra/wechat_qrcode.h +++ b/src/extra/wechat_qrcode.h @@ -16,9 +16,9 @@ extern "C" { // Main Content Start #ifdef __cplusplus -CVD_TYPEDEF(cv::wechat_qrcode::WeChatQRCode, WeChatQRCode) +CVD_TYPEDEF(cv::wechat_qrcode::WeChatQRCode, WeChatQRCode); #else -CVD_TYPEDEF(void, WeChatQRCode) +CVD_TYPEDEF(void, WeChatQRCode); #endif CvStatus *WeChatQRCode_New(WeChatQRCode *qrcode); diff --git a/src/features2d/features2d.cpp b/src/features2d/features2d.cpp index dadd686f..d1ce63fb 100644 --- a/src/features2d/features2d.cpp +++ b/src/features2d/features2d.cpp @@ -7,6 +7,7 @@ */ #include "features2d.h" +#include "utils.hpp" CvStatus *AKAZE_Create(AKAZE *rval) { @@ -17,7 +18,7 @@ CvStatus *AKAZE_Create(AKAZE *rval) void AKAZE_Close(AKAZEPtr a) { a->ptr->reset(); - CVD_FREE(a) + CVD_FREE(a); } CvStatus *AKAZE_Detect(AKAZE a, Mat src, VecKeyPoint *rval) @@ -46,7 +47,7 @@ CvStatus *AgastFeatureDetector_Create(AgastFeatureDetector *rval) void AgastFeatureDetector_Close(AgastFeatureDetectorPtr a) { a->ptr->reset(); - CVD_FREE(a) + CVD_FREE(a); } CvStatus *AgastFeatureDetector_Detect(AgastFeatureDetector a, Mat src, VecKeyPoint *rval) @@ -67,7 +68,7 @@ CvStatus *BRISK_Create(BRISK *rval) void BRISK_Close(BRISKPtr b) { b->ptr->reset(); - CVD_FREE(b) + CVD_FREE(b); } CvStatus *BRISK_Detect(BRISK b, Mat src, VecKeyPoint *rval) @@ -105,7 +106,7 @@ CvStatus *FastFeatureDetector_CreateWithParams(int threshold, bool nonmaxSuppres void FastFeatureDetector_Close(FastFeatureDetectorPtr f) { f->ptr->reset(); - CVD_FREE(f) + CVD_FREE(f); } CvStatus *FastFeatureDetector_Detect(FastFeatureDetector f, Mat src, VecKeyPoint *rval) @@ -126,7 +127,7 @@ CvStatus *GFTTDetector_Create(GFTTDetector *rval) void GFTTDetector_Close(GFTTDetectorPtr a) { a->ptr->reset(); - CVD_FREE(a) + CVD_FREE(a); } CvStatus *GFTTDetector_Detect(GFTTDetector a, Mat src, VecKeyPoint *rval) @@ -147,7 +148,7 @@ CvStatus *KAZE_Create(KAZE *rval) void KAZE_Close(KAZEPtr a) { a->ptr->reset(); - CVD_FREE(a) + CVD_FREE(a); } CvStatus *KAZE_Detect(KAZE a, Mat src, VecKeyPoint *rval) @@ -176,7 +177,7 @@ CvStatus *MSER_Create(MSER *rval) void MSER_Close(MSERPtr a) { a->ptr->reset(); - CVD_FREE(a) + CVD_FREE(a); } CvStatus *MSER_Detect(MSER a, Mat src, VecKeyPoint *rval) @@ -207,7 +208,7 @@ CvStatus *ORB_CreateWithParams(int nfeatures, float scaleFactor, int nlevels, in void ORB_Close(ORBPtr o) { o->ptr->reset(); - CVD_FREE(o) + CVD_FREE(o); } CvStatus *ORB_Detect(ORB o, Mat src, VecKeyPoint *rval) @@ -227,60 +228,6 @@ CvStatus *ORB_DetectAndCompute(ORB o, Mat src, Mat mask, Mat desc, VecKeyPoint * END_WRAP } -cv::SimpleBlobDetector::Params ConvertCParamsToCPPParams(SimpleBlobDetectorParams params) -{ - cv::SimpleBlobDetector::Params converted; - - converted.blobColor = params.blobColor; - converted.filterByArea = params.filterByArea; - converted.filterByCircularity = params.filterByCircularity; - converted.filterByColor = params.filterByColor; - converted.filterByConvexity = params.filterByConvexity; - converted.filterByInertia = params.filterByInertia; - converted.maxArea = params.maxArea; - converted.maxCircularity = params.maxCircularity; - converted.maxConvexity = params.maxConvexity; - converted.maxInertiaRatio = params.maxInertiaRatio; - converted.maxThreshold = params.maxThreshold; - converted.minArea = params.minArea; - converted.minCircularity = params.minCircularity; - converted.minConvexity = params.minConvexity; - converted.minDistBetweenBlobs = params.minDistBetweenBlobs; - converted.minInertiaRatio = params.minInertiaRatio; - converted.minRepeatability = params.minRepeatability; - converted.minThreshold = params.minThreshold; - converted.thresholdStep = params.thresholdStep; - - return converted; -} - -SimpleBlobDetectorParams ConvertCPPParamsToCParams(cv::SimpleBlobDetector::Params params) -{ - SimpleBlobDetectorParams converted; - - converted.blobColor = params.blobColor; - converted.filterByArea = params.filterByArea; - converted.filterByCircularity = params.filterByCircularity; - converted.filterByColor = params.filterByColor; - converted.filterByConvexity = params.filterByConvexity; - converted.filterByInertia = params.filterByInertia; - converted.maxArea = params.maxArea; - converted.maxCircularity = params.maxCircularity; - converted.maxConvexity = params.maxConvexity; - converted.maxInertiaRatio = params.maxInertiaRatio; - converted.maxThreshold = params.maxThreshold; - converted.minArea = params.minArea; - converted.minCircularity = params.minCircularity; - converted.minConvexity = params.minConvexity; - converted.minDistBetweenBlobs = params.minDistBetweenBlobs; - converted.minInertiaRatio = params.minInertiaRatio; - converted.minRepeatability = params.minRepeatability; - converted.minThreshold = params.minThreshold; - converted.thresholdStep = params.thresholdStep; - - return converted; -} - CvStatus *SimpleBlobDetector_Create(SimpleBlobDetector *rval) { BEGIN_WRAP @@ -297,7 +244,7 @@ CvStatus *SimpleBlobDetector_Create_WithParams(SimpleBlobDetectorParams params, void SimpleBlobDetector_Close(SimpleBlobDetectorPtr b) { b->ptr->reset(); - CVD_FREE(b) + CVD_FREE(b); } CvStatus *SimpleBlobDetector_Detect(SimpleBlobDetector b, Mat src, VecKeyPoint *rval) @@ -330,7 +277,7 @@ CvStatus *BFMatcher_CreateWithParams(int normType, bool crossCheck, BFMatcher *r void BFMatcher_Close(BFMatcherPtr b) { b->ptr->reset(); - CVD_FREE(b) + CVD_FREE(b); } CvStatus *BFMatcher_Match(BFMatcher b, Mat query, Mat train, VecDMatch *rval) @@ -359,7 +306,7 @@ CvStatus *FlannBasedMatcher_Create(FlannBasedMatcher *rval) void FlannBasedMatcher_Close(FlannBasedMatcherPtr f) { f->ptr->reset(); - CVD_FREE(f) + CVD_FREE(f); } CvStatus *FlannBasedMatcher_KnnMatch(FlannBasedMatcher f, Mat query, Mat train, int k, VecVecDMatch *rval) @@ -388,7 +335,7 @@ CvStatus *SIFT_Create(SIFT *rval) void SIFT_Close(SIFTPtr f) { f->ptr->reset(); - CVD_FREE(f) + CVD_FREE(f); } CvStatus *SIFT_Detect(SIFT f, Mat src, VecKeyPoint *rval) diff --git a/src/features2d/features2d.h b/src/features2d/features2d.h index 32e16687..3872bbcb 100644 --- a/src/features2d/features2d.h +++ b/src/features2d/features2d.h @@ -17,31 +17,31 @@ extern "C" { #include "core/core.h" #include #ifdef __cplusplus -CVD_TYPEDEF(cv::Ptr, AKAZE) -CVD_TYPEDEF(cv::Ptr, AgastFeatureDetector) -CVD_TYPEDEF(cv::Ptr, BRISK) -CVD_TYPEDEF(cv::Ptr, FastFeatureDetector) -CVD_TYPEDEF(cv::Ptr, GFTTDetector) -CVD_TYPEDEF(cv::Ptr, KAZE) -CVD_TYPEDEF(cv::Ptr, MSER) -CVD_TYPEDEF(cv::Ptr, ORB) -CVD_TYPEDEF(cv::Ptr, SimpleBlobDetector) -CVD_TYPEDEF(cv::Ptr, BFMatcher) -CVD_TYPEDEF(cv::Ptr, FlannBasedMatcher) -CVD_TYPEDEF(cv::Ptr, SIFT) +CVD_TYPEDEF(cv::Ptr, AKAZE); +CVD_TYPEDEF(cv::Ptr, AgastFeatureDetector); +CVD_TYPEDEF(cv::Ptr, BRISK); +CVD_TYPEDEF(cv::Ptr, FastFeatureDetector); +CVD_TYPEDEF(cv::Ptr, GFTTDetector); +CVD_TYPEDEF(cv::Ptr, KAZE); +CVD_TYPEDEF(cv::Ptr, MSER); +CVD_TYPEDEF(cv::Ptr, ORB); +CVD_TYPEDEF(cv::Ptr, SimpleBlobDetector); +CVD_TYPEDEF(cv::Ptr, BFMatcher); +CVD_TYPEDEF(cv::Ptr, FlannBasedMatcher); +CVD_TYPEDEF(cv::Ptr, SIFT); #else -CVD_TYPEDEF(void, AKAZE) -CVD_TYPEDEF(void, AgastFeatureDetector) -CVD_TYPEDEF(void, BRISK) -CVD_TYPEDEF(void, FastFeatureDetector) -CVD_TYPEDEF(void, GFTTDetector) -CVD_TYPEDEF(void, KAZE) -CVD_TYPEDEF(void, MSER) -CVD_TYPEDEF(void, ORB) -CVD_TYPEDEF(void, SimpleBlobDetector) -CVD_TYPEDEF(void, BFMatcher) -CVD_TYPEDEF(void, FlannBasedMatcher) -CVD_TYPEDEF(void, SIFT) +CVD_TYPEDEF(void, AKAZE); +CVD_TYPEDEF(void, AgastFeatureDetector); +CVD_TYPEDEF(void, BRISK); +CVD_TYPEDEF(void, FastFeatureDetector); +CVD_TYPEDEF(void, GFTTDetector); +CVD_TYPEDEF(void, KAZE); +CVD_TYPEDEF(void, MSER); +CVD_TYPEDEF(void, ORB); +CVD_TYPEDEF(void, SimpleBlobDetector); +CVD_TYPEDEF(void, BFMatcher); +CVD_TYPEDEF(void, FlannBasedMatcher); +CVD_TYPEDEF(void, SIFT); #endif // Wrapper for SimpleBlobDetectorParams aka SimpleBlobDetector::Params diff --git a/src/features2d/features2d_async.cpp b/src/features2d/features2d_async.cpp new file mode 100644 index 00000000..85bbefbe --- /dev/null +++ b/src/features2d/features2d_async.cpp @@ -0,0 +1,426 @@ +/* Created by Abdelaziz Mahdy. Licensed: Apache 2.0 license. Copyright (c) 2024 Abdelaziz Mahdy. */ +#include "features2d_async.h" +#include "utils.hpp" + +#include "core/types.h" + +// Asynchronous functions for AKAZE +CvStatus *AKAZE_Create_Async(CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new AKAZE{new cv::Ptr(cv::AKAZE::create())}); + END_WRAP +} + +CvStatus *AKAZE_Close_Async(AKAZEPtr self, CvCallback_0 callback) +{ + BEGIN_WRAP + self->ptr->reset(); + CVD_FREE(self); + callback(); + END_WRAP +} + +CvStatus *AKAZE_Detect_Async(AKAZE self, Mat src, CvCallback_1 callback) +{ + BEGIN_WRAP + std::vector detected; + (*self.ptr)->detect(*src.ptr, detected); + callback(new VecKeyPoint{new std::vector(detected)}); + END_WRAP +} + +CvStatus *AKAZE_DetectAndCompute_Async(AKAZE self, Mat src, Mat mask, CvCallback_2 callback) +{ + BEGIN_WRAP + std::vector detected; + cv::Mat desc; + (*self.ptr)->detectAndCompute(*src.ptr, *mask.ptr, detected, desc); + callback(new VecKeyPoint{new std::vector(detected)}, new Mat{new cv::Mat(desc)}); + END_WRAP +} + +// Asynchronous functions for AgastFeatureDetector +CvStatus *AgastFeatureDetector_Create_Async(CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new AgastFeatureDetector{new cv::Ptr(cv::AgastFeatureDetector::create())}); + END_WRAP +} + +CvStatus *AgastFeatureDetector_Close_Async(AgastFeatureDetectorPtr self, CvCallback_0 callback) +{ + BEGIN_WRAP + self->ptr->reset(); + CVD_FREE(self); + callback(); + END_WRAP +} + +CvStatus *AgastFeatureDetector_Detect_Async(AgastFeatureDetector self, Mat src, CvCallback_1 callback) +{ + BEGIN_WRAP + std::vector detected; + (*self.ptr)->detect(*src.ptr, detected); + callback(new VecKeyPoint{new std::vector(detected)}); + END_WRAP +} + +// Asynchronous functions for BRISK +CvStatus *BRISK_Create_Async(CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new BRISK{new cv::Ptr(cv::BRISK::create())}); + END_WRAP +} + +CvStatus *BRISK_Close_Async(BRISKPtr self, CvCallback_0 callback) +{ + BEGIN_WRAP + self->ptr->reset(); + CVD_FREE(self); + callback(); + END_WRAP +} + +CvStatus *BRISK_Detect_Async(BRISK self, Mat src, CvCallback_1 callback) +{ + BEGIN_WRAP + std::vector detected; + (*self.ptr)->detect(*src.ptr, detected); + callback(new VecKeyPoint{new std::vector(detected)}); + END_WRAP +} + +CvStatus *BRISK_DetectAndCompute_Async(BRISK self, Mat src, Mat mask, CvCallback_2 callback) +{ + BEGIN_WRAP + std::vector detected; + cv::Mat desc; + (*self.ptr)->detectAndCompute(*src.ptr, *mask.ptr, detected, desc); + callback(new VecKeyPoint{new std::vector(detected)}, new Mat{new cv::Mat(desc)}); + END_WRAP +} + +// Asynchronous functions for FastFeatureDetector +CvStatus *FastFeatureDetector_Create_Async(CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new FastFeatureDetector{new cv::Ptr(cv::FastFeatureDetector::create())}); + END_WRAP +} + +CvStatus *FastFeatureDetector_CreateWithParams_Async(int threshold, bool nonmaxSuppression, int type, CvCallback_1 callback) +{ + BEGIN_WRAP + auto type_ = static_cast(type); + callback(new FastFeatureDetector{new cv::Ptr(cv::FastFeatureDetector::create(threshold, nonmaxSuppression, type_))}); + END_WRAP +} + +CvStatus *FastFeatureDetector_Close_Async(FastFeatureDetectorPtr self, CvCallback_0 callback) +{ + BEGIN_WRAP + self->ptr->reset(); + CVD_FREE(self); + callback(); + END_WRAP +} + +CvStatus *FastFeatureDetector_Detect_Async(FastFeatureDetector self, Mat src, CvCallback_1 callback) +{ + BEGIN_WRAP + std::vector detected; + (*self.ptr)->detect(*src.ptr, detected); + callback(new VecKeyPoint{new std::vector(detected)}); + END_WRAP +} + +// Asynchronous functions for GFTTDetector +CvStatus *GFTTDetector_Create_Async(CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new GFTTDetector{new cv::Ptr(cv::GFTTDetector::create())}); + END_WRAP +} + +CvStatus *GFTTDetector_Close_Async(GFTTDetectorPtr self, CvCallback_0 callback) +{ + BEGIN_WRAP + self->ptr->reset(); + CVD_FREE(self); + callback(); + END_WRAP +} + +CvStatus *GFTTDetector_Detect_Async(GFTTDetector self, Mat src, CvCallback_1 callback) +{ + BEGIN_WRAP + std::vector detected; + (*self.ptr)->detect(*src.ptr, detected); + callback(new VecKeyPoint{new std::vector(detected)}); + END_WRAP +} + +// Asynchronous functions for KAZE +CvStatus *KAZE_Create_Async(CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new KAZE{new cv::Ptr(cv::KAZE::create())}); + END_WRAP +} + +CvStatus *KAZE_Close_Async(KAZEPtr self, CvCallback_0 callback) +{ + BEGIN_WRAP + self->ptr->reset(); + CVD_FREE(self); + callback(); + END_WRAP +} + +CvStatus *KAZE_Detect_Async(KAZE self, Mat src, CvCallback_1 callback) +{ + BEGIN_WRAP + std::vector detected; + (*self.ptr)->detect(*src.ptr, detected); + callback(new VecKeyPoint{new std::vector(detected)}); + END_WRAP +} + +CvStatus *KAZE_DetectAndCompute_Async(KAZE self, Mat src, Mat mask, CvCallback_2 callback) +{ + BEGIN_WRAP + std::vector detected; + cv::Mat desc; + (*self.ptr)->detectAndCompute(*src.ptr, *mask.ptr, detected, desc); + callback(new VecKeyPoint{new std::vector(detected)}, new Mat{new cv::Mat(desc)}); + END_WRAP +} + +// Asynchronous functions for MSER +CvStatus *MSER_Create_Async(CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new MSER{new cv::Ptr(cv::MSER::create())}); + END_WRAP +} + +CvStatus *MSER_Close_Async(MSERPtr self, CvCallback_0 callback) +{ + BEGIN_WRAP + self->ptr->reset(); + CVD_FREE(self); + callback(); + END_WRAP +} + +CvStatus *MSER_Detect_Async(MSER self, Mat src, CvCallback_1 callback) +{ + BEGIN_WRAP + std::vector detected; + (*self.ptr)->detect(*src.ptr, detected); + callback(new VecKeyPoint{new std::vector(detected)}); + END_WRAP +} + +// Asynchronous functions for ORB +CvStatus *ORB_Create_Async(CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new ORB{new cv::Ptr(cv::ORB::create())}); + END_WRAP +} + +CvStatus *ORB_CreateWithParams_Async(int nfeatures, float scaleFactor, int nlevels, int edgeThreshold, int firstLevel, int WTA_K, int scoreType, int patchSize, int fastThreshold, CvCallback_1 callback) +{ + BEGIN_WRAP + auto type = static_cast(scoreType); + callback(new ORB{new cv::Ptr(cv::ORB::create(nfeatures, scaleFactor, nlevels, edgeThreshold, firstLevel, WTA_K, type, patchSize, fastThreshold))}); + END_WRAP +} + +CvStatus *ORB_Close_Async(ORBPtr self, CvCallback_0 callback) +{ + BEGIN_WRAP + self->ptr->reset(); + CVD_FREE(self); + callback(); + END_WRAP +} + +CvStatus *ORB_Detect_Async(ORB self, Mat src, CvCallback_1 callback) +{ + BEGIN_WRAP + std::vector detected; + (*self.ptr)->detect(*src.ptr, detected); + callback(new VecKeyPoint{new std::vector(detected)}); + END_WRAP +} + +CvStatus *ORB_DetectAndCompute_Async(ORB self, Mat src, Mat mask, CvCallback_2 callback) +{ + BEGIN_WRAP + std::vector detected; + cv::Mat desc; + (*self.ptr)->detectAndCompute(*src.ptr, *mask.ptr, detected, desc); + callback(new VecKeyPoint{new std::vector(detected)}, new Mat{new cv::Mat(desc)}); + END_WRAP +} + +// Asynchronous functions for SimpleBlobDetector +CvStatus *SimpleBlobDetector_Create_Async(CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new SimpleBlobDetector{new cv::Ptr(cv::SimpleBlobDetector::create())}); + END_WRAP +} + +CvStatus *SimpleBlobDetector_Create_WithParams_Async(SimpleBlobDetectorParams params, CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new SimpleBlobDetector{new cv::Ptr(cv::SimpleBlobDetector::create(ConvertCParamsToCPPParams(params)))}); + END_WRAP +} + +CvStatus *SimpleBlobDetector_Close_Async(SimpleBlobDetectorPtr self, CvCallback_0 callback) +{ + BEGIN_WRAP + self->ptr->reset(); + CVD_FREE(self); + callback(); + END_WRAP +} + +CvStatus *SimpleBlobDetector_Detect_Async(SimpleBlobDetector self, Mat src, CvCallback_1 callback) +{ + BEGIN_WRAP + std::vector detected; + (*self.ptr)->detect(*src.ptr, detected); + callback(new VecKeyPoint{new std::vector(detected)}); + END_WRAP +} + +// Asynchronous functions for BFMatcher +CvStatus *BFMatcher_Create_Async(CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new BFMatcher{new cv::Ptr(cv::BFMatcher::create())}); + END_WRAP +} + +CvStatus *BFMatcher_CreateWithParams_Async(int normType, bool crossCheck, CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new BFMatcher{new cv::Ptr(cv::BFMatcher::create(normType, crossCheck))}); + END_WRAP +} + +CvStatus *BFMatcher_Close_Async(BFMatcherPtr self, CvCallback_0 callback) +{ + BEGIN_WRAP + self->ptr->reset(); + CVD_FREE(self); + callback(); + END_WRAP +} + +CvStatus *BFMatcher_Match_Async(BFMatcher self, Mat query, Mat train, CvCallback_1 callback) +{ + BEGIN_WRAP + std::vector matches; + (*self.ptr)->match(*query.ptr, *train.ptr, matches); + callback(new VecDMatch{new std::vector(matches)}); + END_WRAP +} + +CvStatus *BFMatcher_KnnMatch_Async(BFMatcher self, Mat query, Mat train, int k, CvCallback_1 callback) +{ + BEGIN_WRAP + std::vector> matches; + (*self.ptr)->knnMatch(*query.ptr, *train.ptr, matches, k); + callback(new VecVecDMatch{new std::vector>(matches)}); + END_WRAP +} + +// Asynchronous functions for FlannBasedMatcher +CvStatus *FlannBasedMatcher_Create_Async(CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new FlannBasedMatcher{new cv::Ptr(cv::FlannBasedMatcher::create())}); + END_WRAP +} + +CvStatus *FlannBasedMatcher_Close_Async(FlannBasedMatcherPtr self, CvCallback_0 callback) +{ + BEGIN_WRAP + self->ptr->reset(); + CVD_FREE(self); + callback(); + END_WRAP +} + +CvStatus *FlannBasedMatcher_KnnMatch_Async(FlannBasedMatcher self, Mat query, Mat train, int k, CvCallback_1 callback) +{ + BEGIN_WRAP + std::vector> matches; + (*self.ptr)->knnMatch(*query.ptr, *train.ptr, matches, k); + callback(new VecVecDMatch{new std::vector>(matches)}); + END_WRAP +} + +// Asynchronous utility functions +CvStatus *DrawKeyPoints_Async(Mat src, VecKeyPoint kp, Mat dst, const Scalar color, int flags, CvCallback_0 callback) +{ + BEGIN_WRAP + auto color_ = cv::Scalar(color.val1, color.val2, color.val3, color.val4); + cv::drawKeypoints(*src.ptr, *kp.ptr, *dst.ptr, color_, static_cast(flags)); + callback(); + END_WRAP +} + +CvStatus *DrawMatches_Async(Mat img1, VecKeyPoint kp1, Mat img2, VecKeyPoint kp2, VecDMatch matches1to2, Mat outImg, const Scalar matchesColor, const Scalar pointColor, VecChar matchesMask, int flags, CvCallback_0 callback) +{ + BEGIN_WRAP + auto mColor = cv::Scalar(matchesColor.val1, matchesColor.val2, matchesColor.val3, matchesColor.val4); + auto pColor = cv::Scalar(pointColor.val1, pointColor.val2, pointColor.val3, pointColor.val4); + cv::drawMatches(*img1.ptr, *kp1.ptr, *img2.ptr, *kp2.ptr, *matches1to2.ptr, *outImg.ptr, mColor, pColor, *matchesMask.ptr, static_cast(flags)); + callback(); + END_WRAP +} + +// Asynchronous functions for SIFT +CvStatus *SIFT_Create_Async(CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new SIFT{new cv::Ptr(cv::SIFT::create())}); + END_WRAP +} + +CvStatus *SIFT_Close_Async(SIFTPtr self, CvCallback_0 callback) +{ + BEGIN_WRAP + self->ptr->reset(); + CVD_FREE(self); + callback(); + END_WRAP +} + +CvStatus *SIFT_Detect_Async(SIFT self, Mat src, CvCallback_1 callback) +{ + BEGIN_WRAP + std::vector detected; + (*self.ptr)->detect(*src.ptr, detected); + callback(new VecKeyPoint{new std::vector(detected)}); + END_WRAP +} + +CvStatus *SIFT_DetectAndCompute_Async(SIFT self, Mat src, Mat mask, CvCallback_2 callback) +{ + BEGIN_WRAP + std::vector detected; + cv::Mat desc; + (*self.ptr)->detectAndCompute(*src.ptr, *mask.ptr, detected, desc); + callback(new VecKeyPoint{new std::vector(detected)}, new Mat{new cv::Mat(desc)}); + END_WRAP +} diff --git a/src/features2d/features2d_async.h b/src/features2d/features2d_async.h new file mode 100644 index 00000000..200bdd0e --- /dev/null +++ b/src/features2d/features2d_async.h @@ -0,0 +1,92 @@ +/* Created by Abdelaziz Mahdy. Licensed: Apache 2.0 license. Copyright (c) 2024 Abdelaziz Mahdy. */ +#ifndef CVD_FEATURES2D_ASYNC_H_ +#define CVD_FEATURES2D_ASYNC_H_ + +#include "core/types.h" +#include "features2d.h" +#include + +#ifdef __cplusplus +#include +extern "C" { +#endif + +// AKAZE +CvStatus *AKAZE_Create_Async(CvCallback_1 callback); +CvStatus *AKAZE_Close_Async(AKAZEPtr self, CvCallback_0 callback); +CvStatus *AKAZE_Detect_Async(AKAZE self, Mat src, CvCallback_1 callback); +CvStatus *AKAZE_DetectAndCompute_Async(AKAZE self, Mat src, Mat mask, CvCallback_2 callback); + +// AgastFeatureDetector +CvStatus *AgastFeatureDetector_Create_Async(CvCallback_1 callback); +CvStatus *AgastFeatureDetector_Close_Async(AgastFeatureDetectorPtr self, CvCallback_0 callback); +CvStatus *AgastFeatureDetector_Detect_Async(AgastFeatureDetector self, Mat src, CvCallback_1 callback); + +// BRISK +CvStatus *BRISK_Create_Async(CvCallback_1 callback); +CvStatus *BRISK_Close_Async(BRISKPtr self, CvCallback_0 callback); +CvStatus *BRISK_Detect_Async(BRISK self, Mat src, CvCallback_1 callback); +CvStatus *BRISK_DetectAndCompute_Async(BRISK self, Mat src, Mat mask, CvCallback_2 callback); + +// FastFeatureDetector +CvStatus *FastFeatureDetector_Create_Async(CvCallback_1 callback); +CvStatus *FastFeatureDetector_CreateWithParams_Async(int threshold, bool nonmaxSuppression, int type, CvCallback_1 callback); +CvStatus *FastFeatureDetector_Close_Async(FastFeatureDetectorPtr self, CvCallback_0 callback); +CvStatus *FastFeatureDetector_Detect_Async(FastFeatureDetector self, Mat src, CvCallback_1 callback); + +// GFTTDetector +CvStatus *GFTTDetector_Create_Async(CvCallback_1 callback); +CvStatus *GFTTDetector_Close_Async(GFTTDetectorPtr self, CvCallback_0 callback); +CvStatus *GFTTDetector_Detect_Async(GFTTDetector self, Mat src, CvCallback_1 callback); + +// KAZE +CvStatus *KAZE_Create_Async(CvCallback_1 callback); +CvStatus *KAZE_Close_Async(KAZEPtr self, CvCallback_0 callback); +CvStatus *KAZE_Detect_Async(KAZE self, Mat src, CvCallback_1 callback); +CvStatus *KAZE_DetectAndCompute_Async(KAZE self, Mat src, Mat mask, CvCallback_2 callback); + +// MSER +CvStatus *MSER_Create_Async(CvCallback_1 callback); +CvStatus *MSER_Close_Async(MSERPtr self, CvCallback_0 callback); +CvStatus *MSER_Detect_Async(MSER self, Mat src, CvCallback_1 callback); + +// ORB +CvStatus *ORB_Create_Async(CvCallback_1 callback); +CvStatus *ORB_CreateWithParams_Async(int nfeatures, float scaleFactor, int nlevels, int edgeThreshold, int firstLevel, int WTA_K, int scoreType, int patchSize, int fastThreshold, CvCallback_1 callback); +CvStatus *ORB_Close_Async(ORBPtr self, CvCallback_0 callback); +CvStatus *ORB_Detect_Async(ORB self, Mat src, CvCallback_1 callback); +CvStatus *ORB_DetectAndCompute_Async(ORB self, Mat src, Mat mask, CvCallback_2 callback); + +// SimpleBlobDetector +CvStatus *SimpleBlobDetector_Create_Async(CvCallback_1 callback); +CvStatus *SimpleBlobDetector_Create_WithParams_Async(SimpleBlobDetectorParams params, CvCallback_1 callback); +CvStatus *SimpleBlobDetector_Close_Async(SimpleBlobDetectorPtr self, CvCallback_0 callback); +CvStatus *SimpleBlobDetector_Detect_Async(SimpleBlobDetector self, Mat src, CvCallback_1 callback); + +// BFMatcher +CvStatus *BFMatcher_Create_Async(CvCallback_1 callback); +CvStatus *BFMatcher_CreateWithParams_Async(int normType, bool crossCheck, CvCallback_1 callback); +CvStatus *BFMatcher_Close_Async(BFMatcherPtr self, CvCallback_0 callback); +CvStatus *BFMatcher_Match_Async(BFMatcher self, Mat query, Mat train, CvCallback_1 callback); +CvStatus *BFMatcher_KnnMatch_Async(BFMatcher self, Mat query, Mat train, int k, CvCallback_1 callback); + +// FlannBasedMatcher +CvStatus *FlannBasedMatcher_Create_Async(CvCallback_1 callback); +CvStatus *FlannBasedMatcher_Close_Async(FlannBasedMatcherPtr self, CvCallback_0 callback); +CvStatus *FlannBasedMatcher_KnnMatch_Async(FlannBasedMatcher self, Mat query, Mat train, int k, CvCallback_1 callback); + +// Utility functions +CvStatus *DrawKeyPoints_Async(Mat src, VecKeyPoint kp, Mat dst, const Scalar color, int flags, CvCallback_0 callback); +CvStatus *DrawMatches_Async(Mat img1, VecKeyPoint kp1, Mat img2, VecKeyPoint kp2, VecDMatch matches1to2, Mat outImg, const Scalar matchesColor, const Scalar pointColor, VecChar matchesMask, int flags, CvCallback_0 callback); + +// SIFT +CvStatus *SIFT_Create_Async(CvCallback_1 callback); +CvStatus *SIFT_Close_Async(SIFTPtr self, CvCallback_0 callback); +CvStatus *SIFT_Detect_Async(SIFT self, Mat src, CvCallback_1 callback); +CvStatus *SIFT_DetectAndCompute_Async(SIFT self, Mat src, Mat mask, CvCallback_2 callback); + +#ifdef __cplusplus +} +#endif + +#endif // CVD_FEATURES2D_ASYNC_H_ diff --git a/src/features2d/utils.hpp b/src/features2d/utils.hpp new file mode 100644 index 00000000..6110cfeb --- /dev/null +++ b/src/features2d/utils.hpp @@ -0,0 +1,61 @@ +#ifndef CVD_FEATURES2D_UTILS_H +#define CVD_FEATURES2D_UTILS_H + +#include "features2d/features2d.h" +#include + +inline cv::SimpleBlobDetector::Params ConvertCParamsToCPPParams(SimpleBlobDetectorParams params) +{ + cv::SimpleBlobDetector::Params converted; + + converted.blobColor = params.blobColor; + converted.filterByArea = params.filterByArea; + converted.filterByCircularity = params.filterByCircularity; + converted.filterByColor = params.filterByColor; + converted.filterByConvexity = params.filterByConvexity; + converted.filterByInertia = params.filterByInertia; + converted.maxArea = params.maxArea; + converted.maxCircularity = params.maxCircularity; + converted.maxConvexity = params.maxConvexity; + converted.maxInertiaRatio = params.maxInertiaRatio; + converted.maxThreshold = params.maxThreshold; + converted.minArea = params.minArea; + converted.minCircularity = params.minCircularity; + converted.minConvexity = params.minConvexity; + converted.minDistBetweenBlobs = params.minDistBetweenBlobs; + converted.minInertiaRatio = params.minInertiaRatio; + converted.minRepeatability = params.minRepeatability; + converted.minThreshold = params.minThreshold; + converted.thresholdStep = params.thresholdStep; + + return converted; +} + +inline SimpleBlobDetectorParams ConvertCPPParamsToCParams(cv::SimpleBlobDetector::Params params) +{ + SimpleBlobDetectorParams converted; + + converted.blobColor = params.blobColor; + converted.filterByArea = params.filterByArea; + converted.filterByCircularity = params.filterByCircularity; + converted.filterByColor = params.filterByColor; + converted.filterByConvexity = params.filterByConvexity; + converted.filterByInertia = params.filterByInertia; + converted.maxArea = params.maxArea; + converted.maxCircularity = params.maxCircularity; + converted.maxConvexity = params.maxConvexity; + converted.maxInertiaRatio = params.maxInertiaRatio; + converted.maxThreshold = params.maxThreshold; + converted.minArea = params.minArea; + converted.minCircularity = params.minCircularity; + converted.minConvexity = params.minConvexity; + converted.minDistBetweenBlobs = params.minDistBetweenBlobs; + converted.minInertiaRatio = params.minInertiaRatio; + converted.minRepeatability = params.minRepeatability; + converted.minThreshold = params.minThreshold; + converted.thresholdStep = params.thresholdStep; + + return converted; +} + +#endif // CVD_FEATURES2D_UTILS_H diff --git a/src/gapi/gapi.cpp b/src/gapi/gapi.cpp index 51d08f3c..2177eeed 100644 --- a/src/gapi/gapi.cpp +++ b/src/gapi/gapi.cpp @@ -1,22 +1,137 @@ #include "gapi.h" +#include "core/types.h" -CvStatus *GMat_New_Empty(GMat *rval) +CvStatus *gapi_GMat_New_Empty(GMat *rval) { BEGIN_WRAP *rval = {new cv::GMat()}; END_WRAP } -/// not available in 4.9.0 stable -// CvStatus *GMat_New_FromMat(Mat mat, GMat *rval) +CvStatus *gapi_GMat_New_FromMat(Mat mat, GMat *rval) +{ + BEGIN_WRAP + *rval = {new cv::GMat(*mat.ptr)}; + END_WRAP +} + +void gapi_GMat_Close(GMatPtr mat) +{ + delete mat->ptr; + mat->ptr = nullptr; +} + +CvStatus *gapi_GScalar_New_Empty(GScalar *rval) +{ + BEGIN_WRAP + *rval = {new cv::GScalar()}; + END_WRAP +} +CvStatus *gapi_GScalar_New_FromScalar(Scalar scalar, GScalar *rval) +{ + BEGIN_WRAP + *rval = {new cv::GScalar(cv::Scalar(scalar.val1, scalar.val2, scalar.val3, scalar.val4))}; + END_WRAP +} +CvStatus *gapi_GScalar_New_FromDouble(double v0, GScalar *rval) +{ + BEGIN_WRAP + *rval = {new cv::GScalar(cv::Scalar(v0))}; + END_WRAP +} +void gapi_GScalar_Close(GScalarPtr scalar) +{ + delete scalar->ptr; + scalar->ptr = nullptr; +} + +CvStatus *gapi_GComputation_New(GMat in, GMat out, GComputation *rval) +{ + BEGIN_WRAP + *rval = {new cv::GComputation(*in.ptr, *out.ptr)}; + END_WRAP +} + +CvStatus *gapi_GComputation_New_1(GMat in, GScalar out, GComputation *rval) +{ + BEGIN_WRAP + *rval = {new cv::GComputation(*in.ptr, *out.ptr)}; + END_WRAP +} + +CvStatus *gapi_GComputation_New_2(GMat in1, GMat in2, GMat out, GComputation *rval) +{ + BEGIN_WRAP + *rval = {new cv::GComputation(*in1.ptr, *in2.ptr, *out.ptr)}; + END_WRAP +} + +CvStatus *gapi_GComputation_New_3(GMat in1, GMat in2, GScalar out, GComputation *rval) +{ + BEGIN_WRAP + *rval = {new cv::GComputation(*in1.ptr, *in2.ptr, *out.ptr)}; + END_WRAP +} + +void gapi_GComputation_Close(GComputationPtr self) { CVD_FREE(self); } + +CvStatus *gapi_GComputation_apply(GComputation self, Mat in, + CvCallback_1 callback /*TODO: GCompileArgs &&args={}*/) +{ + BEGIN_WRAP + cv::Mat _out; + (*self.ptr).apply(*in.ptr, _out); + callback(new Mat{new cv::Mat(_out)}); + END_WRAP +} + +CvStatus *gapi_GComputation_apply_1(GComputation self, Mat in, Scalar *out /*TODO: GCompileArgs &&args={}*/) +{ + BEGIN_WRAP + cv::Scalar _out; + (*self.ptr).apply(*in.ptr, _out); + *out = {_out.val[0], _out.val[1], _out.val[2], _out.val[3]}; + END_WRAP +} + +CvStatus *gapi_GComputation_apply_2(GComputation self, Mat in1, Mat in2, + Mat *out /*TODO: GCompileArgs &&args={}*/) +{ + BEGIN_WRAP + cv::Mat _out; + (*self.ptr).apply(*in1.ptr, *in2.ptr, _out); + *out = {new cv::Mat(_out)}; + END_WRAP +} + +CvStatus *gapi_GComputation_apply_3(GComputation self, Mat in1, Mat in2, + Scalar *out /*TODO: GCompileArgs &&args={}*/) +{ + BEGIN_WRAP + cv::Scalar _out; + (*self.ptr).apply(*in1.ptr, *in2.ptr, _out); + *out = {_out.val[0], _out.val[1], _out.val[2], _out.val[3]}; + END_WRAP +} + +// CvStatus *VecGMat_NewFromVec(VecMat vec, VecGMat *rval) // { // BEGIN_WRAP -// *rval = {new cv::GMat(*mat.ptr)}; +// auto v = std::vector(*vec.ptr); +// *rval = {new}; // END_WRAP // } -void GMat_Close(GMatPtr mat) +CvStatus *gapi_add(GMat src1, GMat src2, int ddepth, GMat *rval) { - delete mat->ptr; - mat->ptr = nullptr; + BEGIN_WRAP + *rval = {new cv::GMat(cv::gapi::add(*src1.ptr, *src2.ptr, ddepth))}; + END_WRAP +} + +CvStatus *gapi_addC(GMat src, GScalar c, int ddepth, GMat *rval) +{ + BEGIN_WRAP + *rval = {new cv::GMat(cv::gapi::addC(*src.ptr, *c.ptr, ddepth))}; + END_WRAP } diff --git a/src/gapi/gapi.h b/src/gapi/gapi.h index af2bc5d8..c7ee3fb6 100644 --- a/src/gapi/gapi.h +++ b/src/gapi/gapi.h @@ -7,23 +7,273 @@ #define OPENCV_DART_GAPI_H #include "core/core.h" +#include "core/types.h" #ifdef __cplusplus #include #include +#include +#include +#include #include +#include +#include extern "C" { #endif #ifdef __cplusplus -CVD_TYPEDEF(cv::GMat, GMat) +CVD_TYPEDEF(cv::GMat, GMat); +CVD_TYPEDEF(cv::GScalar, GScalar); +CVD_TYPEDEF(cv::GFrame, GFrame); +CVD_TYPEDEF(cv::GComputation, GComputation); +CVD_TYPEDEF(cv::GOpaque, GOpaqueRect); +CVD_TYPEDEF(cv::GOpaque, GOpaquePoint); +CVD_TYPEDEF(cv::GOpaque, GOpaqueVec4f); +CVD_TYPEDEF(cv::GOpaque, GOpaqueVec6f); +CVD_TYPEDEF(std::vector, VecGMat); +CVD_TYPEDEF(cv::gapi::wip::draw::Prim, Prim); +CVD_TYPEDEF(std::vector, VecPrim); + +CVD_TYPEDEF(cv::GArray>, GArrayGArrayPoint); +CVD_TYPEDEF(cv::GArray, GArrayVec4i); +CVD_TYPEDEF(cv::GArray, GArrayPoint); +CVD_TYPEDEF(cv::GArray, GArrayPoint2f); +CVD_TYPEDEF(cv::GArray, GArrayPoint2i); +CVD_TYPEDEF(cv::GArray, GArrayPoint2d); +CVD_TYPEDEF(cv::GArray, GArrayPoint3f); +CVD_TYPEDEF(cv::GArray, GArrayPoint3d); +CVD_TYPEDEF(cv::GArray, GArrayPoint3i); +CVD_TYPEDEF(cv::GArray, GArrayPrim); + #else -CVD_TYPEDEF(void, GMat) +CVD_TYPEDEF(void, GMat); +CVD_TYPEDEF(void, GScalar); +CVD_TYPEDEF(void, GFrame); +CVD_TYPEDEF(void, GComputation); +CVD_TYPEDEF(void, GOpaqueRect); +CVD_TYPEDEF(void, GOpaquePoint); +CVD_TYPEDEF(void, GOpaqueVec4f); +CVD_TYPEDEF(void, GOpaqueVec6f); +CVD_TYPEDEF(void, VecGMat); +CVD_TYPEDEF(void, Prim); +CVD_TYPEDEF(void, VecPrim); + +CVD_TYPEDEF(void, GArrayGArrayPoint); +CVD_TYPEDEF(void, GArrayVec4i); +CVD_TYPEDEF(void, GArrayPoint); +CVD_TYPEDEF(void, GArrayPoint2f); +CVD_TYPEDEF(void, GArrayPoint2i); +CVD_TYPEDEF(void, GArrayPoint2d); +CVD_TYPEDEF(void, GArrayPoint3f); +CVD_TYPEDEF(void, GArrayPoint3d); +CVD_TYPEDEF(void, GArrayPoint3i); +CVD_TYPEDEF(void, GArrayPrim); #endif -CvStatus *GMat_New_Empty(GMat *rval); -// CvStatus *GMat_New_FromMat(Mat mat, GMat *rval); -void GMat_Close(GMatPtr mat); +typedef VecPrim Prims; +// typedef void (*GMatCallback)(GMat *); +// typedef void (*MatCallback)(void *); + +CvStatus *gapi_GMat_New_Empty(GMat *rval); +CvStatus *gapi_GMat_New_FromMat(Mat mat, GMat *rval); +void gapi_GMat_Close(GMatPtr mat); + +CvStatus *gapi_GScalar_New_Empty(GScalar *rval); +CvStatus *gapi_GScalar_New_FromScalar(Scalar scalar, GScalar *rval); +CvStatus *gapi_GScalar_New_FromDouble(double v0, GScalar *rval); +void gapi_GScalar_Close(GScalarPtr scalar); + +CvStatus *gapi_GComputation_New(GMat in, GMat out, GComputation *rval); +CvStatus *gapi_GComputation_New_1(GMat in, GScalar out, GComputation *rval); +CvStatus *gapi_GComputation_New_2(GMat in1, GMat in2, GMat out, GComputation *rval); +CvStatus *gapi_GComputation_New_3(GMat in1, GMat in2, GScalar out, GComputation *rval); +void gapi_GComputation_Close(GComputationPtr self); +CvStatus *gapi_GComputation_apply(GComputation self, Mat in, + CvCallback_1 callback /*TODO: GCompileArgs &&args={}*/); +CvStatus *gapi_GComputation_apply_1(GComputation self, Mat in, Scalar *out /*TODO: GCompileArgs &&args={}*/); +CvStatus *gapi_GComputation_apply_2(GComputation self, Mat in1, Mat in2, + Mat *out /*TODO: GCompileArgs &&args={}*/); +CvStatus *gapi_GComputation_apply_3(GComputation self, Mat in1, Mat in2, + Scalar *out /*TODO: GCompileArgs &&args={}*/); + +// CvStatus *VecGMat_NewFromVec(VecMat vec, VecGMat *rval); + +CvStatus *Prim_from_Circle(Point center, Scalar color, int lt, int radius, int shift, int thick, Prim *rval); +CvStatus *Prim_from_FText(char *text, int text_len, Point org, int fh, Scalar color, Prim *rval); +CvStatus *Prim_from_Image(Point org, Mat img, Mat alpha, Prim *rval); +CvStatus *Prim_from_Line(Scalar color, int lt, Point pt1, Point pt2, int shift, int thick, Prim *rval); +CvStatus *Prim_from_Mosaic(int cellSz, int decim, Rect mos, Prim *rval); +CvStatus *Prim_from_Poly(VecPoint points, Scalar color, int thick, int lt, int shift, Prim *rval); +CvStatus *Prim_from_Rect(Scalar color, int lt, Rect rect, int shift, int thick, Prim *rval); +CvStatus *Prim_from_Text(bool bottom_left_origin, Scalar color, int ff, double fs, int lt, Point org, + char *text, int text_len, int thick, Prim *rval); + +CvStatus *VecPrim_New(VecPrim *rval); +CvStatus *VecPrim_NewFromPointer(Prim *points, int length, VecPrim *rval); +CvStatus *VecPrim_NewFromVec(VecPrim vec, VecPrim *rval); +CvStatus *VecPrim_At(VecPrim vec, int idx, Prim *rval); +CvStatus *VecPrim_Append(VecPrim vec, Prim p); +CvStatus *VecPrim_Size(VecPrim vec, int *rval); +void VecPrim_Close(VecPrimPtr vec); + +CvStatus *GArrayGArrayPoint_FromVec(VecVecPoint points, GArrayGArrayPoint *rval); +CvStatus *GArrayVec4i_FromVec(VecVec4i v, GArrayVec4i *rval); +CvStatus *GArrayPoint_FromVec(VecPoint v, GArrayPoint *rval); +CvStatus *GArrayPoint2f_FromVec(VecPoint v, GArrayPoint2f *rval); +CvStatus *GArrayPoint2i_FromVec(VecPoint v, GArrayPoint2i *rval); +CvStatus *GArrayPoint2d_FromVec(VecPoint v, GArrayPoint2d *rval); +CvStatus *GArrayPoint3f_FromVec(VecPoint v, GArrayPoint3f *rval); +CvStatus *GArrayPoint3d_FromVec(VecPoint v, GArrayPoint3d *rval); +CvStatus *GArrayPoint3i_FromVec(VecPoint v, GArrayPoint3i *rval); +CvStatus *GArrayPrim_FromVec(VecPrim v, GArrayPrim *rval); + +// Graph API: Math operations +// https://docs.opencv.org/4.10.0/da/dd3/group__gapi__math.html#ga3fec036f5cf3f6cb8c2633c109085f0b +CvStatus *gapi_add(GMat src1, GMat src2, int ddepth, GMat *rval); +CvStatus *gapi_addC(GMat src, GScalar c, int ddepth, GMat *rval); +CvStatus *gapi_addC_1(GScalar c, GMat src, int ddepth, GMat *rval); +CvStatus *gapi_cartToPolar(GMat x, GMat y, bool angleInDegrees, GMat *rval, GMat *rval1); +CvStatus *gapi_div(GMat src1, GMat src2, double scale, int ddepth, GMat *rval); +CvStatus *gapi_divC(GMat src, GScalar divisor, double scale, int ddepth, GMat *rval); +CvStatus *gapi_divRC(GScalar divident, GMat src, double scale, int ddepth, GMat *rval); +CvStatus *gapi_mask(GMat src, GMat mask, GMat *rval); +CvStatus *gapi_mean(GMat src, GScalar *rval); +CvStatus *gapi_mul(GMat src1, GMat src2, double scale, int ddepth, GMat *rval); +CvStatus *gapi_mulC(GMat src, GScalar multiplier, int ddepth, GMat *rval); +CvStatus *gapi_mulC_1(GMat src, double multiplier, int ddepth, GMat *rval); +CvStatus *gapi_mulC_2(GScalar multiplier, GMat src, int ddepth, GMat *rval); +CvStatus *gapi_phase(GMat x, GMat y, bool angleInDegrees, GMat *rval); +CvStatus *gapi_polarToCart(GMat magnitude, GMat angle, bool angleInDegrees, GMat *rval); +CvStatus *gapi_sqrt(GMat src, GMat *rval); +CvStatus *gapi_sub(GMat src1, GMat src2, int ddepth, GMat *rval); +CvStatus *gapi_subC(GMat src, GScalar c, int ddepth, GMat *rval); +CvStatus *gapi_subRC(GScalar c, GMat src, int ddepth, GMat *rval); + +// Graph API: Image filters +// https://docs.opencv.org/4.10.0/da/dc5/group__gapi__filters.html +CvStatus *gapi_bilateralFilter(const GMat src, int d, double sigmaColor, double sigmaSpace, int borderType, + GMat *rval); +CvStatus *gapi_blur(const GMat src, const Size ksize, const Point anchor, int borderType, + const Scalar borderValue, GMat *rval); +CvStatus *gapi_boxFilter(const GMat src, int dtype, const Size ksize, const Point anchor, bool normalize, + int borderType, const Scalar borderValue, GMat *rval); +CvStatus *gapi_dilate(const GMat src, const Mat kernel, const Point anchor, int iterations, int borderType, + const Scalar borderValue, GMat *rval); +CvStatus *gapi_dilate3x3(const GMat src, int iterations, int borderType, const Scalar borderValue, + GMat *rval); +CvStatus *gapi_erode(const GMat src, const Mat kernel, const Point anchor, int iterations, int borderType, + const Scalar borderValue, GMat *rval); +CvStatus *gapi_erode3x3(const GMat src, int iterations, int borderType, const Scalar borderValue, GMat *rval); +CvStatus *gapi_filter2D(const GMat src, int ddepth, const Mat kernel, const Point anchor, const Scalar delta, + int borderType, const Scalar borderValue, GMat *rval); +CvStatus *gapi_gaussianBlur(const GMat src, const Size ksize, double sigmaX, double sigmaY, int borderType, + const Scalar borderValue, GMat *rval); +CvStatus *gapi_Laplacian(const GMat src, int ddepth, int ksize, double scale, double delta, int borderType, + GMat *rval); +CvStatus *gapi_medianBlur(const GMat src, int ksize, GMat *rval); +CvStatus *gapi_morphologyEx(const GMat src, const int op, const Mat kernel, const Point anchor, + const int iterations, const int borderType, const Scalar borderValue, GMat *rval); +CvStatus *gapi_sepFilter(const GMat src, int ddepth, const Mat kernelX, const Mat kernelY, const Point anchor, + const Scalar delta, int borderType, const Scalar borderValue, GMat *rval); +CvStatus *gapi_Sobel(const GMat src, int ddepth, int dx, int dy, int ksize, double scale, double delta, + int borderType, const Scalar borderValue, GMat *rval); +CvStatus *gapi_SobelXY(const GMat src, int ddepth, int order, int ksize, double scale, double delta, + int borderType, const Scalar borderValue, GMat *rval, GMat *rval1); + +// Graph API: Converting image from one color space to another +CvStatus *gapi_BayerGR2RGB(const GMat src_gr, GMat *rval); +CvStatus *gapi_BGR2Gray(const GMat src, GMat *rval); +CvStatus *gapi_BGR2I420(const GMat src, GMat *rval); +CvStatus *gapi_BGR2LUV(const GMat src, GMat *rval); +CvStatus *gapi_BGR2RGB(const GMat src, GMat *rval); +CvStatus *gapi_BGR2YUV(const GMat src, GMat *rval); +CvStatus *gapi_I4202BGR(const GMat src, GMat *rval); +CvStatus *gapi_I4202RGB(const GMat src, GMat *rval); +CvStatus *gapi_LUV2BGR(const GMat src, GMat *rval); +CvStatus *gapi_NV12toBGR(const GMat src_y, const GMat src_uv, GMat *rval); +CvStatus *gapi_NV12toBGRp(const GMat src_y, const GMat src_uv, GMat *rval); +CvStatus *gapi_NV12toGray(const GMat src_y, const GMat src_uv, GMat *rval); +CvStatus *gapi_NV12toRGB(const GMat src_y, const GMat src_uv, GMat *rval); +CvStatus *gapi_NV12toRGBp(const GMat src_y, const GMat src_uv, GMat *rval); +CvStatus *gapi_RGB2Gray(const GMat src, GMat *rval); +CvStatus *gapi_RGB2Gray_1(const GMat src, float rY, float gY, float bY, GMat *rval); +CvStatus *gapi_RGB2HSV(const GMat src, GMat *rval); +CvStatus *gapi_RGB2I420(const GMat src, GMat *rval); +CvStatus *gapi_RGB2Lab(const GMat src, GMat *rval); +CvStatus *gapi_RGB2YUV(const GMat src, GMat *rval); +CvStatus *gapi_RGB2YUV422(const GMat src, GMat *rval); +CvStatus *gapi_YUV2BGR(const GMat src, GMat *rval); +CvStatus *gapi_YUV2RGB(const GMat src, GMat *rval); + +// Graph API: Image Feature Detection +CvStatus *gapi_Canny(const GMat image, double threshold1, double threshold2, int apertureSize, + bool L2gradient, GMat *rval); +CvStatus *gapi_goodFeaturesToTrack(const GMat image, int maxCorners, double qualityLevel, double minDistance, + const Mat mask, int blockSize, bool useHarrisDetector, double k); + +// Graph API: Image Structural Analysis and Shape Descriptors +CvStatus *gapi_boundingRect(const GArrayPoint2f src, GOpaqueRect *rval); +CvStatus *gapi_boundingRect_1(const GArrayPoint2i src, GOpaqueRect *rval); +CvStatus *gapi_boundingRect_2(const GMat src, GOpaqueRect *rval); +CvStatus *gapi_findContours(const GMat src, const int mode, const int method, GArrayGArrayPoint *rval); +CvStatus *gapi_findContours_1(const GMat src, const int mode, const int method, const GOpaquePoint offset, + GArrayGArrayPoint *rval); +CvStatus *gapi_findContoursH(const GMat src, const int mode, const int method, GArrayGArrayPoint *rval, + GArrayVec4i *rval1); +CvStatus *gapi_findContoursH_1(const GMat src, const int mode, const int method, const GOpaquePoint offset, + GArrayGArrayPoint *rval, GArrayVec4i *rval1); +CvStatus *gapi_fitLine2D(const GArrayPoint2d src, const int distType, const double param, const double reps, + const double aeps, GOpaqueVec4f *rval); +CvStatus *gapi_fitLine2D_1(const GArrayPoint2f src, const int distType, const double param, const double reps, + const double aeps, GOpaqueVec4f *rval); +CvStatus *gapi_fitLine2D_2(const GArrayPoint2i src, const int distType, const double param, const double reps, + const double aeps, GOpaqueVec4f *rval); +CvStatus *gapi_fitLine2D_3(const GMat src, const int distType, const double param, const double reps, + const double aeps, GOpaqueVec4f *rval); +CvStatus *gapi_fitLine3D_1(const GArrayPoint3d src, const int distType, const double param, const double reps, + const double aeps, GOpaqueVec4f *rval); +CvStatus *gapi_fitLine3D_2(const GArrayPoint3f src, const int distType, const double param, const double reps, + const double aeps, GOpaqueVec4f *rval); +CvStatus *gapi_fitLine3D_3(const GArrayPoint3i src, const int distType, const double param, const double reps, + const double aeps, GOpaqueVec4f *rval); +CvStatus *gapi_fitLine3D_4(const GMat src, const int distType, const double param, const double reps, + const double aeps, GOpaqueVec4f *rval); + +// Graph API: Image and channel composition functions +CvStatus *gapi_concatHor(const GMat src1, const GMat src2, GMat *rval); +// CvStatus *gapi_concatHor_1(const VecGMat v, GMat *rval); +CvStatus *gapi_concatVert(const GMat src1, const GMat src2, GMat *rval); +// CvStatus *gapi_concatVert_2(const VecGMat v, GMat *rval); +CvStatus *gapi_convertTo(const GMat src, int rdepth, double alpha, double beta, GMat *rval); +// CvStatus *gapi_copy(const GFrame in, GFrame *rval); +CvStatus *gapi_copy_1(const GMat in, GMat *rval); +CvStatus *gapi_crop(const GMat src, const Rect rect, GMat *rval); +CvStatus *gapi_flip(const GMat src, int flipCode, GMat *rval); +CvStatus *gapi_LUT(const GMat src, const Mat lut, GMat *rval); +CvStatus *gapi_merge3(const GMat src1, const GMat src2, const GMat src3, GMat *rval); +CvStatus *gapi_merge4(const GMat src1, const GMat src2, const GMat src3, const GMat src4, GMat *rval); +CvStatus *gapi_normalize(const GMat src, double alpha, double beta, int norm_type, int ddepth, GMat *rval); +CvStatus *gapi_remap(const GMat src, const Mat map1, const Mat map2, int interpolation, int borderMode, + const Scalar borderValue, GMat *rval); +CvStatus *gapi_resize(const GMat src, const Size dsize, double fx, double fy, int interpolation, GMat *rval); +CvStatus *gapi_resizeP(const GMat src, const Size dsize, int interpolation, GMat *rval); +CvStatus *gapi_split3(const GMat src, GMat *rval, GMat *rval1, GMat *rval2); +CvStatus *gapi_split4(const GMat src, GMat *rval, GMat *rval1, GMat *rval2, GMat *rval3); +CvStatus *gapi_warpAffine(const GMat src, const Mat M, const Size dsize, int flags, int borderMode, + const Scalar borderValue, GMat *rval); +CvStatus *gapi_warpPerspective(const GMat src, const Mat M, const Size dsize, int flags, int borderMode, + const Scalar borderValue, GMat *rval); + +// G-API Video processing functionality + +// G-API Drawing and composition functionality +// CvStatus *gapi_wip_draw_render(cv::Mat bgr, const Prims prims /*, cv::GCompileArgs args*/); +// CvStatus *gapi_wip_draw_render_1(cv::Mat y_plane, cv::Mat uv_plane, +// const Prims prims /*, cv::GCompileArgs args = {}*/); +// CvStatus *gapi_wip_draw_render_2(cv::MediaFrame frame, const Prims prims /*, cv::GCompileArgs args = {}*/); +// CvStatus *gapi_wip_draw_render3ch(const GMat src, const GArrayPrim prims, GMat *rval); +// CvStatus *gapi_wip_draw_renderNV12(const GMat y, const GMat uv, const GArrayPrim prims, GMat *rval, +// GMat *rval1); #ifdef __cplusplus } diff --git a/src/imgcodecs/imgcodecs_async.cpp b/src/imgcodecs/imgcodecs_async.cpp new file mode 100644 index 00000000..51e9a5dd --- /dev/null +++ b/src/imgcodecs/imgcodecs_async.cpp @@ -0,0 +1,47 @@ +#include "imgcodecs_async.h" +#include "core/types.h" + +CvStatus *Image_IMRead_Async(const char *filename, int flags, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(cv::imread(filename, flags))}); + END_WRAP +} + +CvStatus *Image_IMWrite_Async(const char *filename, Mat img, CvCallback_1 callback) { + BEGIN_WRAP + callback(new bool(cv::imwrite(filename, *img.ptr))); + END_WRAP +} + +CvStatus *Image_IMWrite_WithParams_Async( + const char *filename, Mat img, VecInt params, CvCallback_1 callback +) { + BEGIN_WRAP + callback(new bool(cv::imwrite(filename, *img.ptr, *params.ptr))); + END_WRAP +} + +CvStatus *Image_IMEncode_Async(const char *fileExt, Mat img, CvCallback_2 callback) { + BEGIN_WRAP + std::vector buf; + bool success = cv::imencode(fileExt, *img.ptr, buf); + callback(new bool(success), new VecUChar{new std::vector(buf)}); + END_WRAP +} + +CvStatus *Image_IMEncode_WithParams_Async( + const char *fileExt, Mat img, VecInt params, CvCallback_2 callback +) { + BEGIN_WRAP + std::vector buf; + bool success = cv::imencode(fileExt, *img.ptr, buf, *params.ptr); + callback(new bool(success), new VecUChar{new std::vector(buf)}); + END_WRAP +} + +CvStatus *Image_IMDecode_Async(VecUChar buf, int flags, CvCallback_1 callback) { + BEGIN_WRAP + auto m = cv::imdecode(*buf.ptr, flags); + callback(new Mat{new cv::Mat(m)}); + END_WRAP +} diff --git a/src/imgcodecs/imgcodecs_async.h b/src/imgcodecs/imgcodecs_async.h new file mode 100644 index 00000000..500d189f --- /dev/null +++ b/src/imgcodecs/imgcodecs_async.h @@ -0,0 +1,30 @@ +/* + Created by Rainyl. + Licensed: Apache 2.0 license. Copyright (c) 2024 Rainyl. +*/ + +#ifndef CVD_IMGCODECS_ASYNC_H_ +#define CVD_IMGCODECS_ASYNC_H_ + +#include "core/types.h" +#include + +#ifdef __cplusplus +#include +extern "C" { +#endif + +CvStatus *Image_IMRead_Async(const char *filename, int flags, CvCallback_1 callback); +CvStatus *Image_IMWrite_Async(const char *filename, Mat img, CvCallback_1 callback); +CvStatus * +Image_IMWrite_WithParams_Async(const char *filename, Mat img, VecInt params, CvCallback_1 callback); +CvStatus *Image_IMEncode_Async(const char *fileExt, Mat img, CvCallback_2 callback); +CvStatus * +Image_IMEncode_WithParams_Async(const char *fileExt, Mat img, VecInt params, CvCallback_2 callback); +CvStatus *Image_IMDecode_Async(VecUChar buf, int flags, CvCallback_1 callback); + +#ifdef __cplusplus +} +#endif + +#endif // CVD_IMGCODECS_ASYNC_H_ diff --git a/src/imgproc/imgproc.cpp b/src/imgproc/imgproc.cpp index 132c2101..6da7633a 100644 --- a/src/imgproc/imgproc.cpp +++ b/src/imgproc/imgproc.cpp @@ -7,6 +7,7 @@ */ #include "imgproc.h" +#include "utils.hpp" #include CvStatus *ArcLength(VecPoint curve, bool is_closed, double *rval) @@ -41,10 +42,10 @@ CvStatus *CalcHist(VecMat mats, VecInt chans, Mat mask, Mat hist, VecInt sz, Vec cv::calcHist(*mats.ptr, *chans.ptr, *mask.ptr, *hist.ptr, *sz.ptr, *rng.ptr, acc); END_WRAP } -CvStatus *CalcBackProject(VecMat mats, VecInt chans, Mat hist, Mat backProject, VecFloat rng, bool uniform) +CvStatus *CalcBackProject(VecMat mats, VecInt chans, Mat hist, Mat backProject, VecFloat rng, double scale) { BEGIN_WRAP - cv::calcBackProject(*mats.ptr, *chans.ptr, *hist.ptr, *backProject.ptr, *rng.ptr, uniform); + cv::calcBackProject(*mats.ptr, *chans.ptr, *hist.ptr, *backProject.ptr, *rng.ptr, scale); END_WRAP } CvStatus *CompareHist(Mat hist1, Mat hist2, int method, double *rval) @@ -573,15 +574,6 @@ CvStatus *ApplyCustomColorMap(Mat src, Mat dst, Mat colormap) END_WRAP } -std::vector vecPointToVecPoint2f(std::vector src) -{ - std::vector v; - for (int i = 0; i < src.size(); i++) { - v.push_back(cv::Point2f(src.at(i).x, src.at(i).y)); - } - return v; -} - CvStatus *GetPerspectiveTransform(VecPoint src, VecPoint dst, Mat *rval, int solveMethod) { BEGIN_WRAP @@ -718,7 +710,7 @@ CvStatus *CLAHE_CreateWithParams(double clipLimit, Size tileGridSize, CLAHE *rva void CLAHE_Close(CLAHEPtr c) { c->ptr->reset(); - CVD_FREE(c) + CVD_FREE(c); } CvStatus *CLAHE_Apply(CLAHE c, Mat src, Mat dst) @@ -768,7 +760,7 @@ CvStatus *Subdiv2D_NewWithRect(Rect rect, Subdiv2D *rval) *rval = {new cv::Subdiv2D(cv::Rect(rect.x, rect.y, rect.width, rect.height))}; END_WRAP } -void Subdiv2D_Close(Subdiv2DPtr self){CVD_FREE(self)} +void Subdiv2D_Close(Subdiv2DPtr self) { CVD_FREE(self); } CvStatus *Subdiv2D_EdgeDst(Subdiv2D self, int edge, Point2f *dstpt, int *rval) { diff --git a/src/imgproc/imgproc.h b/src/imgproc/imgproc.h index 1f4b820b..7b5e458d 100644 --- a/src/imgproc/imgproc.h +++ b/src/imgproc/imgproc.h @@ -18,20 +18,22 @@ extern "C" { #endif #ifdef __cplusplus -CVD_TYPEDEF(cv::Ptr, CLAHE) -CVD_TYPEDEF(cv::Subdiv2D, Subdiv2D) +CVD_TYPEDEF(cv::Ptr, CLAHE); +CVD_TYPEDEF(cv::Subdiv2D, Subdiv2D); #else -CVD_TYPEDEF(void, CLAHE) -CVD_TYPEDEF(void, Subdiv2D) +CVD_TYPEDEF(void, CLAHE); +CVD_TYPEDEF(void, Subdiv2D); #endif CvStatus *ArcLength(VecPoint curve, bool is_closed, CVD_OUT double *rval); CvStatus *ApproxPolyDP(VecPoint curve, double epsilon, bool closed, CVD_OUT VecPoint *rval); CvStatus *CvtColor(Mat src, CVD_OUT Mat dst, int code); CvStatus *EqualizeHist(Mat src, CVD_OUT Mat dst); -CvStatus *CalcHist(VecMat mats, VecInt chans, Mat mask, CVD_OUT Mat hist, VecInt sz, VecFloat rng, bool acc); -CvStatus *CalcBackProject(VecMat mats, VecInt chans, CVD_OUT Mat hist, Mat backProject, VecFloat rng, - bool uniform); +CvStatus * +CalcHist(VecMat mats, VecInt chans, Mat mask, CVD_OUT Mat hist, VecInt sz, VecFloat rng, bool acc); +CvStatus *CalcBackProject( + VecMat mats, VecInt chans, CVD_OUT Mat hist, Mat backProject, VecFloat rng, double scale +); CvStatus *CompareHist(Mat hist1, Mat hist2, int method, CVD_OUT double *rval); CvStatus *ConvexHull(VecPoint points, CVD_OUT Mat hull, bool clockwise, bool returnPoints); CvStatus *ConvexityDefects(VecPoint points, Mat hull, Mat result); @@ -40,12 +42,15 @@ CvStatus *Blur(Mat src, Mat dst, Size ps); CvStatus *BoxFilter(Mat src, Mat dst, int ddepth, Size ps); CvStatus *SqBoxFilter(Mat src, Mat dst, int ddepth, Size ps); CvStatus *Dilate(Mat src, Mat dst, Mat kernel); -CvStatus *DilateWithParams(Mat src, Mat dst, Mat kernel, Point anchor, int iterations, int borderType, - Scalar borderValue); -CvStatus *DistanceTransform(Mat src, Mat dst, Mat labels, int distanceType, int maskSize, int labelType); +CvStatus *DilateWithParams( + Mat src, Mat dst, Mat kernel, Point anchor, int iterations, int borderType, Scalar borderValue +); +CvStatus * +DistanceTransform(Mat src, Mat dst, Mat labels, int distanceType, int maskSize, int labelType); CvStatus *Erode(Mat src, Mat dst, Mat kernel); -CvStatus *ErodeWithParams(Mat src, Mat dst, Mat kernel, Point anchor, int iterations, int borderType, - Scalar borderValue); +CvStatus *ErodeWithParams( + Mat src, Mat dst, Mat kernel, Point anchor, int iterations, int borderType, Scalar borderValue +); CvStatus *MatchTemplate(Mat image, Mat templ, Mat result, int method, Mat mask); CvStatus *Moments(Mat src, bool binaryImage, Moment *rval); CvStatus *PyrDown(Mat src, Mat dst, Size dstsize, int borderType); @@ -58,76 +63,198 @@ CvStatus *FitEllipse(VecPoint pts, RotatedRect *rval); CvStatus *MinEnclosingCircle(VecPoint pts, Point2f *center, float *radius); CvStatus *FindContours(Mat src, Mat hierarchy, int mode, int method, VecVecPoint *rval); CvStatus *PointPolygonTest(VecPoint pts, Point2f pt, bool measureDist, double *rval); -CvStatus *ConnectedComponents(Mat src, Mat dst, int connectivity, int ltype, int ccltype, int *rval); -CvStatus *ConnectedComponentsWithStats(Mat src, Mat labels, Mat stats, Mat centroids, int connectivity, - int ltype, int ccltype, int *rval); +CvStatus * +ConnectedComponents(Mat src, Mat dst, int connectivity, int ltype, int ccltype, int *rval); +CvStatus *ConnectedComponentsWithStats( + Mat src, + Mat labels, + Mat stats, + Mat centroids, + int connectivity, + int ltype, + int ccltype, + int *rval +); CvStatus *GaussianBlur(Mat src, Mat dst, Size ps, double sX, double sY, int bt); CvStatus *GetGaussianKernel(int ksize, double sigma, int ktype, Mat *rval); -CvStatus *Laplacian(Mat src, Mat dst, int dDepth, int kSize, double scale, double delta, int borderType); -CvStatus *Scharr(Mat src, Mat dst, int dDepth, int dx, int dy, double scale, double delta, int borderType); +CvStatus * +Laplacian(Mat src, Mat dst, int dDepth, int kSize, double scale, double delta, int borderType); +CvStatus * +Scharr(Mat src, Mat dst, int dDepth, int dx, int dy, double scale, double delta, int borderType); CvStatus *GetStructuringElement(int shape, Size ksize, Mat *rval); CvStatus *MorphologyDefaultBorderValue(Scalar *rval); CvStatus *MorphologyEx(Mat src, Mat dst, int op, Mat kernel); -CvStatus *MorphologyExWithParams(Mat src, Mat dst, int op, Mat kernel, Point pt, int iterations, - int borderType, Scalar borderValue); +CvStatus *MorphologyExWithParams( + Mat src, + Mat dst, + int op, + Mat kernel, + Point pt, + int iterations, + int borderType, + Scalar borderValue +); CvStatus *MedianBlur(Mat src, Mat dst, int ksize); CvStatus *Canny(Mat src, Mat edges, double t1, double t2, int apertureSize, bool l2gradient); -CvStatus *CornerSubPix(Mat img, VecPoint2f corners, Size winSize, Size zeroZone, TermCriteria criteria); -CvStatus *GoodFeaturesToTrack(Mat img, VecPoint2f *corners, int maxCorners, double quality, double minDist, - Mat mask, int blockSize, bool useHarrisDetector, double k); -CvStatus *GoodFeaturesToTrackWithGradient(Mat img, VecPoint2f *corners, int maxCorners, double quality, - double minDist, Mat mask, int blockSize, int gradientSize, - bool useHarrisDetector, double k); -CvStatus *GrabCut(Mat img, Mat mask, Rect rect, Mat bgdModel, Mat fgdModel, int iterCount, int mode); +CvStatus * +CornerSubPix(Mat img, VecPoint2f corners, Size winSize, Size zeroZone, TermCriteria criteria); +CvStatus *GoodFeaturesToTrack( + Mat img, + VecPoint2f *corners, + int maxCorners, + double quality, + double minDist, + Mat mask, + int blockSize, + bool useHarrisDetector, + double k +); +CvStatus *GoodFeaturesToTrackWithGradient( + Mat img, + VecPoint2f *corners, + int maxCorners, + double quality, + double minDist, + Mat mask, + int blockSize, + int gradientSize, + bool useHarrisDetector, + double k +); +CvStatus * +GrabCut(Mat img, Mat mask, Rect rect, Mat bgdModel, Mat fgdModel, int iterCount, int mode); CvStatus *HoughCircles(Mat src, Mat circles, int method, double dp, double minDist); -CvStatus *HoughCirclesWithParams(Mat src, Mat circles, int method, double dp, double minDist, double param1, - double param2, int minRadius, int maxRadius); -CvStatus *HoughLines(Mat src, Mat lines, double rho, double theta, int threshold, double srn, double stn, - double min_theta, double max_theta); +CvStatus *HoughCirclesWithParams( + Mat src, + Mat circles, + int method, + double dp, + double minDist, + double param1, + double param2, + int minRadius, + int maxRadius +); +CvStatus *HoughLines( + Mat src, + Mat lines, + double rho, + double theta, + int threshold, + double srn, + double stn, + double min_theta, + double max_theta +); CvStatus *HoughLinesP(Mat src, Mat lines, double rho, double theta, int threshold); -CvStatus *HoughLinesPWithParams(Mat src, Mat lines, double rho, double theta, int threshold, - double minLineLength, double maxLineGap); -CvStatus *HoughLinesPointSet(Mat points, Mat lines, int lines_max, int threshold, double min_rho, - double max_rho, double rho_step, double min_theta, double max_theta, - double theta_step); +CvStatus *HoughLinesPWithParams( + Mat src, + Mat lines, + double rho, + double theta, + int threshold, + double minLineLength, + double maxLineGap +); +CvStatus *HoughLinesPointSet( + Mat points, + Mat lines, + int lines_max, + int threshold, + double min_rho, + double max_rho, + double rho_step, + double min_theta, + double max_theta, + double theta_step +); CvStatus *Integral(Mat src, Mat sum, Mat sqsum, Mat tilted, int sdepth, int sqdepth); CvStatus *Threshold(Mat src, Mat dst, double thresh, double maxvalue, int typ, double *rval); -CvStatus *AdaptiveThreshold(Mat src, Mat dst, double maxValue, int adaptiveTyp, int typ, int blockSize, - double c); +CvStatus *AdaptiveThreshold( + Mat src, Mat dst, double maxValue, int adaptiveTyp, int typ, int blockSize, double c +); -CvStatus *ArrowedLine(Mat img, Point pt1, Point pt2, Scalar color, int thickness, int line_type, int shift, - double tipLength); +CvStatus *ArrowedLine( + Mat img, + Point pt1, + Point pt2, + Scalar color, + int thickness, + int line_type, + int shift, + double tipLength +); CvStatus *Circle(Mat img, Point center, int radius, Scalar color, int thickness); -CvStatus *CircleWithParams(Mat img, Point center, int radius, Scalar color, int thickness, int lineType, - int shift); -CvStatus *Ellipse(Mat img, Point center, Point axes, double angle, double startAngle, double endAngle, - Scalar color, int thickness); -CvStatus *EllipseWithParams(Mat img, Point center, Point axes, double angle, double startAngle, - double endAngle, Scalar color, int thickness, int lineType, int shift); +CvStatus *CircleWithParams( + Mat img, Point center, int radius, Scalar color, int thickness, int lineType, int shift +); +CvStatus *Ellipse( + Mat img, + Point center, + Point axes, + double angle, + double startAngle, + double endAngle, + Scalar color, + int thickness +); +CvStatus *EllipseWithParams( + Mat img, + Point center, + Point axes, + double angle, + double startAngle, + double endAngle, + Scalar color, + int thickness, + int lineType, + int shift +); CvStatus *Line(Mat img, Point pt1, Point pt2, Scalar color, int thickness, int lineType, int shift); CvStatus *Rectangle(Mat img, Rect rect, Scalar color, int thickness); -CvStatus *RectangleWithParams(Mat img, Rect rect, Scalar color, int thickness, int lineType, int shift); +CvStatus * +RectangleWithParams(Mat img, Rect rect, Scalar color, int thickness, int lineType, int shift); CvStatus *FillPoly(Mat img, VecVecPoint points, Scalar color); -CvStatus *FillPolyWithParams(Mat img, VecVecPoint points, Scalar color, int lineType, int shift, - Point offset); +CvStatus *FillPolyWithParams( + Mat img, VecVecPoint points, Scalar color, int lineType, int shift, Point offset +); CvStatus *Polylines(Mat img, VecVecPoint points, bool isClosed, Scalar color, int thickness); -CvStatus *GetTextSizeWithBaseline(const char *text, int fontFace, double fontScale, int thickness, - int *baseline, Size *rval); -CvStatus *PutText(Mat img, const char *text, Point org, int fontFace, double fontScale, Scalar color, - int thickness); -CvStatus *PutTextWithParams(Mat img, const char *text, Point org, int fontFace, double fontScale, - Scalar color, int thickness, int lineType, bool bottomLeftOrigin); +CvStatus *GetTextSizeWithBaseline( + const char *text, int fontFace, double fontScale, int thickness, int *baseline, Size *rval +); +CvStatus *PutText( + Mat img, + const char *text, + Point org, + int fontFace, + double fontScale, + Scalar color, + int thickness +); +CvStatus *PutTextWithParams( + Mat img, + const char *text, + Point org, + int fontFace, + double fontScale, + Scalar color, + int thickness, + int lineType, + bool bottomLeftOrigin +); CvStatus *Resize(Mat src, Mat dst, Size sz, double fx, double fy, int interp); CvStatus *GetRectSubPix(Mat src, Size patchSize, Point2f center, Mat dst); CvStatus *GetRotationMatrix2D(Point2f center, double angle, double scale, Mat *rval); CvStatus *WarpAffine(Mat src, Mat dst, Mat rot_mat, Size dsize); -CvStatus *WarpAffineWithParams(Mat src, Mat dst, Mat rot_mat, Size dsize, int flags, int borderMode, - Scalar borderValue); +CvStatus *WarpAffineWithParams( + Mat src, Mat dst, Mat rot_mat, Size dsize, int flags, int borderMode, Scalar borderValue +); CvStatus *WarpPerspective(Mat src, Mat dst, Mat m, Size dsize); -CvStatus *WarpPerspectiveWithParams(Mat src, Mat dst, Mat rot_mat, Size dsize, int flags, int borderMode, - Scalar borderValue); +CvStatus *WarpPerspectiveWithParams( + Mat src, Mat dst, Mat rot_mat, Size dsize, int flags, int borderMode, Scalar borderValue +); CvStatus *Watershed(Mat image, Mat markers); CvStatus *ApplyColorMap(Mat src, Mat dst, int colormap); CvStatus *ApplyCustomColorMap(Mat src, Mat dst, Mat colormap); @@ -135,27 +262,64 @@ CvStatus *GetPerspectiveTransform(VecPoint src, VecPoint dst, Mat *rval, int sol CvStatus *GetPerspectiveTransform2f(VecPoint2f src, VecPoint2f dst, Mat *rval, int solveMethod); CvStatus *GetAffineTransform(VecPoint src, VecPoint dst, Mat *rval); CvStatus *GetAffineTransform2f(VecPoint2f src, VecPoint2f dst, Mat *rval); -CvStatus *FindHomography(Mat src, Mat dst, int method, double ransacReprojThreshold, Mat mask, - const int maxIters, const double confidence, Mat *rval); +CvStatus *FindHomography( + Mat src, + Mat dst, + int method, + double ransacReprojThreshold, + Mat mask, + const int maxIters, + const double confidence, + Mat *rval +); CvStatus *DrawContours(Mat src, VecVecPoint contours, int contourIdx, Scalar color, int thickness); -CvStatus *DrawContoursWithParams(Mat src, VecVecPoint contours, int contourIdx, Scalar color, int thickness, - int lineType, Mat hierarchy, int maxLevel, Point offset); -CvStatus *Sobel(Mat src, Mat dst, int ddepth, int dx, int dy, int ksize, double scale, double delta, - int borderType); +CvStatus *DrawContoursWithParams( + Mat src, + VecVecPoint contours, + int contourIdx, + Scalar color, + int thickness, + int lineType, + Mat hierarchy, + int maxLevel, + Point offset +); +CvStatus *Sobel( + Mat src, + Mat dst, + int ddepth, + int dx, + int dy, + int ksize, + double scale, + double delta, + int borderType +); CvStatus *SpatialGradient(Mat src, Mat dx, Mat dy, int ksize, int borderType); -CvStatus *Remap(Mat src, Mat dst, Mat map1, Mat map2, int interpolation, int borderMode, Scalar borderValue); -CvStatus *Filter2D(Mat src, Mat dst, int ddepth, Mat kernel, Point anchor, double delta, int borderType); -CvStatus *SepFilter2D(Mat src, Mat dst, int ddepth, Mat kernelX, Mat kernelY, Point anchor, double delta, - int borderType); +CvStatus * +Remap(Mat src, Mat dst, Mat map1, Mat map2, int interpolation, int borderMode, Scalar borderValue); +CvStatus * +Filter2D(Mat src, Mat dst, int ddepth, Mat kernel, Point anchor, double delta, int borderType); +CvStatus *SepFilter2D( + Mat src, + Mat dst, + int ddepth, + Mat kernelX, + Mat kernelY, + Point anchor, + double delta, + int borderType +); CvStatus *LogPolar(Mat src, Mat dst, Point2f center, double m, int flags); CvStatus *FitLine(VecPoint pts, Mat line, int distType, double param, double reps, double aeps); CvStatus *LinearPolar(Mat src, Mat dst, Point2f center, double maxRadius, int flags); -CvStatus *MatchShapes(VecPoint contour1, VecPoint contour2, int method, double parameter, double *rval); +CvStatus * +MatchShapes(VecPoint contour1, VecPoint contour2, int method, double parameter, double *rval); CvStatus *ClipLine(Rect imgRect, Point pt1, Point pt2, bool *rval); CvStatus *CLAHE_Create(CLAHE *rval); CvStatus *CLAHE_CreateWithParams(double clipLimit, Size tileGridSize, CLAHE *rval); -void CLAHE_Close(CLAHEPtr c); +void CLAHE_Close(CLAHEPtr c); CvStatus *CLAHE_Apply(CLAHE c, Mat src, Mat dst); CvStatus *CLAHE_CollectGarbage(CLAHE c); CvStatus *CLAHE_GetClipLimit(CLAHE c, double *rval); @@ -165,7 +329,7 @@ CvStatus *CLAHE_SetTilesGridSize(CLAHE c, Size size); CvStatus *Subdiv2D_NewEmpty(Subdiv2D *rval); CvStatus *Subdiv2D_NewWithRect(Rect rect, Subdiv2D *rval); -void Subdiv2D_Close(Subdiv2DPtr self); +void Subdiv2D_Close(Subdiv2DPtr self); CvStatus *Subdiv2D_EdgeDst(Subdiv2D self, int edge, Point2f *dstpt, int *rval); CvStatus *Subdiv2D_EdgeOrg(Subdiv2D self, int edge, Point2f *orgpt, int *rval); CvStatus *Subdiv2D_FindNearest(Subdiv2D self, Point2f pt, Point2f *nearestPt, int *rval); @@ -174,8 +338,9 @@ CvStatus *Subdiv2D_GetEdgeList(Subdiv2D self, Vec4f **rval, int *size); CvStatus *Subdiv2D_GetLeadingEdgeList(Subdiv2D self, VecInt *leadingEdgeList); CvStatus *Subdiv2D_GetTriangleList(Subdiv2D self, Vec6f **rval, int *size); CvStatus *Subdiv2D_GetVertex(Subdiv2D self, int vertex, int *firstEdge, Point2f *rval); -CvStatus *Subdiv2D_GetVoronoiFacetList(Subdiv2D self, VecInt idx, VecVecPoint2f *facetList, - VecPoint2f *facetCenters); +CvStatus *Subdiv2D_GetVoronoiFacetList( + Subdiv2D self, VecInt idx, VecVecPoint2f *facetList, VecPoint2f *facetCenters +); CvStatus *Subdiv2D_InitDelaunay(Subdiv2D self, Rect rect); CvStatus *Subdiv2D_Insert(Subdiv2D self, Point2f pt, int *rval); CvStatus *Subdiv2D_InsertVec(Subdiv2D self, VecPoint2f ptvec); diff --git a/src/imgproc/imgproc_async.cpp b/src/imgproc/imgproc_async.cpp new file mode 100644 index 00000000..57724077 --- /dev/null +++ b/src/imgproc/imgproc_async.cpp @@ -0,0 +1,1560 @@ +#include "imgproc_async.h" +#include "core/types.h" +#include "opencv2/core/mat.hpp" +#include "opencv2/core/matx.hpp" +#include "utils.hpp" +#include +#include + +CvStatus *ArcLength_Async(VecPoint curve, bool is_closed, CVD_OUT CvCallback_1 callback) { + BEGIN_WRAP callback(new double(cv::arcLength(*curve.ptr, is_closed))); + END_WRAP +} + +CvStatus *ApproxPolyDP_Async(VecPoint curve, double epsilon, bool closed, CvCallback_1 callback) { + BEGIN_WRAP + std::vector approxCurvePts; + cv::approxPolyDP(*curve.ptr, approxCurvePts, epsilon, closed); + callback(new VecPoint{new std::vector(approxCurvePts)}); + END_WRAP +} + +CvStatus *BilateralFilter_Async(Mat src, int d, double sc, double ss, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::bilateralFilter(*src.ptr, dst, d, sc, ss); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *Blur_Async(Mat src, Size ps, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::blur(*src.ptr, dst, cv::Size(ps.width, ps.height)); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *BoxFilter_Async(Mat src, int ddepth, Size ps, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::boxFilter(*src.ptr, dst, ddepth, cv::Size(ps.width, ps.height)); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *CvtColor_Async(Mat src, int code, CVD_OUT CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::cvtColor(*src.ptr, dst, code); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *CalcHist_Async( + VecMat mats, VecInt chans, Mat mask, VecInt sz, VecFloat rng, bool acc, CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat hist; + cv::calcHist(*mats.ptr, *chans.ptr, *mask.ptr, hist, *sz.ptr, *rng.ptr, acc); + callback(new Mat{new cv::Mat(hist)}); + END_WRAP +} + +CvStatus *CalcBackProject_Async( + VecMat mats, VecInt chans, Mat hist, VecFloat rng, double scale, CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat backProject; + cv::calcBackProject(*mats.ptr, *chans.ptr, *hist.ptr, backProject, *rng.ptr, scale); + callback(new Mat{new cv::Mat(backProject)}); + END_WRAP +} + +CvStatus *CompareHist_Async(Mat hist1, Mat hist2, int method, CVD_OUT CvCallback_1 callback) { + BEGIN_WRAP + callback(new double{cv::compareHist(*hist1.ptr, *hist2.ptr, method)}); + END_WRAP +} + +CvStatus * +ConvexHull_Async(VecPoint points, bool clockwise, bool returnPoints, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat hull; + cv::convexHull(*points.ptr, hull, clockwise, returnPoints); + callback(new Mat{new cv::Mat(hull)}); + END_WRAP +} + +CvStatus *ConvexityDefects_Async(VecPoint points, Mat hull, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat defects; + cv::convexityDefects(*points.ptr, *hull.ptr, defects); + callback(new Mat{new cv::Mat(defects)}); + END_WRAP +} + +CvStatus *SqBoxFilter_Async(Mat src, int ddepth, Size ps, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::sqrBoxFilter(*src.ptr, dst, ddepth, cv::Size(ps.width, ps.height)); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *Dilate_Async(Mat src, Mat kernel, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::dilate(*src.ptr, dst, *kernel.ptr); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *DilateWithParams_Async( + Mat src, + Mat kernel, + Point anchor, + int iterations, + int borderType, + Scalar borderValue, + CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat dst; + cv::dilate( + *src.ptr, + dst, + *kernel.ptr, + cv::Point(anchor.x, anchor.y), + iterations, + borderType, + cv::Scalar(borderValue.val1, borderValue.val2, borderValue.val3, borderValue.val4) + ); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *DistanceTransform_Async( + Mat src, int distanceType, int maskSize, int labelType, CvCallback_2 callback +) { + BEGIN_WRAP + cv::Mat dst; + cv::Mat labels; + cv::distanceTransform(*src.ptr, dst, labels, distanceType, maskSize, labelType); + callback(new Mat{new cv::Mat(dst)}, new Mat{new cv::Mat(labels)}); + END_WRAP +} + +CvStatus *EqualizeHist_Async(Mat src, CVD_OUT CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::equalizeHist(*src.ptr, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *Erode_Async(Mat src, Mat kernel, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::erode(*src.ptr, dst, *kernel.ptr); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *ErodeWithParams_Async( + Mat src, + Mat kernel, + Point anchor, + int iterations, + int borderType, + Scalar borderValue, + CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat dst; + cv::erode( + *src.ptr, + dst, + *kernel.ptr, + cv::Point(anchor.x, anchor.y), + iterations, + borderType, + cv::Scalar(borderValue.val1, borderValue.val2, borderValue.val3, borderValue.val4) + ); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *MatchTemplate_Async(Mat image, Mat templ, int method, Mat mask, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat result; + cv::matchTemplate(*image.ptr, *templ.ptr, result, method, *mask.ptr); + callback(new Mat{new cv::Mat(result)}); + END_WRAP +} + +CvStatus *Moments_Async(Mat src, bool binaryImage, CvCallback_1 callback) { + BEGIN_WRAP + cv::Moments m = cv::moments(*src.ptr, binaryImage); + callback(new Moment{ + m.m00, m.m10, m.m01, m.m20, m.m11, m.m02, m.m30, m.m21, + m.m12, m.m03, m.mu20, m.mu11, m.mu02, m.mu30, m.mu21, m.mu12, + m.mu03, m.nu20, m.nu11, m.nu02, m.nu30, m.nu21, m.nu12, m.nu03, + }); + END_WRAP +} + +CvStatus *PyrDown_Async(Mat src, Size dstsize, int borderType, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::pyrDown(*src.ptr, dst, cv::Size(dstsize.width, dstsize.height), borderType); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *PyrUp_Async(Mat src, Size dstsize, int borderType, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::pyrUp(*src.ptr, dst, cv::Size(dstsize.width, dstsize.height), borderType); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *BoundingRect_Async(VecPoint pts, CvCallback_1 callback) { + BEGIN_WRAP + cv::Rect r = cv::boundingRect(*pts.ptr); + callback(new Rect{r.x, r.y, r.width, r.height}); + END_WRAP +} + +CvStatus *BoxPoints_Async(RotatedRect rect, CvCallback_1 callback) { + BEGIN_WRAP + /// bottom left, top left, top right, bottom right + auto mat = cv::Mat(); + std::vector vec; + auto center = cv::Point2f(rect.center.x, rect.center.y); + auto size = cv::Size2f(rect.size.width, rect.size.height); + cv::boxPoints(cv::RotatedRect(center, size, rect.angle), mat); + for (int i = 0; i < mat.rows; i++) { + vec.push_back(cv::Point2f(mat.at(i, 0), mat.at(i, 1))); + } + callback(new VecPoint2f{new std::vector(vec)}); + END_WRAP +} + +CvStatus *ContourArea_Async(VecPoint pts, CvCallback_1 callback) { + BEGIN_WRAP + callback(new double(cv::contourArea(*pts.ptr))); + END_WRAP +} + +CvStatus *MinAreaRect_Async(VecPoint pts, CvCallback_1 callback) { + BEGIN_WRAP + auto r = cv::minAreaRect(*pts.ptr); + callback(new RotatedRect{{r.center.x, r.center.y}, {r.size.width, r.size.height}, r.angle}); + END_WRAP +} + +CvStatus *FitEllipse_Async(VecPoint pts, CvCallback_1 callback) { + BEGIN_WRAP + auto r = cv::fitEllipse(*pts.ptr); + callback(new RotatedRect{{r.center.x, r.center.y}, {r.size.width, r.size.height}, r.angle}); + END_WRAP +} + +CvStatus *MinEnclosingCircle_Async(VecPoint pts, CvCallback_2 callback) { + BEGIN_WRAP + cv::Point2f c; + float r; + cv::minEnclosingCircle(*pts.ptr, c, r); + callback(new Point2f{c.y, c.x}, new float(r)); + END_WRAP +} + +CvStatus *FindContours_Async(Mat src, int mode, int method, CvCallback_2 callback) { + BEGIN_WRAP + std::vector> contours; + // std::vector hierarchy; + cv::Mat hierarchy; + cv::findContours(*src.ptr, contours, hierarchy, mode, method); + callback( + new VecVecPoint{new std::vector>(contours)}, + new Mat{new cv::Mat(hierarchy)} + ); + END_WRAP +} + +CvStatus * +PointPolygonTest_Async(VecPoint pts, Point2f pt, bool measureDist, CvCallback_1 callback) { + BEGIN_WRAP + callback(new double(cv::pointPolygonTest(*pts.ptr, cv::Point2f(pt.x, pt.y), measureDist))); + END_WRAP +} + +CvStatus *ConnectedComponents_Async( + Mat src, int connectivity, int ltype, int ccltype, CvCallback_2 callback +) { + BEGIN_WRAP + cv::Mat dst; + int rval = cv::connectedComponents(*src.ptr, dst, connectivity, ltype, ccltype); + callback(new int(rval), new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *ConnectedComponentsWithStats_Async( + Mat src, int connectivity, int ltype, int ccltype, CvCallback_4 callback +) { + BEGIN_WRAP + cv::Mat labels, stats, centroids; + int rval = cv::connectedComponentsWithStats( + *src.ptr, labels, stats, centroids, connectivity, ltype, ccltype + ); + callback( + new int(rval), + new Mat{new cv::Mat(labels)}, + new Mat{new cv::Mat(stats)}, + new Mat{new cv::Mat(centroids)} + ); + END_WRAP +} + +CvStatus * +GaussianBlur_Async(Mat src, Size ps, double sX, double sY, int bt, CVD_OUT CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::GaussianBlur(*src.ptr, dst, cv::Size(ps.width, ps.height), sX, sY, bt); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *GetGaussianKernel_Async(int ksize, double sigma, int ktype, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(cv::getGaussianKernel(ksize, sigma, ktype))}); + END_WRAP +} + +CvStatus *Laplacian_Async( + Mat src, + int dDepth, + int kSize, + double scale, + double delta, + int borderType, + CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat dst; + cv::Laplacian(*src.ptr, dst, dDepth, kSize, scale, delta, borderType); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *Scharr_Async( + Mat src, + int dDepth, + int dx, + int dy, + double scale, + double delta, + int borderType, + CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat dst; + cv::Scharr(*src.ptr, dst, dDepth, dx, dy, scale, delta, borderType); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *GetStructuringElement_Async(int shape, Size ksize, Point anchor, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat element = cv::getStructuringElement( + shape, cv::Size(ksize.width, ksize.height), cv::Point(anchor.x, anchor.y) + ); + callback(new Mat{new cv::Mat(element)}); + END_WRAP +} + +CvStatus *MorphologyDefaultBorderValue_Async(CvCallback_1 callback) { + BEGIN_WRAP + auto scalar = cv::morphologyDefaultBorderValue(); + callback(new Scalar{scalar.val[0], scalar.val[1], scalar.val[2], scalar.val[3]}); + END_WRAP +} + +CvStatus *MorphologyEx_Async(Mat src, int op, Mat kernel, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::morphologyEx(*src.ptr, dst, op, *kernel.ptr); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *MorphologyExWithParams_Async( + Mat src, + int op, + Mat kernel, + Point pt, + int iterations, + int borderType, + Scalar borderValue, + CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat dst; + auto bv = cv::Scalar(borderValue.val1, borderValue.val2, borderValue.val3, borderValue.val4); + cv::morphologyEx( + *src.ptr, dst, op, *kernel.ptr, cv::Point(pt.x, pt.y), iterations, borderType, bv + ); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *MedianBlur_Async(Mat src, int ksize, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::medianBlur(*src.ptr, dst, ksize); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *Canny_Async( + Mat src, double t1, double t2, int apertureSize, bool l2gradient, CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat dst; + cv::Canny(*src.ptr, dst, t1, t2, apertureSize, l2gradient); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *CornerSubPix_Async( + Mat img, + VecPoint2f corners, + Size winSize, + Size zeroZone, + TermCriteria criteria, + CvCallback_0 callback +) { + BEGIN_WRAP + auto size = cv::Size(winSize.width, winSize.height); + auto zone = cv::Size(zeroZone.width, zeroZone.height); + auto tc = cv::TermCriteria(criteria.type, criteria.maxCount, criteria.epsilon); + cv::cornerSubPix(*img.ptr, *corners.ptr, size, zone, tc); + // std::cout << *corners.ptr << std::endl; + callback(); + END_WRAP +} + +CvStatus *GoodFeaturesToTrack_Async( + Mat img, + int maxCorners, + double quality, + double minDist, + Mat mask, + int blockSize, + bool useHarrisDetector, + double k, + CvCallback_1 callback +) { + BEGIN_WRAP + std::vector _corners; + cv::goodFeaturesToTrack( + *img.ptr, _corners, maxCorners, quality, minDist, *mask.ptr, blockSize, useHarrisDetector, k + ); + callback(new VecPoint2f{new std::vector(_corners)}); + END_WRAP +} + +CvStatus *GoodFeaturesToTrackWithGradient_Async( + Mat img, + int maxCorners, + double quality, + double minDist, + Mat mask, + int blockSize, + int gradientSize, + bool useHarrisDetector, + double k, + CvCallback_1 callback +) { + BEGIN_WRAP + std::vector _corners; + cv::goodFeaturesToTrack( + *img.ptr, + _corners, + maxCorners, + quality, + minDist, + *mask.ptr, + blockSize, + gradientSize, + useHarrisDetector, + k + ); + callback(new VecPoint2f{new std::vector(_corners)}); + END_WRAP +} + +CvStatus *GrabCut_Async( + Mat img, + Mat mask, + Rect rect, + Mat bgdModel, + Mat fgdModel, + int iterCount, + int mode, + CvCallback_0 callback +) { + BEGIN_WRAP + cv::grabCut( + *img.ptr, + *mask.ptr, + cv::Rect(rect.x, rect.y, rect.width, rect.height), + *bgdModel.ptr, + *fgdModel.ptr, + iterCount, + mode + ); + callback(); + END_WRAP +} + +CvStatus * +HoughCircles_Async(Mat src, int method, double dp, double minDist, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat circles; + cv::HoughCircles(*src.ptr, circles, method, dp, minDist); + callback(new Mat{new cv::Mat(circles)}); + END_WRAP +} + +CvStatus *HoughCirclesWithParams_Async( + Mat src, + int method, + double dp, + double minDist, + double param1, + double param2, + int minRadius, + int maxRadius, + CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat circles; + cv::HoughCircles(*src.ptr, circles, method, dp, minDist, param1, param2, minRadius, maxRadius); + callback(new Mat{new cv::Mat(circles)}); + END_WRAP +} + +CvStatus *HoughLines_Async( + Mat src, + double rho, + double theta, + int threshold, + double srn, + double stn, + double min_theta, + double max_theta, + CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat lines; + cv::HoughLines(*src.ptr, lines, rho, theta, threshold, srn, stn, min_theta, max_theta); + callback(new Mat{new cv::Mat(lines)}); + END_WRAP +} + +CvStatus * +HoughLinesP_Async(Mat src, double rho, double theta, int threshold, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat lines; + cv::HoughLinesP(*src.ptr, lines, rho, theta, threshold); + callback(new Mat{new cv::Mat(lines)}); + END_WRAP +} + +CvStatus *HoughLinesPWithParams_Async( + Mat src, + double rho, + double theta, + int threshold, + double minLineLength, + double maxLineGap, + CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat lines; + cv::HoughLinesP(*src.ptr, lines, rho, theta, threshold, minLineLength, maxLineGap); + callback(new Mat{new cv::Mat(lines)}); + END_WRAP +} + +CvStatus *HoughLinesPointSet_Async( + Mat points, + int lines_max, + int threshold, + double min_rho, + double max_rho, + double rho_step, + double min_theta, + double max_theta, + double theta_step, + CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat lines; + cv::HoughLinesPointSet( + *points.ptr, + lines, + lines_max, + threshold, + min_rho, + max_rho, + rho_step, + min_theta, + max_theta, + theta_step + ); + callback(new Mat{new cv::Mat(lines)}); + END_WRAP +} + +CvStatus *Integral_Async(Mat src, int sdepth, int sqdepth, CvCallback_3 callback) { + BEGIN_WRAP + cv::Mat sum, sqsum, tilted; + cv::integral(*src.ptr, sum, sqsum, tilted, sdepth, sqdepth); + callback(new Mat{new cv::Mat(sum)}, new Mat{new cv::Mat(sqsum)}, new Mat{new cv::Mat(tilted)}); + END_WRAP +} + +CvStatus *Threshold_Async(Mat src, double thresh, double maxvalue, int typ, CvCallback_2 callback) { + BEGIN_WRAP + cv::Mat dst; + auto rval = cv::threshold(*src.ptr, dst, thresh, maxvalue, typ); + callback(new double(rval), new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *AdaptiveThreshold_Async( + Mat src, + double maxValue, + int adaptiveTyp, + int typ, + int blockSize, + double c, + CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat dst; + cv::adaptiveThreshold(*src.ptr, dst, maxValue, adaptiveTyp, typ, blockSize, c); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *ArrowedLine_Async( + Mat img, + Point pt1, + Point pt2, + Scalar color, + int thickness, + int line_type, + int shift, + double tipLength, + CvCallback_0 callback +) { + BEGIN_WRAP + cv::arrowedLine( + *img.ptr, + cv::Point(pt1.x, pt1.y), + cv::Point(pt2.x, pt2.y), + cv::Scalar(color.val1, color.val2, color.val3, color.val4), + thickness, + line_type, + shift, + tipLength + ); + callback(); + END_WRAP +} + +CvStatus *Circle_Async( + Mat img, Point center, int radius, Scalar color, int thickness, CvCallback_0 callback +) { + BEGIN_WRAP + cv::circle( + *img.ptr, + cv::Point(center.x, center.y), + radius, + cv::Scalar(color.val1, color.val2, color.val3, color.val4), + thickness + ); + callback(); + END_WRAP +} + +CvStatus *CircleWithParams_Async( + Mat img, + Point center, + int radius, + Scalar color, + int thickness, + int lineType, + int shift, + CvCallback_0 callback +) { + BEGIN_WRAP + cv::circle( + *img.ptr, + cv::Point(center.x, center.y), + radius, + cv::Scalar(color.val1, color.val2, color.val3, color.val4), + thickness, + lineType, + shift + ); + callback(); + END_WRAP +} + +CvStatus *Ellipse_Async( + Mat img, + Point center, + Point axes, + double angle, + double startAngle, + double endAngle, + Scalar color, + int thickness, + CvCallback_0 callback +) { + BEGIN_WRAP + cv::ellipse( + *img.ptr, + cv::Point(center.x, center.y), + cv::Size(axes.x, axes.y), + angle, + startAngle, + endAngle, + cv::Scalar(color.val1, color.val2, color.val3, color.val4), + thickness + ); + callback(); + END_WRAP +} + +CvStatus *EllipseWithParams_Async( + Mat img, + Point center, + Point axes, + double angle, + double startAngle, + double endAngle, + Scalar color, + int thickness, + int lineType, + int shift, + CvCallback_0 callback +) { + BEGIN_WRAP + cv::ellipse( + *img.ptr, + cv::Point(center.x, center.y), + cv::Size(axes.x, axes.y), + angle, + startAngle, + endAngle, + cv::Scalar(color.val1, color.val2, color.val3, color.val4), + thickness, + lineType, + shift + ); + callback(); + END_WRAP +} + +CvStatus *Line_Async( + Mat img, + Point pt1, + Point pt2, + Scalar color, + int thickness, + int lineType, + int shift, + CvCallback_0 callback +) { + BEGIN_WRAP + cv::line( + *img.ptr, + cv::Point(pt1.x, pt1.y), + cv::Point(pt2.x, pt2.y), + cv::Scalar(color.val1, color.val2, color.val3, color.val4), + thickness, + lineType, + shift + ); + callback(); + END_WRAP +} + +CvStatus *Rectangle_Async(Mat img, Rect rect, Scalar color, int thickness, CvCallback_0 callback) { + BEGIN_WRAP + cv::rectangle( + *img.ptr, + cv::Rect(rect.x, rect.y, rect.width, rect.height), + cv::Scalar(color.val1, color.val2, color.val3, color.val4), + thickness + ); + callback(); + END_WRAP +} + +CvStatus *RectangleWithParams_Async( + Mat img, Rect rect, Scalar color, int thickness, int lineType, int shift, CvCallback_0 callback +) { + BEGIN_WRAP + cv::rectangle( + *img.ptr, + cv::Rect(rect.x, rect.y, rect.width, rect.height), + cv::Scalar(color.val1, color.val2, color.val3, color.val4), + thickness, + lineType, + shift + ); + callback(); + END_WRAP +} + +CvStatus *FillPoly_Async(Mat img, VecVecPoint points, Scalar color, CvCallback_0 callback) { + BEGIN_WRAP + cv::fillPoly(*img.ptr, *points.ptr, cv::Scalar(color.val1, color.val2, color.val3, color.val4)); + callback(); + END_WRAP +} + +CvStatus *FillPolyWithParams_Async( + Mat img, + VecVecPoint points, + Scalar color, + int lineType, + int shift, + Point offset, + CvCallback_0 callback +) { + BEGIN_WRAP + cv::fillPoly( + *img.ptr, + *points.ptr, + cv::Scalar(color.val1, color.val2, color.val3, color.val4), + lineType, + shift, + cv::Point(offset.x, offset.y) + ); + callback(); + END_WRAP +} + +CvStatus *Polylines_Async( + Mat img, VecVecPoint points, bool isClosed, Scalar color, int thickness, CvCallback_0 callback +) { + BEGIN_WRAP + cv::polylines( + *img.ptr, + *points.ptr, + isClosed, + cv::Scalar(color.val1, color.val2, color.val3, color.val4), + thickness + ); + callback(); + END_WRAP +} + +CvStatus *GetTextSizeWithBaseline_Async( + const char *text, int fontFace, double fontScale, int thickness, CvCallback_2 callback +) { + BEGIN_WRAP + int baseline; + cv::Size r = cv::getTextSize(text, fontFace, fontScale, thickness, &baseline); + callback(new Size{r.width, r.height}, new int(baseline)); + END_WRAP +} + +CvStatus *PutText_Async( + Mat img, + const char *text, + Point org, + int fontFace, + double fontScale, + Scalar color, + int thickness, + CvCallback_0 callback +) { + BEGIN_WRAP + cv::putText( + *img.ptr, + text, + cv::Point(org.x, org.y), + fontFace, + fontScale, + cv::Scalar(color.val1, color.val2, color.val3, color.val4), + thickness + ); + callback(); + END_WRAP +} + +CvStatus *PutTextWithParams_Async( + Mat img, + const char *text, + Point org, + int fontFace, + double fontScale, + Scalar color, + int thickness, + int lineType, + bool bottomLeftOrigin, + CvCallback_0 callback +) { + BEGIN_WRAP + cv::putText( + *img.ptr, + text, + cv::Point(org.x, org.y), + fontFace, + fontScale, + cv::Scalar(color.val1, color.val2, color.val3, color.val4), + thickness, + lineType, + bottomLeftOrigin + ); + callback(); + END_WRAP +} + +CvStatus *Resize_Async(Mat src, Size sz, double fx, double fy, int interp, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::resize(*src.ptr, dst, cv::Size(sz.width, sz.height), fx, fy, interp); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *GetRectSubPix_Async(Mat src, Size patchSize, Point2f center, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::getRectSubPix( + *src.ptr, cv::Size(patchSize.width, patchSize.height), cv::Point2f(center.x, center.y), dst + ); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus * +GetRotationMatrix2D_Async(Point2f center, double angle, double scale, CvCallback_1 callback) { + BEGIN_WRAP + auto mat = cv::getRotationMatrix2D(cv::Point2f(center.x, center.y), angle, scale); + callback(new Mat{new cv::Mat(mat)}); + END_WRAP +} + +CvStatus *WarpAffine_Async(Mat src, Mat rot_mat, Size dsize, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::warpAffine(*src.ptr, dst, *rot_mat.ptr, cv::Size(dsize.width, dsize.height)); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *WarpAffineWithParams_Async( + Mat src, + Mat rot_mat, + Size dsize, + int flags, + int borderMode, + Scalar borderValue, + CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat dst; + cv::warpAffine( + *src.ptr, + dst, + *rot_mat.ptr, + cv::Size(dsize.width, dsize.height), + flags, + borderMode, + cv::Scalar(borderValue.val1, borderValue.val2, borderValue.val3, borderValue.val4) + ); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *WarpPerspective_Async(Mat src, Mat m, Size dsize, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::warpPerspective(*src.ptr, dst, *m.ptr, cv::Size(dsize.width, dsize.height)); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *WarpPerspectiveWithParams_Async( + Mat src, + Mat rot_mat, + Size dsize, + int flags, + int borderMode, + Scalar borderValue, + CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat dst; + cv::warpPerspective( + *src.ptr, + dst, + *rot_mat.ptr, + cv::Size(dsize.width, dsize.height), + flags, + borderMode, + cv::Scalar(borderValue.val1, borderValue.val2, borderValue.val3, borderValue.val4) + ); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *Watershed_Async(Mat image, Mat markers, CvCallback_0 callback) { + BEGIN_WRAP + cv::watershed(*image.ptr, *markers.ptr); + callback(); + END_WRAP +} + +CvStatus *ApplyColorMap_Async(Mat src, int colormap, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::applyColorMap(*src.ptr, dst, colormap); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *ApplyCustomColorMap_Async(Mat src, Mat colormap, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::applyColorMap(*src.ptr, dst, *colormap.ptr); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus * +GetPerspectiveTransform_Async(VecPoint src, VecPoint dst, int solveMethod, CvCallback_1 callback) { + BEGIN_WRAP + std::vector src2f = vecPointToVecPoint2f(*src.ptr); + std::vector dst2f = vecPointToVecPoint2f(*dst.ptr); + callback(new Mat{new cv::Mat(cv::getPerspectiveTransform(src2f, dst2f, solveMethod))}); + END_WRAP +} + +CvStatus *GetPerspectiveTransform2f_Async( + VecPoint2f src, VecPoint2f dst, int solveMethod, CvCallback_1 callback +) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(cv::getPerspectiveTransform(*src.ptr, *dst.ptr, solveMethod))}); + END_WRAP +} + +CvStatus *GetAffineTransform_Async(VecPoint src, VecPoint dst, CvCallback_1 callback) { + BEGIN_WRAP + std::vector src2f = vecPointToVecPoint2f(*src.ptr); + std::vector dst2f = vecPointToVecPoint2f(*dst.ptr); + callback(new Mat{new cv::Mat(cv::getAffineTransform(src2f, dst2f))}); + END_WRAP +} + +CvStatus *GetAffineTransform2f_Async(VecPoint2f src, VecPoint2f dst, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Mat{new cv::Mat(cv::getAffineTransform(*src.ptr, *dst.ptr))}); + END_WRAP +} + +CvStatus *FindHomography_Async( + Mat src, + Mat dst, + int method, + double ransacReprojThreshold, + const int maxIters, + const double confidence, + CvCallback_2 callback +) { + BEGIN_WRAP + cv::Mat mask; + cv::Mat out = cv::findHomography( + *src.ptr, *dst.ptr, method, ransacReprojThreshold, mask, maxIters, confidence + ); + callback(new Mat{new cv::Mat(out)}, new Mat{new cv::Mat(mask)}); + END_WRAP +} + +CvStatus *DrawContours_Async( + Mat src, + VecVecPoint contours, + int contourIdx, + Scalar color, + int thickness, + CvCallback_0 callback +) { + BEGIN_WRAP + cv::drawContours( + *src.ptr, + *contours.ptr, + contourIdx, + cv::Scalar(color.val1, color.val2, color.val3, color.val4), + thickness + ); + callback(); + END_WRAP +} + +CvStatus *DrawContoursWithParams_Async( + Mat src, + VecVecPoint contours, + int contourIdx, + Scalar color, + int thickness, + int lineType, + Mat hierarchy, + int maxLevel, + Point offset, + CvCallback_0 callback +) { + BEGIN_WRAP + cv::drawContours( + *src.ptr, + *contours.ptr, + contourIdx, + cv::Scalar(color.val1, color.val2, color.val3, color.val4), + thickness, + lineType, + *hierarchy.ptr, + maxLevel, + cv::Point(offset.x, offset.y) + ); + callback(); + END_WRAP +} + +CvStatus *Sobel_Async( + Mat src, + int ddepth, + int dx, + int dy, + int ksize, + double scale, + double delta, + int borderType, + CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat dst; + cv::Sobel(*src.ptr, dst, ddepth, dx, dy, ksize, scale, delta, borderType); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *SpatialGradient_Async(Mat src, int ksize, int borderType, CvCallback_2 callback) { + BEGIN_WRAP + cv::Mat dx, dy; + cv::spatialGradient(*src.ptr, dx, dy, ksize, borderType); + callback(new Mat{new cv::Mat(dx)}, new Mat{new cv::Mat(dy)}); + END_WRAP +} + +CvStatus *Remap_Async( + Mat src, + Mat map1, + Mat map2, + int interpolation, + int borderMode, + Scalar borderValue, + CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat dst; + cv::remap( + *src.ptr, + dst, + *map1.ptr, + *map2.ptr, + interpolation, + borderMode, + cv::Scalar(borderValue.val1, borderValue.val2, borderValue.val3, borderValue.val4) + ); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *Filter2D_Async( + Mat src, + int ddepth, + Mat kernel, + Point anchor, + double delta, + int borderType, + CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat dst; + cv::filter2D( + *src.ptr, dst, ddepth, *kernel.ptr, cv::Point(anchor.x, anchor.y), delta, borderType + ); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *SepFilter2D_Async( + Mat src, + int ddepth, + Mat kernelX, + Mat kernelY, + Point anchor, + double delta, + int borderType, + CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat dst; + cv::sepFilter2D( + *src.ptr, + dst, + ddepth, + *kernelX.ptr, + *kernelY.ptr, + cv::Point(anchor.x, anchor.y), + delta, + borderType + ); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *LogPolar_Async(Mat src, Point2f center, double m, int flags, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::logPolar(*src.ptr, dst, cv::Point2f(center.x, center.y), m, flags); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *FitLine_Async( + VecPoint pts, int distType, double param, double reps, double aeps, CvCallback_1 callback +) { + BEGIN_WRAP + cv::Mat dst; + cv::fitLine(*pts.ptr, dst, distType, param, reps, aeps); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus * +LinearPolar_Async(Mat src, Point2f center, double maxRadius, int flags, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::linearPolar(*src.ptr, dst, cv::Point2f(center.x, center.y), maxRadius, flags); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *MatchShapes_Async( + VecPoint contour1, VecPoint contour2, int method, double parameter, CvCallback_1 callback +) { + BEGIN_WRAP + auto rval = cv::matchShapes(*contour1.ptr, *contour2.ptr, method, parameter); + callback(new double{rval}); + END_WRAP +} + +CvStatus *ClipLine_Async(Rect imgRect, Point pt1, Point pt2, CvCallback_1 callback) { + BEGIN_WRAP + auto sz = cv::Rect(imgRect.x, imgRect.y, imgRect.width, imgRect.height); + cv::Point p1(pt1.x, pt1.y); + cv::Point p2(pt2.x, pt2.y); + auto rval = cv::clipLine(sz, p1, p2); + callback(new bool{rval}); + END_WRAP +} + +CvStatus *CLAHE_Create_Async(CvCallback_1 callback) { + BEGIN_WRAP + callback(new CLAHE{new cv::Ptr(cv::createCLAHE())}); + END_WRAP +} + +CvStatus *CLAHE_CreateWithParams_Async(double clipLimit, Size tileGridSize, CvCallback_1 callback) { + BEGIN_WRAP + callback(new CLAHE{new cv::Ptr( + cv::createCLAHE(clipLimit, cv::Size(tileGridSize.width, tileGridSize.height)) + )}); + END_WRAP +} + +void CLAHE_Close_Async(CLAHEPtr self, CvCallback_0 callback) { + self->ptr->reset(); + CVD_FREE(self); + callback(); +} + +CvStatus *CLAHE_Apply_Async(CLAHE 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 *CLAHE_CollectGarbage_Async(CLAHE self, CvCallback_0 callback) { + BEGIN_WRAP(*self.ptr)->collectGarbage(); + callback(); + END_WRAP +} + +CvStatus *CLAHE_GetClipLimit_Async(CLAHE self, CvCallback_1 callback) { + BEGIN_WRAP + callback(new double((*self.ptr)->getClipLimit())); + END_WRAP +} + +CvStatus *CLAHE_SetClipLimit_Async(CLAHE self, double clipLimit, CvCallback_0 callback) { + BEGIN_WRAP(*self.ptr)->setClipLimit(clipLimit); + callback(); + END_WRAP +} + +CvStatus *CLAHE_GetTilesGridSize_Async(CLAHE self, CvCallback_1 callback) { + BEGIN_WRAP + auto sz = (*self.ptr)->getTilesGridSize(); + callback(new Size{sz.width, sz.height}); + END_WRAP +} + +CvStatus *CLAHE_SetTilesGridSize_Async(CLAHE self, Size size, CvCallback_0 callback) { + BEGIN_WRAP(*self.ptr)->setTilesGridSize(cv::Size(size.width, size.height)); + callback(); + END_WRAP +} + +CvStatus *Subdiv2D_NewEmpty_Async(CvCallback_1 callback) { + BEGIN_WRAP + callback(new Subdiv2D{new cv::Subdiv2D()}); + END_WRAP +} + +CvStatus *Subdiv2D_NewWithRect_Async(Rect rect, CvCallback_1 callback) { + BEGIN_WRAP + callback(new Subdiv2D{new cv::Subdiv2D(cv::Rect(rect.x, rect.y, rect.width, rect.height))}); + END_WRAP +} + +void Subdiv2D_Close_Async(Subdiv2DPtr self, CvCallback_0 callback) { + CVD_FREE(self); + callback(); +} + +CvStatus *Subdiv2D_EdgeDst_Async(Subdiv2D self, int edge, CvCallback_2 callback) { + BEGIN_WRAP + auto p = cv::Point2f(); + auto rval = self.ptr->edgeDst(edge, &p); + callback(new int(rval), new Point2f{p.x, p.y}); + END_WRAP +} + +CvStatus *Subdiv2D_EdgeOrg_Async(Subdiv2D self, int edge, CvCallback_2 callback) { + BEGIN_WRAP + auto p = cv::Point2f(); + auto rval = self.ptr->edgeOrg(edge, &p); + callback(new int(rval), new Point2f{p.x, p.y}); + END_WRAP +} + +CvStatus *Subdiv2D_FindNearest_Async(Subdiv2D self, Point2f pt, CvCallback_2 callback) { + BEGIN_WRAP + auto p = cv::Point2f(); + int rval = self.ptr->findNearest(cv::Point2f(pt.x, pt.y), &p); + callback(new int(rval), new Point2f{p.x, p.y}); + END_WRAP +} + +CvStatus *Subdiv2D_GetEdge_Async(Subdiv2D self, int edge, int nextEdgeType, CvCallback_1 callback) { + BEGIN_WRAP + int rval = self.ptr->getEdge(edge, nextEdgeType); + callback(new int(rval)); + END_WRAP +} + +CvStatus *Subdiv2D_GetEdgeList_Async(Subdiv2D self, CvCallback_1 callback) { + BEGIN_WRAP + auto v = std::vector(); + self.ptr->getEdgeList(v); + callback(new VecVec4f{new std::vector(v)}); + END_WRAP +} + +CvStatus *Subdiv2D_GetLeadingEdgeList_Async(Subdiv2D self, CvCallback_1 callback) { + BEGIN_WRAP + std::vector v; + self.ptr->getLeadingEdgeList(v); + callback(new VecInt{new std::vector(v)}); + END_WRAP +} + +CvStatus *Subdiv2D_GetTriangleList_Async(Subdiv2D self, CvCallback_1 callback) { + BEGIN_WRAP + auto v = std::vector(); + self.ptr->getTriangleList(v); + callback(new VecVec6f{new std::vector(v)}); + END_WRAP +} + +CvStatus *Subdiv2D_GetVertex_Async(Subdiv2D self, int vertex, CvCallback_2 callback) { + BEGIN_WRAP + int firstEdge; + cv::Point2f p = self.ptr->getVertex(vertex, &firstEdge); + callback(new Point2f{p.x, p.y}, new int(firstEdge)); + END_WRAP +} + +CvStatus *Subdiv2D_GetVoronoiFacetList_Async(Subdiv2D self, VecInt idx, CvCallback_2 callback) { + BEGIN_WRAP + auto vf = std::vector>(); + auto vfc = std::vector(); + self.ptr->getVoronoiFacetList(*idx.ptr, vf, vfc); + callback( + new VecVecPoint2f{new std::vector>(vf)}, + new VecPoint2f{new std::vector(vfc)} + ); + END_WRAP; +} + +CvStatus *Subdiv2D_InitDelaunay_Async(Subdiv2D self, Rect rect, CvCallback_0 callback) { + BEGIN_WRAP + self.ptr->initDelaunay(cv::Rect(rect.x, rect.y, rect.width, rect.height)); + callback(); + END_WRAP +} + +CvStatus *Subdiv2D_Insert_Async(Subdiv2D self, Point2f pt, CvCallback_1 callback) { + BEGIN_WRAP + int rval = self.ptr->insert(cv::Point2f(pt.x, pt.y)); + callback(new int(rval)); + END_WRAP +} + +CvStatus *Subdiv2D_InsertVec_Async(Subdiv2D self, VecPoint2f ptvec, CvCallback_0 callback) { + BEGIN_WRAP + self.ptr->insert(*ptvec.ptr); + callback(); + END_WRAP +} + +CvStatus *Subdiv2D_Locate_Async(Subdiv2D self, Point2f pt, CvCallback_3 callback) { + BEGIN_WRAP + int edge; + int vertex; + int rval = self.ptr->locate(cv::Point2f(pt.x, pt.y), edge, vertex); + callback(new int(rval), new int(edge), new int(vertex)); + END_WRAP +} + +CvStatus *Subdiv2D_NextEdge_Async(Subdiv2D self, int edge, CvCallback_1 callback) { + BEGIN_WRAP + int rval = self.ptr->nextEdge(edge); + callback(new int(rval)); + END_WRAP +} + +CvStatus *Subdiv2D_RotateEdge_Async(Subdiv2D self, int edge, int rotate, CvCallback_1 callback) { + BEGIN_WRAP + int rval = self.ptr->rotateEdge(edge, rotate); + callback(new int(rval)); + END_WRAP +} + +CvStatus *Subdiv2D_SymEdge_Async(Subdiv2D self, int edge, CvCallback_1 callback) { + BEGIN_WRAP + int rval = self.ptr->symEdge(edge); + callback(new int(rval)); + END_WRAP +} + +CvStatus *InvertAffineTransform_Async(Mat src, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat dst; + cv::invertAffineTransform(*src.ptr, dst); + callback(new Mat{new cv::Mat(dst)}); + END_WRAP +} + +CvStatus *PhaseCorrelate_Async(Mat src1, Mat src2, Mat window, CvCallback_2 callback) { + BEGIN_WRAP + double response; + auto p = cv::phaseCorrelate(*src1.ptr, *src2.ptr, *window.ptr, &response); + // TODO: add Point2d + callback(new Point2f{static_cast(p.x), static_cast(p.y)}, new double(response)); + END_WRAP +} + +CvStatus *Mat_Accumulate_Async(Mat src, Mat dst, CvCallback_0 callback) { + BEGIN_WRAP + cv::accumulate(*src.ptr, *dst.ptr); + callback(); + END_WRAP +} + +CvStatus *Mat_AccumulateWithMask_Async(Mat src, Mat dst, Mat mask, CvCallback_0 callback) { + BEGIN_WRAP + cv::accumulate(*src.ptr, *dst.ptr, *mask.ptr); + callback(); + END_WRAP +} + +CvStatus *Mat_AccumulateSquare_Async(Mat src, Mat dst, CvCallback_0 callback) { + BEGIN_WRAP + cv::accumulateSquare(*src.ptr, *dst.ptr); + callback(); + END_WRAP +} + +CvStatus *Mat_AccumulateSquareWithMask_Async(Mat src, Mat dst, Mat mask, CvCallback_0 callback) { + BEGIN_WRAP + cv::accumulateSquare(*src.ptr, *dst.ptr, *mask.ptr); + callback(); + END_WRAP +} + +CvStatus *Mat_AccumulateProduct_Async(Mat src1, Mat src2, Mat dst, CvCallback_0 callback) { + BEGIN_WRAP + cv::accumulateProduct(*src1.ptr, *src2.ptr, *dst.ptr); + callback(); + END_WRAP +} + +CvStatus * +Mat_AccumulateProductWithMask_Async(Mat src1, Mat src2, Mat dst, Mat mask, CvCallback_0 callback) { + BEGIN_WRAP + cv::accumulateProduct(*src1.ptr, *src2.ptr, *dst.ptr, *mask.ptr); + callback(); + END_WRAP +} + +CvStatus *Mat_AccumulatedWeighted_Async(Mat src, Mat dst, double alpha, CvCallback_0 callback) { + BEGIN_WRAP + cv::accumulateWeighted(*src.ptr, *dst.ptr, alpha); + callback(); + END_WRAP +} + +CvStatus *Mat_AccumulatedWeightedWithMask_Async( + Mat src, Mat dst, double alpha, Mat mask, CvCallback_0 callback +) { + BEGIN_WRAP + cv::accumulateWeighted(*src.ptr, *dst.ptr, alpha, *mask.ptr); + callback(); + END_WRAP +} diff --git a/src/imgproc/imgproc_async.h b/src/imgproc/imgproc_async.h new file mode 100644 index 00000000..62786466 --- /dev/null +++ b/src/imgproc/imgproc_async.h @@ -0,0 +1,476 @@ +/* + Created by Rainyl. + Licensed: Apache 2.0 license. Copyright (c) 2024 Rainyl. +*/ + +#ifndef CVD_ASYNC_IMGPROC_H +#define CVD_ASYNC_IMGPROC_H + +#include "core/types.h" +#include "imgproc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +CvStatus *ArcLength_Async(VecPoint curve, bool is_closed, CVD_OUT CvCallback_1 callback); +CvStatus *ApproxPolyDP_Async(VecPoint curve, double epsilon, bool closed, CvCallback_1 callback); +CvStatus *BilateralFilter_Async(Mat src, int d, double sc, double ss, CvCallback_1 callback); +CvStatus *Blur_Async(Mat src, Size ps, CvCallback_1 callback); +CvStatus *BoxFilter_Async(Mat src, int ddepth, Size ps, CvCallback_1 callback); +CvStatus *CvtColor_Async(Mat src, int code, CVD_OUT CvCallback_1 callback); +CvStatus *CalcHist_Async( + VecMat mats, VecInt chans, Mat mask, VecInt sz, VecFloat rng, bool acc, CvCallback_1 callback +); +CvStatus *CalcBackProject_Async( + VecMat mats, VecInt chans, Mat backProject, VecFloat rng, double scale, CvCallback_1 callback +); +CvStatus *CompareHist_Async(Mat hist1, Mat hist2, int method, CVD_OUT CvCallback_1 callback); +CvStatus * +ConvexHull_Async(VecPoint points, bool clockwise, bool returnPoints, CvCallback_1 callback); +CvStatus *ConvexityDefects_Async(VecPoint points, Mat hull, CvCallback_1 callback); + +CvStatus *SqBoxFilter_Async(Mat src, int ddepth, Size ps, CvCallback_1 callback); +CvStatus *Dilate_Async(Mat src, Mat kernel, CvCallback_1 callback); +CvStatus *DilateWithParams_Async( + Mat src, + Mat kernel, + Point anchor, + int iterations, + int borderType, + Scalar borderValue, + CvCallback_1 callback +); +CvStatus *DistanceTransform_Async( + Mat src, int distanceType, int maskSize, int labelType, CvCallback_2 callback +); +CvStatus *EqualizeHist_Async(Mat src, CVD_OUT CvCallback_1 callback); +CvStatus *Erode_Async(Mat src, Mat kernel, CvCallback_1 callback); +CvStatus *ErodeWithParams_Async( + Mat src, + Mat kernel, + Point anchor, + int iterations, + int borderType, + Scalar borderValue, + CvCallback_1 callback +); +CvStatus *MatchTemplate_Async(Mat image, Mat templ, int method, Mat mask, CvCallback_1 callback); +CvStatus *Moments_Async(Mat src, bool binaryImage, CvCallback_1 callback); +CvStatus *PyrDown_Async(Mat src, Size dstsize, int borderType, CvCallback_1 callback); +CvStatus *PyrUp_Async(Mat src, Size dstsize, int borderType, CvCallback_1 callback); +CvStatus *BoundingRect_Async(VecPoint pts, CvCallback_1 callback); +CvStatus *BoxPoints_Async(RotatedRect rect, CvCallback_1 callback); +CvStatus *ContourArea_Async(VecPoint pts, CvCallback_1 callback); +CvStatus *MinAreaRect_Async(VecPoint pts, CvCallback_1 callback); +CvStatus *FitEllipse_Async(VecPoint pts, CvCallback_1 callback); +CvStatus *MinEnclosingCircle_Async(VecPoint pts, CvCallback_2 callback); +CvStatus *FindContours_Async(Mat src, int mode, int method, CvCallback_2 callback); +CvStatus *PointPolygonTest_Async(VecPoint pts, Point2f pt, bool measureDist, CvCallback_1 callback); +CvStatus * +ConnectedComponents_Async(Mat src, int connectivity, int ltype, int ccltype, CvCallback_2 callback); +CvStatus *ConnectedComponentsWithStats_Async( + Mat src, int connectivity, int ltype, int ccltype, CvCallback_4 callback +); + +CvStatus *GaussianBlur_Async(Mat src, Size ps, double sX, double sY, int bt, CvCallback_1 callback); +CvStatus *GetGaussianKernel_Async(int ksize, double sigma, int ktype, CvCallback_1 callback); +CvStatus *Laplacian_Async( + Mat src, + int dDepth, + int kSize, + double scale, + double delta, + int borderType, + CvCallback_1 callback +); +CvStatus *Scharr_Async( + Mat src, + int dDepth, + int dx, + int dy, + double scale, + double delta, + int borderType, + CvCallback_1 callback +); +CvStatus *GetStructuringElement_Async(int shape, Size ksize, Point anchor, CvCallback_1 callback); +CvStatus *MorphologyDefaultBorderValue_Async(CvCallback_1 callback); +CvStatus *MorphologyEx_Async(Mat src, int op, Mat kernel, CvCallback_1 callback); +CvStatus *MorphologyExWithParams_Async( + Mat src, + int op, + Mat kernel, + Point pt, + int iterations, + int borderType, + Scalar borderValue, + CvCallback_1 callback +); +CvStatus *MedianBlur_Async(Mat src, int ksize, CvCallback_1 callback); + +CvStatus *Canny_Async( + Mat src, double t1, double t2, int apertureSize, bool l2gradient, CvCallback_1 callback +); +CvStatus *CornerSubPix_Async( + Mat img, + VecPoint2f corners, + Size winSize, + Size zeroZone, + TermCriteria criteria, + CvCallback_0 callback +); +CvStatus *GoodFeaturesToTrack_Async( + Mat img, + int maxCorners, + double quality, + double minDist, + Mat mask, + int blockSize, + bool useHarrisDetector, + double k, + CvCallback_1 callback +); +CvStatus *GoodFeaturesToTrackWithGradient_Async( + Mat img, + int maxCorners, + double quality, + double minDist, + Mat mask, + int blockSize, + int gradientSize, + bool useHarrisDetector, + double k, + CvCallback_1 callback +); +CvStatus *GrabCut_Async( + Mat img, + Mat mask, + Rect rect, + Mat bgdModel, + Mat fgdModel, + int iterCount, + int mode, + CvCallback_0 callback +); +CvStatus *HoughCircles_Async(Mat src, int method, double dp, double minDist, CvCallback_1 callback); +CvStatus *HoughCirclesWithParams_Async( + Mat src, + int method, + double dp, + double minDist, + double param1, + double param2, + int minRadius, + int maxRadius, + CvCallback_1 callback +); +CvStatus *HoughLines_Async( + Mat src, + double rho, + double theta, + int threshold, + double srn, + double stn, + double min_theta, + double max_theta, + CvCallback_1 callback +); +CvStatus * +HoughLinesP_Async(Mat src, double rho, double theta, int threshold, CvCallback_1 callback); +CvStatus *HoughLinesPWithParams_Async( + Mat src, + double rho, + double theta, + int threshold, + double minLineLength, + double maxLineGap, + CvCallback_1 callback +); +CvStatus *HoughLinesPointSet_Async( + Mat points, + int lines_max, + int threshold, + double min_rho, + double max_rho, + double rho_step, + double min_theta, + double max_theta, + double theta_step, + CvCallback_1 callback +); +CvStatus *Integral_Async(Mat src, int sdepth, int sqdepth, CvCallback_3 callback); +CvStatus *Threshold_Async(Mat src, double thresh, double maxvalue, int typ, CvCallback_2 callback); +CvStatus *AdaptiveThreshold_Async( + Mat src, + double maxValue, + int adaptiveTyp, + int typ, + int blockSize, + double c, + CvCallback_1 callback +); + +CvStatus *ArrowedLine_Async( + Mat img, + Point pt1, + Point pt2, + Scalar color, + int thickness, + int line_type, + int shift, + double tipLength, + CvCallback_0 callback +); +CvStatus * +Circle_Async(Mat img, Point center, int radius, Scalar color, int thickness, CvCallback_0 callback); +CvStatus *CircleWithParams_Async( + Mat img, + Point center, + int radius, + Scalar color, + int thickness, + int lineType, + int shift, + CvCallback_0 callback +); +CvStatus *Ellipse_Async( + Mat img, + Point center, + Point axes, + double angle, + double startAngle, + double endAngle, + Scalar color, + int thickness, + CvCallback_0 callback +); +CvStatus *EllipseWithParams_Async( + Mat img, + Point center, + Point axes, + double angle, + double startAngle, + double endAngle, + Scalar color, + int thickness, + int lineType, + int shift, + CvCallback_0 callback +); +CvStatus *Line_Async( + Mat img, + Point pt1, + Point pt2, + Scalar color, + int thickness, + int lineType, + int shift, + CvCallback_0 callback +); +CvStatus *Rectangle_Async(Mat img, Rect rect, Scalar color, int thickness, CvCallback_0 callback); +CvStatus *RectangleWithParams_Async( + Mat img, Rect rect, Scalar color, int thickness, int lineType, int shift, CvCallback_0 callback +); +CvStatus *FillPoly_Async(Mat img, VecVecPoint points, Scalar color, CvCallback_0 callback); +CvStatus *FillPolyWithParams_Async( + Mat img, + VecVecPoint points, + Scalar color, + int lineType, + int shift, + Point offset, + CvCallback_0 callback +); +CvStatus *Polylines_Async( + Mat img, VecVecPoint points, bool isClosed, Scalar color, int thickness, CvCallback_0 callback +); +CvStatus *GetTextSizeWithBaseline_Async( + const char *text, int fontFace, double fontScale, int thickness, CvCallback_2 callback +); +CvStatus *PutText_Async( + Mat img, + const char *text, + Point org, + int fontFace, + double fontScale, + Scalar color, + int thickness, + CvCallback_0 callback +); +CvStatus *PutTextWithParams_Async( + Mat img, + const char *text, + Point org, + int fontFace, + double fontScale, + Scalar color, + int thickness, + int lineType, + bool bottomLeftOrigin, + CvCallback_0 callback +); +CvStatus *Resize_Async(Mat src, Size sz, double fx, double fy, int interp, CvCallback_1 callback); +CvStatus *GetRectSubPix_Async(Mat src, Size patchSize, Point2f center, CvCallback_1 callback); +CvStatus * +GetRotationMatrix2D_Async(Point2f center, double angle, double scale, CvCallback_1 callback); +CvStatus *WarpAffine_Async(Mat src, Mat rot_mat, Size dsize, CvCallback_1 callback); +CvStatus *WarpAffineWithParams_Async( + Mat src, + Mat rot_mat, + Size dsize, + int flags, + int borderMode, + Scalar borderValue, + CvCallback_1 callback +); +CvStatus *WarpPerspective_Async(Mat src, Mat m, Size dsize, CvCallback_1 callback); +CvStatus *WarpPerspectiveWithParams_Async( + Mat src, + Mat rot_mat, + Size dsize, + int flags, + int borderMode, + Scalar borderValue, + CvCallback_1 callback +); +CvStatus *Watershed_Async(Mat image, Mat markers, CvCallback_0 callback); +CvStatus *ApplyColorMap_Async(Mat src, int colormap, CvCallback_1 callback); +CvStatus *ApplyCustomColorMap_Async(Mat src, Mat colormap, CvCallback_1 callback); +CvStatus * +GetPerspectiveTransform_Async(VecPoint src, VecPoint dst, int solveMethod, CvCallback_1 callback); +CvStatus *GetPerspectiveTransform2f_Async( + VecPoint2f src, VecPoint2f dst, int solveMethod, CvCallback_1 callback +); +CvStatus *GetAffineTransform_Async(VecPoint src, VecPoint dst, CvCallback_1 callback); +CvStatus *GetAffineTransform2f_Async(VecPoint2f src, VecPoint2f dst, CvCallback_1 callback); +CvStatus *FindHomography_Async( + Mat src, + Mat dst, + int method, + double ransacReprojThreshold, + const int maxIters, + const double confidence, + CvCallback_2 callback +); +CvStatus *DrawContours_Async( + Mat src, + VecVecPoint contours, + int contourIdx, + Scalar color, + int thickness, + CvCallback_0 callback +); +CvStatus *DrawContoursWithParams_Async( + Mat src, + VecVecPoint contours, + int contourIdx, + Scalar color, + int thickness, + int lineType, + Mat hierarchy, + int maxLevel, + Point offset, + CvCallback_0 callback +); +CvStatus *Sobel_Async( + Mat src, + int ddepth, + int dx, + int dy, + int ksize, + double scale, + double delta, + int borderType, + CvCallback_1 callback +); +CvStatus *SpatialGradient_Async(Mat src, int ksize, int borderType, CvCallback_2 callback); +CvStatus *Remap_Async( + Mat src, + Mat map1, + Mat map2, + int interpolation, + int borderMode, + Scalar borderValue, + CvCallback_1 callback +); +CvStatus *Filter2D_Async( + Mat src, + int ddepth, + Mat kernel, + Point anchor, + double delta, + int borderType, + CvCallback_1 callback +); +CvStatus *SepFilter2D_Async( + Mat src, + int ddepth, + Mat kernelX, + Mat kernelY, + Point anchor, + double delta, + int borderType, + CvCallback_1 callback +); +CvStatus *LogPolar_Async(Mat src, Point2f center, double m, int flags, CvCallback_1 callback); +CvStatus *FitLine_Async( + VecPoint pts, int distType, double param, double reps, double aeps, CvCallback_1 callback +); +CvStatus * +LinearPolar_Async(Mat src, Point2f center, double maxRadius, int flags, CvCallback_1 callback); +CvStatus *MatchShapes_Async( + VecPoint contour1, VecPoint contour2, int method, double parameter, CvCallback_1 callback +); +CvStatus *ClipLine_Async(Rect imgRect, Point pt1, Point pt2, CvCallback_1 callback); + +CvStatus *CLAHE_Create_Async(CvCallback_1 callback); +CvStatus *CLAHE_CreateWithParams_Async(double clipLimit, Size tileGridSize, CvCallback_1 callback); +void CLAHE_Close_Async(CLAHEPtr self, CvCallback_0 callback); +CvStatus *CLAHE_Apply_Async(CLAHE self, Mat src, CvCallback_1 callback); +CvStatus *CLAHE_CollectGarbage_Async(CLAHE self, CvCallback_0 callback); +CvStatus *CLAHE_GetClipLimit_Async(CLAHE self, CvCallback_1 callback); +CvStatus *CLAHE_SetClipLimit_Async(CLAHE self, double clipLimit, CvCallback_0 callback); +CvStatus *CLAHE_GetTilesGridSize_Async(CLAHE self, CvCallback_1 callback); +CvStatus *CLAHE_SetTilesGridSize_Async(CLAHE self, Size size, CvCallback_0 callback); + +CvStatus *Subdiv2D_NewEmpty_Async(CvCallback_1 callback); +CvStatus *Subdiv2D_NewWithRect_Async(Rect rect, CvCallback_1 callback); +void Subdiv2D_Close_Async(Subdiv2DPtr self, CvCallback_0 callback); +CvStatus *Subdiv2D_EdgeDst_Async(Subdiv2D self, int edge, CvCallback_2 callback); +CvStatus *Subdiv2D_EdgeOrg_Async(Subdiv2D self, int edge, CvCallback_2 callback); +CvStatus *Subdiv2D_FindNearest_Async(Subdiv2D self, Point2f pt, CvCallback_2 callback); +CvStatus *Subdiv2D_GetEdge_Async(Subdiv2D self, int edge, int nextEdgeType, CvCallback_1 callback); +CvStatus *Subdiv2D_GetEdgeList_Async(Subdiv2D self, CvCallback_1 callback); +CvStatus *Subdiv2D_GetLeadingEdgeList_Async(Subdiv2D self, CvCallback_1 callback); +CvStatus *Subdiv2D_GetTriangleList_Async(Subdiv2D self, CvCallback_1 callback); +CvStatus *Subdiv2D_GetVertex_Async(Subdiv2D self, int vertex, CvCallback_2 callback); +CvStatus *Subdiv2D_GetVoronoiFacetList_Async(Subdiv2D self, VecInt idx, CvCallback_2 callback); +CvStatus *Subdiv2D_InitDelaunay_Async(Subdiv2D self, Rect rect, CvCallback_0 callback); +CvStatus *Subdiv2D_Insert_Async(Subdiv2D self, Point2f pt, CvCallback_1 callback); +CvStatus *Subdiv2D_InsertVec_Async(Subdiv2D self, VecPoint2f ptvec, CvCallback_0 callback); +CvStatus *Subdiv2D_Locate_Async(Subdiv2D self, Point2f pt, CvCallback_3 callback); +CvStatus *Subdiv2D_NextEdge_Async(Subdiv2D self, int edge, CvCallback_1 callback); +CvStatus *Subdiv2D_RotateEdge_Async(Subdiv2D self, int edge, int rotate, CvCallback_1 callback); +CvStatus *Subdiv2D_SymEdge_Async(Subdiv2D self, int edge, CvCallback_1 callback); + +CvStatus *InvertAffineTransform_Async(Mat src, CvCallback_1 callback); +CvStatus *PhaseCorrelate_Async(Mat src1, Mat src2, Mat window, CvCallback_2 callback); + +CvStatus *Mat_Accumulate_Async(Mat src, Mat dst, CvCallback_0 callback); +CvStatus *Mat_AccumulateWithMask_Async(Mat src, Mat dst, Mat mask, CvCallback_0 callback); +CvStatus *Mat_AccumulateSquare_Async(Mat src, Mat dst, CvCallback_0 callback); +CvStatus *Mat_AccumulateSquareWithMask_Async(Mat src, Mat dst, Mat mask, CvCallback_0 callback); +CvStatus *Mat_AccumulateProduct_Async(Mat src1, Mat src2, Mat dst, CvCallback_0 callback); +CvStatus * +Mat_AccumulateProductWithMask_Async(Mat src1, Mat src2, Mat dst, Mat mask, CvCallback_0 callback); +CvStatus *Mat_AccumulatedWeighted_Async(Mat src, Mat dst, double alpha, CvCallback_0 callback); +CvStatus *Mat_AccumulatedWeightedWithMask_Async( + Mat src, Mat dst, double alpha, Mat mask, CvCallback_0 callback +); + +#ifdef __cplusplus +} +#endif + +#endif // CVD_ASYNC_IMGPROC_H diff --git a/src/imgproc/utils.hpp b/src/imgproc/utils.hpp new file mode 100644 index 00000000..e7e752bc --- /dev/null +++ b/src/imgproc/utils.hpp @@ -0,0 +1,16 @@ +#ifndef CVD_IMGPROC_UTILS_H +#define CVD_IMGPROC_UTILS_H + +#include +#include + +inline std::vector vecPointToVecPoint2f(std::vector src) +{ + std::vector v; + for (int i = 0; i < src.size(); i++) { + v.push_back(cv::Point2f(src.at(i).x, src.at(i).y)); + } + return v; +} + +#endif // CVD_IMGPROC_UTILS_H diff --git a/src/objdetect/objdetect.cpp b/src/objdetect/objdetect.cpp index 94eb3c2b..fd6d7a06 100644 --- a/src/objdetect/objdetect.cpp +++ b/src/objdetect/objdetect.cpp @@ -25,7 +25,7 @@ CvStatus *CascadeClassifier_NewFromFile(char *filename, CascadeClassifier *rval) *rval = {new cv::CascadeClassifier(filename)}; END_WRAP } -void CascadeClassifier_Close(CascadeClassifierPtr self){CVD_FREE(self)} +void CascadeClassifier_Close(CascadeClassifierPtr self) { CVD_FREE(self); } CvStatus *CascadeClassifier_Load(CascadeClassifier self, const char *name, int *rval) { @@ -125,7 +125,7 @@ CvStatus *HOGDescriptor_NewFromFile(char *filename, HOGDescriptor *rval) *rval = {new cv::HOGDescriptor(filename)}; END_WRAP } -void HOGDescriptor_Close(HOGDescriptorPtr self){CVD_FREE(self)} +void HOGDescriptor_Close(HOGDescriptorPtr self) { CVD_FREE(self); } CvStatus *HOGDescriptor_Load(HOGDescriptor self, char *name, bool *rval) { @@ -333,7 +333,7 @@ CvStatus *QRCodeDetector_detectAndDecodeCurved(QRCodeDetector self, Mat img, Vec *straight_qrcode = {new cv::Mat(_straight_qrcode)}; END_WRAP } -void QRCodeDetector_Close(QRCodeDetectorPtr self){CVD_FREE(self)} +void QRCodeDetector_Close(QRCodeDetectorPtr self) { CVD_FREE(self); } CvStatus *QRCodeDetector_DetectMulti(QRCodeDetector self, Mat input, VecPoint *points, bool *rval) { @@ -412,7 +412,7 @@ CvStatus *FaceDetectorYN_NewFromBuffer(const char *framework, VecUChar buffer, V void FaceDetectorYN_Close(FaceDetectorYNPtr self) { self->ptr->reset(); - CVD_FREE(self) + CVD_FREE(self); } CvStatus *FaceDetectorYN_Detect(FaceDetectorYN self, Mat img, Mat *faces) @@ -487,7 +487,7 @@ CvStatus *FaceRecognizerSF_New(const char *model, const char *config, int backen void FaceRecognizerSF_Close(FaceRecognizerSFPtr self) { self->ptr->reset(); - CVD_FREE(self) + CVD_FREE(self); } CvStatus *FaceRecognizerSF_AlignCrop(FaceRecognizerSF self, Mat src_img, Mat face_box, Mat *aligned_img) diff --git a/src/objdetect/objdetect.h b/src/objdetect/objdetect.h index c467475f..f8070af7 100644 --- a/src/objdetect/objdetect.h +++ b/src/objdetect/objdetect.h @@ -20,18 +20,18 @@ extern "C" { #ifdef __cplusplus // Define types for the C++ classes used -CVD_TYPEDEF(cv::CascadeClassifier, CascadeClassifier) -CVD_TYPEDEF(cv::HOGDescriptor, HOGDescriptor) -CVD_TYPEDEF(cv::QRCodeDetector, QRCodeDetector) -CVD_TYPEDEF(cv::Ptr, FaceDetectorYN) -CVD_TYPEDEF(cv::Ptr, FaceRecognizerSF) +CVD_TYPEDEF(cv::CascadeClassifier, CascadeClassifier); +CVD_TYPEDEF(cv::HOGDescriptor, HOGDescriptor); +CVD_TYPEDEF(cv::QRCodeDetector, QRCodeDetector); +CVD_TYPEDEF(cv::Ptr, FaceDetectorYN); +CVD_TYPEDEF(cv::Ptr, FaceRecognizerSF); #else // Define types for the C-compatible interface -CVD_TYPEDEF(void, CascadeClassifier) -CVD_TYPEDEF(void, HOGDescriptor) -CVD_TYPEDEF(void, QRCodeDetector) -CVD_TYPEDEF(void *, FaceDetectorYN) -CVD_TYPEDEF(void *, FaceRecognizerSF) +CVD_TYPEDEF(void, CascadeClassifier); +CVD_TYPEDEF(void, HOGDescriptor); +CVD_TYPEDEF(void, QRCodeDetector); +CVD_TYPEDEF(void *, FaceDetectorYN); +CVD_TYPEDEF(void *, FaceRecognizerSF); #endif // CascadeClassifier diff --git a/src/objdetect/objdetect_async.cpp b/src/objdetect/objdetect_async.cpp new file mode 100644 index 00000000..3bc8a89f --- /dev/null +++ b/src/objdetect/objdetect_async.cpp @@ -0,0 +1,419 @@ +#include "objdetect_async.h" +#include "core/types.h" + +// Asynchronous functions for CascadeClassifier +CvStatus *CascadeClassifier_New_Async(CvCallback_1 callback) { + BEGIN_WRAP + callback(new CascadeClassifier{new cv::CascadeClassifier()}); + END_WRAP +} + +CvStatus *CascadeClassifier_NewFromFile_Async(const char *filename, CvCallback_1 callback) { + BEGIN_WRAP + callback(new CascadeClassifier{new cv::CascadeClassifier(filename)}); + END_WRAP +} + +CvStatus *CascadeClassifier_Load_Async(CascadeClassifier self, const char *name, CvCallback_1 callback) { + BEGIN_WRAP + int rval = self.ptr->load(name); + callback(new int(rval)); + END_WRAP +} + +CvStatus *CascadeClassifier_DetectMultiScale_Async(CascadeClassifier self, Mat img, CvCallback_1 callback) { + BEGIN_WRAP + std::vector rects; + self.ptr->detectMultiScale(*img.ptr, rects); + callback(new VecRect{new std::vector(rects)}); + END_WRAP +} + +CvStatus *CascadeClassifier_DetectMultiScaleWithParams_Async(CascadeClassifier self, Mat img, double scale, int minNeighbors, int flags, Size minSize, Size maxSize, CvCallback_1 callback) { + BEGIN_WRAP + std::vector rects; + auto minsize = cv::Size(minSize.width, minSize.height); + auto maxsize = cv::Size(maxSize.width, maxSize.height); + self.ptr->detectMultiScale(*img.ptr, rects, scale, minNeighbors, flags, minsize, maxsize); + callback(new VecRect{new std::vector(rects)}); + END_WRAP +} + +CvStatus *CascadeClassifier_DetectMultiScale2_Async(CascadeClassifier self, Mat img, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize, CvCallback_2 callback) { + BEGIN_WRAP + std::vector rects; + std::vector nums; + auto minsize = cv::Size(minSize.width, minSize.height); + auto maxsize = cv::Size(maxSize.width, maxSize.height); + self.ptr->detectMultiScale(*img.ptr, rects, nums, scaleFactor, minNeighbors, flags, minsize, maxsize); + callback(new VecRect{new std::vector(rects)}, new VecInt{new std::vector(nums)}); + END_WRAP +} + +CvStatus *CascadeClassifier_DetectMultiScale3_Async(CascadeClassifier self, Mat img, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize, bool outputRejectLevels, CvCallback_3 callback) { + BEGIN_WRAP + std::vector rects; + std::vector rejects; + std::vector weights; + auto minsize = cv::Size(minSize.width, minSize.height); + auto maxsize = cv::Size(maxSize.width, maxSize.height); + self.ptr->detectMultiScale(*img.ptr, rects, rejects, weights, scaleFactor, minNeighbors, flags, minsize, maxsize, outputRejectLevels); + callback(new VecRect{new std::vector(rects)}, new VecInt{new std::vector(rejects)}, new VecDouble{new std::vector(weights)}); + END_WRAP +} + +CvStatus *CascadeClassifier_Empty_Async(CascadeClassifier self, CvCallback_1 callback) { + BEGIN_WRAP + bool rval = self.ptr->empty(); + callback(new bool(rval)); + END_WRAP +} + +CvStatus *CascadeClassifier_getFeatureType_Async(CascadeClassifier self, CvCallback_1 callback) { + BEGIN_WRAP + int rval = self.ptr->getFeatureType(); + callback(new int(rval)); + END_WRAP +} + +CvStatus *CascadeClassifier_getOriginalWindowSize_Async(CascadeClassifier self, CvCallback_1 callback) { + BEGIN_WRAP + auto sz = self.ptr->getOriginalWindowSize(); + callback(new Size{sz.width, sz.height}); + END_WRAP +} + +CvStatus *CascadeClassifier_isOldFormatCascade_Async(CascadeClassifier self, CvCallback_1 callback) { + BEGIN_WRAP + bool rval = self.ptr->isOldFormatCascade(); + callback(new bool(rval)); + END_WRAP +} + +// Asynchronous functions for HOGDescriptor +CvStatus *HOGDescriptor_New_Async(CvCallback_1 callback) { + BEGIN_WRAP + callback(new HOGDescriptor{new cv::HOGDescriptor()}); + END_WRAP +} + +CvStatus *HOGDescriptor_NewFromFile_Async(const char *filename, CvCallback_1 callback) { + BEGIN_WRAP + callback(new HOGDescriptor{new cv::HOGDescriptor(filename)}); + END_WRAP +} + +CvStatus *HOGDescriptor_Load_Async(HOGDescriptor self, const char *name, CvCallback_1 callback) { + BEGIN_WRAP + bool rval = self.ptr->load(name); + callback(new bool(rval)); + END_WRAP +} + +CvStatus *HOGDescriptor_Detect_Async(HOGDescriptor self, Mat img, double hitThresh, Size winStride, Size padding, CvCallback_3 callback) { + BEGIN_WRAP + std::vector _foundLocations; + std::vector _searchLocations; + std::vector _weights; + self.ptr->detect(*img.ptr, _foundLocations, _weights, hitThresh, cv::Point(winStride.width, winStride.height), cv::Point(padding.width, padding.height), _searchLocations); + callback(new VecPoint{new std::vector(_foundLocations)}, new VecDouble{new std::vector(_weights)}, new VecPoint{new std::vector(_searchLocations)}); + END_WRAP +} + +CvStatus *HOGDescriptor_Detect2_Async(HOGDescriptor self, Mat img, double hitThresh, Size winStride, Size padding, CvCallback_2 callback) { + BEGIN_WRAP + std::vector _foundLocations; + std::vector _searchLocations; + self.ptr->detect(*img.ptr, _foundLocations, hitThresh, cv::Point(winStride.width, winStride.height), cv::Point(padding.width, padding.height), _searchLocations); + callback(new VecPoint{new std::vector(_foundLocations)}, new VecPoint{new std::vector(_searchLocations)}); + END_WRAP +} + +CvStatus *HOGDescriptor_DetectMultiScale_Async(HOGDescriptor self, Mat img, CvCallback_1 callback) { + BEGIN_WRAP + std::vector rects; + self.ptr->detectMultiScale(*img.ptr, rects); + callback(new VecRect{new std::vector(rects)}); + END_WRAP +} + +CvStatus *HOGDescriptor_DetectMultiScaleWithParams_Async(HOGDescriptor self, Mat img, double hitThresh, Size winStride, Size padding, double scale, double finalThreshold, bool useMeanshiftGrouping, CvCallback_1 callback) { + BEGIN_WRAP + std::vector rects; + auto winstride = cv::Size(winStride.width, winStride.height); + auto pad = cv::Size(padding.width, padding.height); + self.ptr->detectMultiScale(*img.ptr, rects, hitThresh, winstride, pad, scale, finalThreshold, useMeanshiftGrouping); + callback(new VecRect{new std::vector(rects)}); + END_WRAP +} + +CvStatus *HOGDescriptor_Compute_Async(HOGDescriptor self, Mat img, Size winStride, Size padding, CvCallback_2 callback) { + BEGIN_WRAP + std::vector _descriptors; + std::vector _locations; + self.ptr->compute(*img.ptr, _descriptors, cv::Size(winStride.width, winStride.height), cv::Size(padding.width, padding.height), _locations); + callback(new VecFloat{new std::vector(_descriptors)}, new VecPoint{new std::vector(_locations)}); + END_WRAP +} + +CvStatus *HOGDescriptor_computeGradient_Async(HOGDescriptor self, Mat img, Mat grad, Mat angleOfs, Size paddingTL, Size paddingBR, CvCallback_0 callback) { + BEGIN_WRAP + self.ptr->computeGradient(*img.ptr, *grad.ptr, *angleOfs.ptr, cv::Size(paddingTL.width, paddingTL.height), cv::Size(paddingBR.width, paddingBR.height)); + callback(); + END_WRAP +} + +CvStatus *HOG_GetDefaultPeopleDetector_Async(CvCallback_1 callback) { + BEGIN_WRAP + callback(new VecFloat{new std::vector(cv::HOGDescriptor::getDefaultPeopleDetector())}); + END_WRAP +} + +CvStatus *HOGDescriptor_SetSVMDetector_Async(HOGDescriptor self, VecFloat det, CvCallback_0 callback) { + BEGIN_WRAP + self.ptr->setSVMDetector(*det.ptr); + callback(); + END_WRAP +} + +CvStatus *HOGDescriptor_getDaimlerPeopleDetector_Async(CvCallback_1 callback) { + BEGIN_WRAP + callback(new VecFloat{new std::vector(cv::HOGDescriptor::getDaimlerPeopleDetector())}); + END_WRAP +} + +CvStatus *HOGDescriptor_getDescriptorSize_Async(HOGDescriptor self, CvCallback_1 callback) { + BEGIN_WRAP + size_t rval = self.ptr->getDescriptorSize(); + callback(new size_t(rval)); + END_WRAP +} + +CvStatus *HOGDescriptor_getWinSigma_Async(HOGDescriptor self, CvCallback_1 callback) { + BEGIN_WRAP + double rval = self.ptr->getWinSigma(); + callback(new double(rval)); + END_WRAP +} + +CvStatus *HOGDescriptor_groupRectangles_Async(HOGDescriptor self, VecRect rectList, VecDouble weights, int groupThreshold, double eps, CvCallback_0 callback) { + BEGIN_WRAP + self.ptr->groupRectangles(*rectList.ptr, *weights.ptr, groupThreshold, eps); + callback(); + END_WRAP +} + +CvStatus *GroupRectangles_Async(VecRect rects, int groupThreshold, double eps, CvCallback_0 callback) { + BEGIN_WRAP + cv::groupRectangles(*rects.ptr, groupThreshold, eps); + callback(); + END_WRAP +} + +// Asynchronous functions for QRCodeDetector +CvStatus *QRCodeDetector_New_Async(CvCallback_1 callback) { + BEGIN_WRAP + callback(new QRCodeDetector{new cv::QRCodeDetector()}); + END_WRAP +} + +CvStatus *QRCodeDetector_DetectAndDecode_Async(QRCodeDetector self, Mat input, CvCallback_3 callback) { + BEGIN_WRAP + std::vector points_; + cv::Mat straight_qrcode; + auto info = self.ptr->detectAndDecode(*input.ptr, points_, straight_qrcode); + callback(new char*(strdup(info.c_str())), new VecPoint{new std::vector(points_)}, new Mat{new cv::Mat(straight_qrcode)}); + END_WRAP +} + +CvStatus *QRCodeDetector_Detect_Async(QRCodeDetector self, Mat input, CvCallback_2 callback) { + BEGIN_WRAP + std::vector _points; + bool rval = self.ptr->detect(*input.ptr, _points); + callback(new bool(rval), new VecPoint{new std::vector(_points)}); + END_WRAP +} + +CvStatus *QRCodeDetector_Decode_Async(QRCodeDetector self, Mat input, CvCallback_3 callback) { + BEGIN_WRAP + std::vector _points; + cv::Mat straight_qrcode; + auto info = self.ptr->detectAndDecode(*input.ptr, _points, straight_qrcode); + callback(new char*(strdup(info.c_str())), new VecPoint{new std::vector(_points)}, new Mat{new cv::Mat(straight_qrcode)}); + END_WRAP +} + +CvStatus *QRCodeDetector_decodeCurved_Async(QRCodeDetector self, Mat img, VecPoint points, CvCallback_2 callback) { + BEGIN_WRAP + cv::Mat _straight_qrcode; + auto ret = self.ptr->decodeCurved(*img.ptr, *points.ptr, _straight_qrcode); + callback(new char*(strdup(ret.c_str())), new Mat{new cv::Mat(_straight_qrcode)}); + END_WRAP +} + +CvStatus *QRCodeDetector_detectAndDecodeCurved_Async(QRCodeDetector self, Mat img, CvCallback_3 callback) { + BEGIN_WRAP + cv::Mat _straight_qrcode; + std::vector _points; + auto ret = self.ptr->detectAndDecodeCurved(*img.ptr, _points, _straight_qrcode); + callback(new char*(strdup(ret.c_str())), new VecPoint{new std::vector(_points)}, new Mat{new cv::Mat(_straight_qrcode)}); + END_WRAP +} + +CvStatus *QRCodeDetector_DetectMulti_Async(QRCodeDetector self, Mat input, CvCallback_2 callback) { + BEGIN_WRAP + std::vector _points; + bool rval = self.ptr->detectMulti(*input.ptr, _points); + callback(new bool(rval), new VecPoint{new std::vector(_points)}); + END_WRAP +} + +CvStatus *QRCodeDetector_DetectAndDecodeMulti_Async(QRCodeDetector self, Mat input, CvCallback_4 callback) { + BEGIN_WRAP + std::vector decodedCodes; + std::vector straightQrCodes; + std::vector points_; + bool rval = self.ptr->detectAndDecodeMulti(*input.ptr, decodedCodes, points_, straightQrCodes); + if (!rval) { + callback(new bool(rval), new VecVecChar{new std::vector>()}, new VecPoint{new std::vector()}, new VecMat{new std::vector()}); + } else { + std::vector> vecvec; + for (int i = 0; i < decodedCodes.size(); i++) { + vecvec.push_back(std::vector(decodedCodes[i].begin(), decodedCodes[i].end())); + } + callback(new bool(rval), new VecVecChar{new std::vector>(vecvec)}, new VecPoint{new std::vector(points_)}, new VecMat{new std::vector(straightQrCodes)}); + } + END_WRAP +} + +CvStatus *QRCodeDetector_setEpsX_Async(QRCodeDetector self, double epsX, CvCallback_0 callback) { + BEGIN_WRAP + self.ptr->setEpsX(epsX); + callback(); + END_WRAP +} + +CvStatus *QRCodeDetector_setEpsY_Async(QRCodeDetector self, double epsY, CvCallback_0 callback) { + BEGIN_WRAP + self.ptr->setEpsY(epsY); + callback(); + END_WRAP +} + +CvStatus *QRCodeDetector_setUseAlignmentMarkers_Async(QRCodeDetector self, bool useAlignmentMarkers, CvCallback_0 callback) { + BEGIN_WRAP + self.ptr->setUseAlignmentMarkers(useAlignmentMarkers); + callback(); + END_WRAP +} + +// Asynchronous functions for FaceDetectorYN +CvStatus *FaceDetectorYN_New_Async(const char *model, const char *config, Size input_size, float score_threshold, float nms_threshold, int top_k, int backend_id, int target_id, CvCallback_1 callback) { + BEGIN_WRAP + callback(new FaceDetectorYN{new cv::Ptr(cv::FaceDetectorYN::create(model, config, cv::Size(input_size.width, input_size.height), score_threshold, nms_threshold, top_k, backend_id, target_id))}); + END_WRAP +} + +CvStatus *FaceDetectorYN_NewFromBuffer_Async(const char *framework, VecUChar buffer, VecUChar buffer_config, Size input_size, float score_threshold, float nms_threshold, int top_k, int backend_id, int target_id, CvCallback_1 callback) { + BEGIN_WRAP + callback(new FaceDetectorYN{new cv::Ptr(cv::FaceDetectorYN::create(framework, *buffer.ptr, *buffer_config.ptr, cv::Size(input_size.width, input_size.height), score_threshold, nms_threshold, top_k, backend_id, target_id))}); + END_WRAP +} + +CvStatus *FaceDetectorYN_Detect_Async(FaceDetectorYN self, Mat img, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat faces; + (*self.ptr)->detect(*img.ptr, faces); + callback(new Mat{new cv::Mat(faces)}); + END_WRAP +} + +CvStatus *FaceDetectorYN_SetInputSize_Async(FaceDetectorYN self, Size input_size, CvCallback_0 callback) { + BEGIN_WRAP + (*self.ptr)->setInputSize(cv::Size(input_size.width, input_size.height)); + callback(); + END_WRAP +} + +CvStatus *FaceDetectorYN_GetInputSize_Async(FaceDetectorYN self, CvCallback_1 callback) { + BEGIN_WRAP + cv::Size sz = (*self.ptr)->getInputSize(); + callback(new Size{sz.width, sz.height}); + END_WRAP +} + +CvStatus *FaceDetectorYN_SetScoreThreshold_Async(FaceDetectorYN self, float score_threshold, CvCallback_0 callback) { + BEGIN_WRAP + (*self.ptr)->setScoreThreshold(score_threshold); + callback(); + END_WRAP +} + +CvStatus *FaceDetectorYN_GetScoreThreshold_Async(FaceDetectorYN self, CvCallback_1 callback) { + BEGIN_WRAP + float score_threshold = (*self.ptr)->getScoreThreshold(); + callback(new float(score_threshold)); + END_WRAP +} + +CvStatus *FaceDetectorYN_SetNMSThreshold_Async(FaceDetectorYN self, float nms_threshold, CvCallback_0 callback) { + BEGIN_WRAP + (*self.ptr)->setNMSThreshold(nms_threshold); + callback(); + END_WRAP +} + +CvStatus *FaceDetectorYN_GetNMSThreshold_Async(FaceDetectorYN self, CvCallback_1 callback) { + BEGIN_WRAP + float nms_threshold = (*self.ptr)->getNMSThreshold(); + callback(new float(nms_threshold)); + END_WRAP +} + +CvStatus *FaceDetectorYN_SetTopK_Async(FaceDetectorYN self, int top_k, CvCallback_0 callback) { + BEGIN_WRAP + (*self.ptr)->setTopK(top_k); + callback(); + END_WRAP +} + +CvStatus *FaceDetectorYN_GetTopK_Async(FaceDetectorYN self, CvCallback_1 callback) { + BEGIN_WRAP + int top_k = (*self.ptr)->getTopK(); + callback(new int(top_k)); + END_WRAP +} + +// Asynchronous functions for FaceRecognizerSF +CvStatus *FaceRecognizerSF_New_Async(const char *model, const char *config, int backend_id, int target_id, CvCallback_1 callback) { + BEGIN_WRAP + callback(new FaceRecognizerSF{new cv::Ptr(cv::FaceRecognizerSF::create(model, config, backend_id, target_id))}); + END_WRAP +} + +CvStatus *FaceRecognizerSF_AlignCrop_Async(FaceRecognizerSF self, Mat src_img, Mat face_box, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat aligned_img; + (*self.ptr)->alignCrop(*src_img.ptr, *face_box.ptr, aligned_img); + callback(new Mat{new cv::Mat(aligned_img)}); + END_WRAP +} + +CvStatus *FaceRecognizerSF_Feature_Async(FaceRecognizerSF self, Mat aligned_img, bool clone, CvCallback_1 callback) { + BEGIN_WRAP + cv::Mat face_feature; + (*self.ptr)->feature(*aligned_img.ptr, face_feature); + if (clone) { + callback(new Mat{new cv::Mat(face_feature.clone())}); + } else { + callback(new Mat{new cv::Mat(face_feature)}); + } + END_WRAP +} + +CvStatus *FaceRecognizerSF_Match_Async(FaceRecognizerSF self, Mat face_feature1, Mat face_feature2, int dis_type, CvCallback_1 callback) { + BEGIN_WRAP + double distance = (*self.ptr)->match(*face_feature1.ptr, *face_feature2.ptr, dis_type); + callback(new double(distance)); + END_WRAP +} diff --git a/src/objdetect/objdetect_async.h b/src/objdetect/objdetect_async.h new file mode 100644 index 00000000..f0eef021 --- /dev/null +++ b/src/objdetect/objdetect_async.h @@ -0,0 +1,81 @@ +/* Created by Rainyl. Licensed: Apache 2.0 license. Copyright (c) 2024 Rainyl. */ +#ifndef CVD_OBJDETECT_ASYNC_H_ +#define CVD_OBJDETECT_ASYNC_H_ + +#include "core/types.h" +#include "objdetect.h" +#include + +#ifdef __cplusplus +#include +extern "C" { +#endif + +// CascadeClassifier +CvStatus *CascadeClassifier_New_Async(CvCallback_1 callback); +CvStatus *CascadeClassifier_NewFromFile_Async(const char *filename, CvCallback_1 callback); +CvStatus *CascadeClassifier_Load_Async(CascadeClassifier self, const char *name, CvCallback_1 callback); +CvStatus *CascadeClassifier_DetectMultiScale_Async(CascadeClassifier self, Mat img, CvCallback_1 callback); +CvStatus *CascadeClassifier_DetectMultiScaleWithParams_Async(CascadeClassifier self, Mat img, double scale, int minNeighbors, int flags, Size minSize, Size maxSize, CvCallback_1 callback); +CvStatus *CascadeClassifier_DetectMultiScale2_Async(CascadeClassifier self, Mat img, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize, CvCallback_2 callback); +CvStatus *CascadeClassifier_DetectMultiScale3_Async(CascadeClassifier self, Mat img, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize, bool outputRejectLevels, CvCallback_3 callback); +CvStatus *CascadeClassifier_Empty_Async(CascadeClassifier self, CvCallback_1 callback); +CvStatus *CascadeClassifier_getFeatureType_Async(CascadeClassifier self, CvCallback_1 callback); +CvStatus *CascadeClassifier_getOriginalWindowSize_Async(CascadeClassifier self, CvCallback_1 callback); +CvStatus *CascadeClassifier_isOldFormatCascade_Async(CascadeClassifier self, CvCallback_1 callback); + +// HOGDescriptor +CvStatus *HOGDescriptor_New_Async(CvCallback_1 callback); +CvStatus *HOGDescriptor_NewFromFile_Async(const char *filename, CvCallback_1 callback); +CvStatus *HOGDescriptor_Load_Async(HOGDescriptor self, const char *name, CvCallback_1 callback); +CvStatus *HOGDescriptor_Detect_Async(HOGDescriptor self, Mat img, double hitThresh, Size winStride, Size padding, CvCallback_3 callback); +CvStatus *HOGDescriptor_Detect2_Async(HOGDescriptor self, Mat img, double hitThresh, Size winStride, Size padding, CvCallback_2 callback); +CvStatus *HOGDescriptor_DetectMultiScale_Async(HOGDescriptor self, Mat img, CvCallback_1 callback); +CvStatus *HOGDescriptor_DetectMultiScaleWithParams_Async(HOGDescriptor self, Mat img, double hitThresh, Size winStride, Size padding, double scale, double finalThreshold, bool useMeanshiftGrouping, CvCallback_1 callback); +CvStatus *HOGDescriptor_Compute_Async(HOGDescriptor self, Mat img, Size winStride, Size padding, CvCallback_2 callback); +CvStatus *HOGDescriptor_computeGradient_Async(HOGDescriptor self, Mat img, Mat grad, Mat angleOfs, Size paddingTL, Size paddingBR, CvCallback_0 callback); +CvStatus *HOG_GetDefaultPeopleDetector_Async(CvCallback_1 callback); +CvStatus *HOGDescriptor_SetSVMDetector_Async(HOGDescriptor self, VecFloat det, CvCallback_0 callback); +CvStatus *HOGDescriptor_getDaimlerPeopleDetector_Async(CvCallback_1 callback); +CvStatus *HOGDescriptor_getDescriptorSize_Async(HOGDescriptor self, CvCallback_1 callback); +CvStatus *HOGDescriptor_getWinSigma_Async(HOGDescriptor self, CvCallback_1 callback); +CvStatus *HOGDescriptor_groupRectangles_Async(HOGDescriptor self, VecRect rectList, VecDouble weights, int groupThreshold, double eps, CvCallback_0 callback); +CvStatus *GroupRectangles_Async(VecRect rects, int groupThreshold, double eps, CvCallback_0 callback); + +// QRCodeDetector +CvStatus *QRCodeDetector_New_Async(CvCallback_1 callback); +CvStatus *QRCodeDetector_DetectAndDecode_Async(QRCodeDetector self, Mat input, CvCallback_3 callback); +CvStatus *QRCodeDetector_Detect_Async(QRCodeDetector self, Mat input, CvCallback_2 callback); +CvStatus *QRCodeDetector_Decode_Async(QRCodeDetector self, Mat input, CvCallback_3 callback); +CvStatus *QRCodeDetector_decodeCurved_Async(QRCodeDetector self, Mat img, VecPoint points, CvCallback_2 callback); +CvStatus *QRCodeDetector_detectAndDecodeCurved_Async(QRCodeDetector self, Mat img, CvCallback_3 callback); +CvStatus *QRCodeDetector_DetectMulti_Async(QRCodeDetector self, Mat input, CvCallback_2 callback); +CvStatus *QRCodeDetector_DetectAndDecodeMulti_Async(QRCodeDetector self, Mat input, CvCallback_4 callback); +CvStatus *QRCodeDetector_setEpsX_Async(QRCodeDetector self, double epsX, CvCallback_0 callback); +CvStatus *QRCodeDetector_setEpsY_Async(QRCodeDetector self, double epsY, CvCallback_0 callback); +CvStatus *QRCodeDetector_setUseAlignmentMarkers_Async(QRCodeDetector self, bool useAlignmentMarkers, CvCallback_0 callback); + +// FaceDetectorYN +CvStatus *FaceDetectorYN_New_Async(const char *model, const char *config, Size input_size, float score_threshold, float nms_threshold, int top_k, int backend_id, int target_id, CvCallback_1 callback); +CvStatus *FaceDetectorYN_NewFromBuffer_Async(const char *framework, VecUChar buffer, VecUChar buffer_config, Size input_size, float score_threshold, float nms_threshold, int top_k, int backend_id, int target_id, CvCallback_1 callback); +CvStatus *FaceDetectorYN_Detect_Async(FaceDetectorYN self, Mat img, CvCallback_1 callback); +CvStatus *FaceDetectorYN_SetInputSize_Async(FaceDetectorYN self, Size input_size, CvCallback_0 callback); +CvStatus *FaceDetectorYN_GetInputSize_Async(FaceDetectorYN self, CvCallback_1 callback); +CvStatus *FaceDetectorYN_SetScoreThreshold_Async(FaceDetectorYN self, float score_threshold, CvCallback_0 callback); +CvStatus *FaceDetectorYN_GetScoreThreshold_Async(FaceDetectorYN self, CvCallback_1 callback); +CvStatus *FaceDetectorYN_SetNMSThreshold_Async(FaceDetectorYN self, float nms_threshold, CvCallback_0 callback); +CvStatus *FaceDetectorYN_GetNMSThreshold_Async(FaceDetectorYN self, CvCallback_1 callback); +CvStatus *FaceDetectorYN_SetTopK_Async(FaceDetectorYN self, int top_k, CvCallback_0 callback); +CvStatus *FaceDetectorYN_GetTopK_Async(FaceDetectorYN self, CvCallback_1 callback); + +// FaceRecognizerSF +CvStatus *FaceRecognizerSF_New_Async(const char *model, const char *config, int backend_id, int target_id, CvCallback_1 callback); +CvStatus *FaceRecognizerSF_AlignCrop_Async(FaceRecognizerSF self, Mat src_img, Mat face_box, CvCallback_1 callback); +CvStatus *FaceRecognizerSF_Feature_Async(FaceRecognizerSF self, Mat aligned_img, bool clone, CvCallback_1 callback); +CvStatus *FaceRecognizerSF_Match_Async(FaceRecognizerSF self, Mat face_feature1, Mat face_feature2, int dis_type, CvCallback_1 callback); + +#ifdef __cplusplus +} +#endif + +#endif // CVD_OBJDETECT_ASYNC_H_ diff --git a/src/photo/photo.cpp b/src/photo/photo.cpp index f01c0584..61ebe598 100644 --- a/src/photo/photo.cpp +++ b/src/photo/photo.cpp @@ -101,7 +101,7 @@ CvStatus *MergeMertens_Process(MergeMertens b, VecMat src, Mat dst) void MergeMertens_Close(MergeMertensPtr b) { b->ptr->reset(); - CVD_FREE(b) + CVD_FREE(b); } CvStatus *AlignMTB_Create(AlignMTB *rval) @@ -127,7 +127,7 @@ CvStatus *AlignMTB_Process(AlignMTB b, VecMat src, VecMat *dst) void AlignMTB_Close(AlignMTBPtr b) { b->ptr->reset(); - CVD_FREE(b) + CVD_FREE(b); } CvStatus *DetailEnhance(Mat src, Mat dst, float sigma_s, float sigma_r) diff --git a/src/photo/photo.h b/src/photo/photo.h index 57d34a17..b5597d2a 100644 --- a/src/photo/photo.h +++ b/src/photo/photo.h @@ -19,12 +19,12 @@ extern "C" { #ifdef __cplusplus /// see : https://docs.opencv.org/3.4/d7/dd6/classcv_1_1MergeMertens.html -CVD_TYPEDEF(cv::Ptr, MergeMertens) +CVD_TYPEDEF(cv::Ptr, MergeMertens); /// see : https://docs.opencv.org/master/d7/db6/classcv_1_1AlignMTB.html -CVD_TYPEDEF(cv::Ptr, AlignMTB) +CVD_TYPEDEF(cv::Ptr, AlignMTB); #else -CVD_TYPEDEF(void, MergeMertens) -CVD_TYPEDEF(void, AlignMTB) +CVD_TYPEDEF(void, MergeMertens); +CVD_TYPEDEF(void, AlignMTB); #endif CvStatus *ColorChange(Mat src, Mat mask, Mat dst, float red_mul, float green_mul, float blue_mul); diff --git a/src/photo/photo_async.cpp b/src/photo/photo_async.cpp new file mode 100644 index 00000000..55a8cad5 --- /dev/null +++ b/src/photo/photo_async.cpp @@ -0,0 +1,198 @@ +/* Created by Abdelaziz Mahdy. Licensed: Apache 2.0 license. Copyright (c) 2024 Abdelaziz Mahdy. */ +#include "photo_async.h" +#include "core/types.h" + +// Asynchronous functions for ColorChange +CvStatus *ColorChange_Async(Mat src, Mat mask, float red_mul, float green_mul, float blue_mul, CvCallback_1 callback) +{ + BEGIN_WRAP + cv::Mat _dst; + cv::colorChange(*src.ptr, *mask.ptr, _dst, red_mul, green_mul, blue_mul); + callback(new Mat{new cv::Mat(_dst)}); + END_WRAP +} + +// Asynchronous functions for SeamlessClone +CvStatus *SeamlessClone_Async(Mat src, Mat dst, Mat mask, Point p, int flags, CvCallback_1 callback) +{ + BEGIN_WRAP + cv::Mat _blend; + cv::seamlessClone(*src.ptr, *dst.ptr, *mask.ptr, cv::Point(p.x, p.y), _blend, flags); + callback(new Mat{new cv::Mat(_blend)}); + END_WRAP +} + +// Asynchronous functions for IlluminationChange +CvStatus *IlluminationChange_Async(Mat src, Mat mask, float alpha, float beta, CvCallback_1 callback) +{ + BEGIN_WRAP + cv::Mat _dst; + cv::illuminationChange(*src.ptr, *mask.ptr, _dst, alpha, beta); + callback(new Mat{new cv::Mat(_dst)}); + END_WRAP +} + +// Asynchronous functions for TextureFlattening +CvStatus *TextureFlattening_Async(Mat src, Mat mask, float low_threshold, float high_threshold, int kernel_size, CvCallback_1 callback) +{ + BEGIN_WRAP + cv::Mat _dst; + cv::textureFlattening(*src.ptr, *mask.ptr, _dst, low_threshold, high_threshold, kernel_size); + callback(new Mat{new cv::Mat(_dst)}); + END_WRAP +} + +// Asynchronous functions for FastNlMeansDenoisingColoredMulti +CvStatus *FastNlMeansDenoisingColoredMulti_Async(VecMat src, int imgToDenoiseIndex, int temporalWindowSize, CvCallback_1 callback) +{ + BEGIN_WRAP + cv::Mat _dst; + cv::fastNlMeansDenoisingColoredMulti(*src.ptr, _dst, imgToDenoiseIndex, temporalWindowSize); + callback(new Mat{new cv::Mat(_dst)}); + END_WRAP +} + +CvStatus *FastNlMeansDenoisingColoredMultiWithParams_Async(VecMat src, int imgToDenoiseIndex, int temporalWindowSize, float h, float hColor, int templateWindowSize, int searchWindowSize, CvCallback_1 callback) +{ + BEGIN_WRAP + cv::Mat _dst; + cv::fastNlMeansDenoisingColoredMulti(*src.ptr, _dst, imgToDenoiseIndex, temporalWindowSize, h, hColor, templateWindowSize, searchWindowSize); + callback(new Mat{new cv::Mat(_dst)}); + END_WRAP +} + +// Asynchronous functions for FastNlMeansDenoising +CvStatus *FastNlMeansDenoising_Async(Mat src, CvCallback_1 callback) +{ + BEGIN_WRAP + cv::Mat _dst; + cv::fastNlMeansDenoising(*src.ptr, _dst); + callback(new Mat{new cv::Mat(_dst)}); + END_WRAP +} + +CvStatus *FastNlMeansDenoisingWithParams_Async(Mat src, float h, int templateWindowSize, int searchWindowSize, CvCallback_1 callback) +{ + BEGIN_WRAP + cv::Mat _dst; + cv::fastNlMeansDenoising(*src.ptr, _dst, h, templateWindowSize, searchWindowSize); + callback(new Mat{new cv::Mat(_dst)}); + END_WRAP +} + +// Asynchronous functions for FastNlMeansDenoisingColored +CvStatus *FastNlMeansDenoisingColored_Async(Mat src, CvCallback_1 callback) +{ + BEGIN_WRAP + cv::Mat _dst; + cv::fastNlMeansDenoisingColored(*src.ptr, _dst); + callback(new Mat{new cv::Mat(_dst)}); + END_WRAP +} + +CvStatus *FastNlMeansDenoisingColoredWithParams_Async(Mat src, float h, float hColor, int templateWindowSize, int searchWindowSize, CvCallback_1 callback) +{ + BEGIN_WRAP + cv::Mat _dst; + cv::fastNlMeansDenoisingColored(*src.ptr, _dst, h, hColor, templateWindowSize, searchWindowSize); + callback(new Mat{new cv::Mat(_dst)}); + END_WRAP +} + +// Asynchronous functions for MergeMertens +CvStatus *MergeMertens_Create_Async(CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new MergeMertens{new cv::Ptr(cv::createMergeMertens())}); + END_WRAP +} + +CvStatus *MergeMertens_CreateWithParams_Async(float contrast_weight, float saturation_weight, float exposure_weight, CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new MergeMertens{new cv::Ptr(cv::createMergeMertens(contrast_weight, saturation_weight, exposure_weight))}); + END_WRAP +} + +CvStatus *MergeMertens_Process_Async(MergeMertens b, VecMat src, CvCallback_1 callback) +{ + BEGIN_WRAP + cv::Mat _dst; + (*b.ptr)->process(*src.ptr, _dst); + callback(new Mat{new cv::Mat(_dst)}); + END_WRAP +} + +// Asynchronous functions for AlignMTB +CvStatus *AlignMTB_Create_Async(CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new AlignMTB{new cv::Ptr(cv::createAlignMTB())}); + END_WRAP +} + +CvStatus *AlignMTB_CreateWithParams_Async(int max_bits, int exclude_range, bool cut, CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new AlignMTB{new cv::Ptr(cv::createAlignMTB(max_bits, exclude_range, cut))}); + END_WRAP +} + +CvStatus *AlignMTB_Process_Async(AlignMTB b, VecMat src, CvCallback_1 callback) +{ + BEGIN_WRAP + auto vec = std::vector(); + (*b.ptr)->process(*src.ptr, vec); + callback(new VecMat{new std::vector(vec)}); + END_WRAP +} + +// Asynchronous functions for DetailEnhance +CvStatus *DetailEnhance_Async(Mat src, float sigma_s, float sigma_r, CvCallback_1 callback) +{ + BEGIN_WRAP + cv::Mat _dst; + cv::detailEnhance(*src.ptr, _dst, sigma_s, sigma_r); + callback(new Mat{new cv::Mat(_dst)}); + END_WRAP +} + +// Asynchronous functions for EdgePreservingFilter +CvStatus *EdgePreservingFilter_Async(Mat src, int filter, float sigma_s, float sigma_r, CvCallback_1 callback) +{ + BEGIN_WRAP + cv::Mat _dst; + cv::edgePreservingFilter(*src.ptr, _dst, filter, sigma_s, sigma_r); + callback(new Mat{new cv::Mat(_dst)}); + END_WRAP +} + +// Asynchronous functions for PencilSketch +CvStatus *PencilSketch_Async(Mat src, float sigma_s, float sigma_r, float shade_factor, CvCallback_2 callback) +{ + BEGIN_WRAP + cv::Mat _dst1, _dst2; + cv::pencilSketch(*src.ptr, _dst1, _dst2, sigma_s, sigma_r, shade_factor); + callback(new Mat{new cv::Mat(_dst1)}, new Mat{new cv::Mat(_dst2)}); + END_WRAP +} + +// Asynchronous functions for Stylization +CvStatus *Stylization_Async(Mat src, float sigma_s, float sigma_r, CvCallback_1 callback) +{ + BEGIN_WRAP + cv::Mat _dst; + cv::stylization(*src.ptr, _dst, sigma_s, sigma_r); + callback(new Mat{new cv::Mat(_dst)}); + END_WRAP +} + +// Asynchronous functions for PhotoInpaint +CvStatus *PhotoInpaint_Async(Mat src, Mat mask, float inpaint_radius, int algorithm_type, CvCallback_1 callback) +{ + BEGIN_WRAP + cv::Mat _dst; + cv::inpaint(*src.ptr, *mask.ptr, _dst, inpaint_radius, algorithm_type); + callback(new Mat{new cv::Mat(_dst)}); + END_WRAP +} diff --git a/src/photo/photo_async.h b/src/photo/photo_async.h new file mode 100644 index 00000000..75d69187 --- /dev/null +++ b/src/photo/photo_async.h @@ -0,0 +1,67 @@ +/* Created by Abdelaziz Mahdy. Licensed: Apache 2.0 license. Copyright (c) 2024 Abdelaziz Mahdy. */ +#ifndef CVD_PHOTO_ASYNC_H_ +#define CVD_PHOTO_ASYNC_H_ + +#include "core/types.h" +#include "photo.h" + +#ifdef __cplusplus +#include +extern "C" +{ +#endif + + // Asynchronous functions for ColorChange + CvStatus *ColorChange_Async(Mat src, Mat mask, float red_mul, float green_mul, float blue_mul, CvCallback_1 callback); + + // Asynchronous functions for SeamlessClone + CvStatus *SeamlessClone_Async(Mat src, Mat dst, Mat mask, Point p, int flags, CvCallback_1 callback); + + // Asynchronous functions for IlluminationChange + CvStatus *IlluminationChange_Async(Mat src, Mat mask, float alpha, float beta, CvCallback_1 callback); + + // Asynchronous functions for TextureFlattening + CvStatus *TextureFlattening_Async(Mat src, Mat mask, float low_threshold, float high_threshold, int kernel_size, CvCallback_1 callback); + + // Asynchronous functions for FastNlMeansDenoisingColoredMulti + CvStatus *FastNlMeansDenoisingColoredMulti_Async(VecMat src, int imgToDenoiseIndex, int temporalWindowSize, CvCallback_1 callback); + CvStatus *FastNlMeansDenoisingColoredMultiWithParams_Async(VecMat src, int imgToDenoiseIndex, int temporalWindowSize, float h, float hColor, int templateWindowSize, int searchWindowSize, CvCallback_1 callback); + + // Asynchronous functions for FastNlMeansDenoising + CvStatus *FastNlMeansDenoising_Async(Mat src, CvCallback_1 callback); + CvStatus *FastNlMeansDenoisingWithParams_Async(Mat src, float h, int templateWindowSize, int searchWindowSize, CvCallback_1 callback); + + // Asynchronous functions for FastNlMeansDenoisingColored + CvStatus *FastNlMeansDenoisingColored_Async(Mat src, CvCallback_1 callback); + CvStatus *FastNlMeansDenoisingColoredWithParams_Async(Mat src, float h, float hColor, int templateWindowSize, int searchWindowSize, CvCallback_1 callback); + + // Asynchronous functions for MergeMertens + CvStatus *MergeMertens_Create_Async(CvCallback_1 callback); + CvStatus *MergeMertens_CreateWithParams_Async(float contrast_weight, float saturation_weight, float exposure_weight, CvCallback_1 callback); + CvStatus *MergeMertens_Process_Async(MergeMertens b, VecMat src, CvCallback_1 callback); + + // Asynchronous functions for AlignMTB + CvStatus *AlignMTB_Create_Async(CvCallback_1 callback); + CvStatus *AlignMTB_CreateWithParams_Async(int max_bits, int exclude_range, bool cut, CvCallback_1 callback); + CvStatus *AlignMTB_Process_Async(AlignMTB b, VecMat src, CvCallback_1 callback); + + // Asynchronous functions for DetailEnhance + CvStatus *DetailEnhance_Async(Mat src, float sigma_s, float sigma_r, CvCallback_1 callback); + + // Asynchronous functions for EdgePreservingFilter + CvStatus *EdgePreservingFilter_Async(Mat src, int filter, float sigma_s, float sigma_r, CvCallback_1 callback); + + // Asynchronous functions for PencilSketch + CvStatus *PencilSketch_Async(Mat src, float sigma_s, float sigma_r, float shade_factor, CvCallback_2 callback); + + // Asynchronous functions for Stylization + CvStatus *Stylization_Async(Mat src, float sigma_s, float sigma_r, CvCallback_1 callback); + + // Asynchronous functions for PhotoInpaint + CvStatus *PhotoInpaint_Async(Mat src, Mat mask, float inpaint_radius, int algorithm_type, CvCallback_1 callback); + +#ifdef __cplusplus +} +#endif + +#endif // CVD_PHOTO_ASYNC_H_ diff --git a/src/stitching/stitching.cpp b/src/stitching/stitching.cpp index 49c1ca36..ad408f7b 100644 --- a/src/stitching/stitching.cpp +++ b/src/stitching/stitching.cpp @@ -5,7 +5,7 @@ #include "stitching.h" -CvStatus *Stitcher_Create(int mode, PtrStitcher *rval) +CvStatus *Stitcher_Create(int mode, Stitcher *rval) { BEGIN_WRAP const auto ptr = cv::Stitcher::create(static_cast(mode)); @@ -13,108 +13,101 @@ CvStatus *Stitcher_Create(int mode, PtrStitcher *rval) END_WRAP } -void Stitcher_Close(PtrStitcherPtr stitcher) +void Stitcher_Close(StitcherPtr stitcher) { stitcher->ptr->reset(); - CVD_FREE(stitcher) -} - -CvStatus *Stitcher_Get(PtrStitcher self, Stitcher *rval) -{ - BEGIN_WRAP - *rval = {self.ptr->get()}; - END_WRAP + CVD_FREE(stitcher); } CvStatus *Stitcher_GetRegistrationResol(Stitcher self, double *rval) { BEGIN_WRAP - *rval = self.ptr->registrationResol(); + *rval = (*self.ptr)->registrationResol(); END_WRAP } CvStatus *Stitcher_SetRegistrationResol(Stitcher self, double inval) { BEGIN_WRAP - self.ptr->setRegistrationResol(inval); + (*self.ptr)->setRegistrationResol(inval); END_WRAP } CvStatus *Stitcher_GetSeamEstimationResol(Stitcher self, double *rval) { BEGIN_WRAP - *rval = self.ptr->seamEstimationResol(); + *rval = (*self.ptr)->seamEstimationResol(); END_WRAP } CvStatus *Stitcher_SetSeamEstimationResol(Stitcher self, double inval) { BEGIN_WRAP - self.ptr->setSeamEstimationResol(inval); + (*self.ptr)->setSeamEstimationResol(inval); END_WRAP } CvStatus *Stitcher_GetCompositingResol(Stitcher self, double *rval) { BEGIN_WRAP - *rval = self.ptr->compositingResol(); + *rval = (*self.ptr)->compositingResol(); END_WRAP } CvStatus *Stitcher_SetCompositingResol(Stitcher self, double inval) { BEGIN_WRAP - self.ptr->setCompositingResol(inval); + (*self.ptr)->setCompositingResol(inval); END_WRAP } CvStatus *Stitcher_GetPanoConfidenceThresh(Stitcher self, double *rval) { BEGIN_WRAP - *rval = self.ptr->panoConfidenceThresh(); + *rval = (*self.ptr)->panoConfidenceThresh(); END_WRAP } CvStatus *Stitcher_SetPanoConfidenceThresh(Stitcher self, double inval) { BEGIN_WRAP - self.ptr->setPanoConfidenceThresh(inval); + (*self.ptr)->setPanoConfidenceThresh(inval); END_WRAP } CvStatus *Stitcher_GetWaveCorrection(Stitcher self, bool *rval) { BEGIN_WRAP - *rval = self.ptr->waveCorrection(); + *rval = (*self.ptr)->waveCorrection(); END_WRAP } CvStatus *Stitcher_SetWaveCorrection(Stitcher self, bool inval) { BEGIN_WRAP - self.ptr->setWaveCorrection(inval); + (*self.ptr)->setWaveCorrection(inval); END_WRAP } CvStatus *Stitcher_GetInterpolationFlags(Stitcher self, int *rval) { BEGIN_WRAP - *rval = static_cast(self.ptr->interpolationFlags()); + *rval = static_cast((*self.ptr)->interpolationFlags()); END_WRAP } CvStatus *Stitcher_SetInterpolationFlags(Stitcher self, int inval) { BEGIN_WRAP - self.ptr->setInterpolationFlags(static_cast(inval)); + (*self.ptr)->setInterpolationFlags(static_cast(inval)); END_WRAP } CvStatus *Stitcher_GetWaveCorrectKind(Stitcher self, int *rval) { BEGIN_WRAP - *rval = static_cast(self.ptr->waveCorrectKind()); + *rval = static_cast((*self.ptr)->waveCorrectKind()); END_WRAP } CvStatus *Stitcher_SetWaveCorrectKind(Stitcher self, int inval) { BEGIN_WRAP - self.ptr->setWaveCorrectKind(static_cast(inval)); + (*self.ptr)->setWaveCorrectKind(static_cast(inval)); END_WRAP } @@ -122,42 +115,42 @@ CvStatus *Stitcher_EstimateTransform(Stitcher self, VecMat mats, VecMat masks, i { BEGIN_WRAP if (masks.ptr->size() > 0) { - *rval = static_cast(self.ptr->estimateTransform(*mats.ptr, *masks.ptr)); + *rval = static_cast((*self.ptr)->estimateTransform(*mats.ptr, *masks.ptr)); } else - *rval = static_cast(self.ptr->estimateTransform(*mats.ptr)); + *rval = static_cast((*self.ptr)->estimateTransform(*mats.ptr)); END_WRAP } CvStatus *Stitcher_ComposePanorama(Stitcher self, Mat rpano, int *rval) { BEGIN_WRAP - *rval = static_cast(self.ptr->composePanorama(*rpano.ptr)); + *rval = static_cast((*self.ptr)->composePanorama(*rpano.ptr)); END_WRAP } CvStatus *Stitcher_ComposePanorama_1(Stitcher self, VecMat mats, Mat rpano, int *rval) { BEGIN_WRAP - *rval = static_cast(self.ptr->composePanorama(*mats.ptr, *rpano.ptr)); + *rval = static_cast((*self.ptr)->composePanorama(*mats.ptr, *rpano.ptr)); END_WRAP } CvStatus *Stitcher_Stitch(Stitcher self, VecMat mats, Mat rpano, int *rval) { BEGIN_WRAP - *rval = static_cast(self.ptr->stitch(*mats.ptr, *rpano.ptr)); + *rval = static_cast((*self.ptr)->stitch(*mats.ptr, *rpano.ptr)); END_WRAP } CvStatus *Stitcher_Stitch_1(Stitcher self, VecMat mats, VecMat masks, Mat rpano, int *rval) { BEGIN_WRAP - *rval = static_cast(self.ptr->stitch(*mats.ptr, *masks.ptr, *rpano.ptr)); + *rval = static_cast((*self.ptr)->stitch(*mats.ptr, *masks.ptr, *rpano.ptr)); END_WRAP } CvStatus *Stitcher_Component(Stitcher self, VecInt *rval) { BEGIN_WRAP - std::vector _rval = self.ptr->component(); + std::vector _rval = (*self.ptr)->component(); *rval = {new std::vector(_rval)}; END_WRAP } diff --git a/src/stitching/stitching.h b/src/stitching/stitching.h index a4be8634..4701a40d 100644 --- a/src/stitching/stitching.h +++ b/src/stitching/stitching.h @@ -23,16 +23,14 @@ enum { }; #ifdef __cplusplus -CVD_TYPEDEF(cv::Ptr, PtrStitcher) -CVD_TYPEDEF(cv::Stitcher, Stitcher) +CVD_TYPEDEF(cv::Ptr, Stitcher); #else -CVD_TYPEDEF(void *, PtrStitcher) -CVD_TYPEDEF(void, Stitcher) +CVD_TYPEDEF(void *, Stitcher); #endif -CvStatus *Stitcher_Create(int mode, PtrStitcher *rval); -void Stitcher_Close(PtrStitcherPtr stitcher); -CvStatus *Stitcher_Get(PtrStitcher self, Stitcher *rval); +CvStatus *Stitcher_Create(int mode, Stitcher *rval); +void Stitcher_Close(StitcherPtr stitcher); +CvStatus *Stitcher_Get(Stitcher self, Stitcher *rval); #pragma region getter/setter diff --git a/src/stitching/stitching_async.cpp b/src/stitching/stitching_async.cpp new file mode 100644 index 00000000..56c8e6c2 --- /dev/null +++ b/src/stitching/stitching_async.cpp @@ -0,0 +1,182 @@ +/* Created by Abdelaziz Mahdy. Licensed: Apache 2.0 license. Copyright (c) 2024 Abdelaziz Mahdy. */ +#include "stitching_async.h" +#include "core/types.h" + +// Asynchronous functions for Stitcher_Create +CvStatus *Stitcher_Create_Async(int mode, CvCallback_1 callback) +{ + BEGIN_WRAP + const auto ptr = cv::Stitcher::create(static_cast(mode)); + callback(new Stitcher{new cv::Ptr(ptr)}); + END_WRAP +} + +// Asynchronous getter/setter functions +CvStatus *Stitcher_GetRegistrationResol_Async(Stitcher self, CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new double((*self.ptr)->registrationResol())); + END_WRAP +} + +CvStatus *Stitcher_SetRegistrationResol_Async(Stitcher self, double inval, CvCallback_0 callback) +{ + BEGIN_WRAP + (*self.ptr)->setRegistrationResol(inval); + callback(); + END_WRAP +} + +CvStatus *Stitcher_GetSeamEstimationResol_Async(Stitcher self, CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new double((*self.ptr)->seamEstimationResol())); + END_WRAP +} + +CvStatus *Stitcher_SetSeamEstimationResol_Async(Stitcher self, double inval, CvCallback_0 callback) +{ + BEGIN_WRAP + (*self.ptr)->setSeamEstimationResol(inval); + callback(); + END_WRAP +} + +CvStatus *Stitcher_GetCompositingResol_Async(Stitcher self, CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new double((*self.ptr)->compositingResol())); + END_WRAP +} + +CvStatus *Stitcher_SetCompositingResol_Async(Stitcher self, double inval, CvCallback_0 callback) +{ + BEGIN_WRAP + (*self.ptr)->setCompositingResol(inval); + callback(); + END_WRAP +} + +CvStatus *Stitcher_GetPanoConfidenceThresh_Async(Stitcher self, CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new double((*self.ptr)->panoConfidenceThresh())); + END_WRAP +} + +CvStatus *Stitcher_SetPanoConfidenceThresh_Async(Stitcher self, double inval, CvCallback_0 callback) +{ + BEGIN_WRAP + (*self.ptr)->setPanoConfidenceThresh(inval); + callback(); + END_WRAP +} + +CvStatus *Stitcher_GetWaveCorrection_Async(Stitcher self, CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new bool((*self.ptr)->waveCorrection())); + END_WRAP +} + +CvStatus *Stitcher_SetWaveCorrection_Async(Stitcher self, bool inval, CvCallback_0 callback) +{ + BEGIN_WRAP + (*self.ptr)->setWaveCorrection(inval); + callback(); + END_WRAP +} + +CvStatus *Stitcher_GetInterpolationFlags_Async(Stitcher self, CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new int(static_cast((*self.ptr)->interpolationFlags()))); + END_WRAP +} + +CvStatus *Stitcher_SetInterpolationFlags_Async(Stitcher self, int inval, CvCallback_0 callback) +{ + BEGIN_WRAP + (*self.ptr)->setInterpolationFlags(static_cast(inval)); + callback(); + END_WRAP +} + +CvStatus *Stitcher_GetWaveCorrectKind_Async(Stitcher self, CvCallback_1 callback) +{ + BEGIN_WRAP + callback(new int(static_cast((*self.ptr)->waveCorrectKind()))); + END_WRAP +} + +CvStatus *Stitcher_SetWaveCorrectKind_Async(Stitcher self, int inval, CvCallback_0 callback) +{ + BEGIN_WRAP + (*self.ptr)->setWaveCorrectKind(static_cast(inval)); + callback(); + END_WRAP +} + +// Asynchronous functions +CvStatus *Stitcher_EstimateTransform_Async(Stitcher self, VecMat mats, VecMat masks, CvCallback_1 callback) +{ + BEGIN_WRAP + int rval; + if (masks.ptr->size() > 0) + { + rval = static_cast((*self.ptr)->estimateTransform(*mats.ptr, *masks.ptr)); + } + else + { + rval = static_cast((*self.ptr)->estimateTransform(*mats.ptr)); + } + callback(new int(rval)); + END_WRAP +} + +CvStatus *Stitcher_ComposePanorama_Async(Stitcher self, CvCallback_2 callback) +{ + BEGIN_WRAP + cv::Mat ـrpano; + + int rval = static_cast((*self.ptr)->composePanorama(ـrpano)); + callback(new int(rval), new Mat{new cv::Mat(ـrpano)}); + END_WRAP +} + +CvStatus *Stitcher_ComposePanorama_1_Async(Stitcher self, VecMat mats, CvCallback_2 callback) +{ + BEGIN_WRAP + cv::Mat ـrpano; + + int rval = static_cast((*self.ptr)->composePanorama(*mats.ptr, ـrpano)); + callback(new int(rval), new Mat{new cv::Mat(ـrpano)}); + END_WRAP +} + +CvStatus *Stitcher_Stitch_Async(Stitcher self, VecMat mats, CvCallback_2 callback) +{ + BEGIN_WRAP + cv::Mat ـrpano; + + int rval = static_cast((*self.ptr)->stitch(*mats.ptr, ـrpano)); + callback(new int(rval), new Mat{new cv::Mat(ـrpano)}); + END_WRAP +} + +CvStatus *Stitcher_Stitch_1_Async(Stitcher self, VecMat mats, VecMat masks, CvCallback_2 callback) +{ + BEGIN_WRAP + cv::Mat ـrpano; + int rval = static_cast((*self.ptr)->stitch(*mats.ptr, *masks.ptr, ـrpano)); + callback(new int(rval), new Mat{new cv::Mat(ـrpano)}); + END_WRAP +} + +CvStatus *Stitcher_Component_Async(Stitcher self, CvCallback_1 callback) +{ + BEGIN_WRAP + std::vector _rval = (*self.ptr)->component(); + callback(new VecInt{new std::vector(_rval)}); + END_WRAP +} diff --git a/src/stitching/stitching_async.h b/src/stitching/stitching_async.h new file mode 100644 index 00000000..2312d667 --- /dev/null +++ b/src/stitching/stitching_async.h @@ -0,0 +1,47 @@ +/* Created by Abdelaziz Mahdy. Licensed: Apache 2.0 license. Copyright (c) 2024 Abdelaziz Mahdy. */ +#ifndef OPENCV_DART_LIBRARY_STITCHING_ASYNC_H +#define OPENCV_DART_LIBRARY_STITCHING_ASYNC_H + +#include "core/types.h" +#include "stitching.h" + +#ifdef __cplusplus +#include +extern "C" { +#endif + +// Asynchronous functions for Stitcher_Create +CvStatus *Stitcher_Create_Async(int mode, CvCallback_1 callback); + +// Asynchronous functions for Stitcher_Close +void Stitcher_Close_Async(StitcherPtr stitcher, CvCallback_0 callback); + +// Asynchronous getter/setter functions +CvStatus *Stitcher_GetRegistrationResol_Async(Stitcher self, CvCallback_1 callback); +CvStatus *Stitcher_SetRegistrationResol_Async(Stitcher self, double inval, CvCallback_0 callback); +CvStatus *Stitcher_GetSeamEstimationResol_Async(Stitcher self, CvCallback_1 callback); +CvStatus *Stitcher_SetSeamEstimationResol_Async(Stitcher self, double inval, CvCallback_0 callback); +CvStatus *Stitcher_GetCompositingResol_Async(Stitcher self, CvCallback_1 callback); +CvStatus *Stitcher_SetCompositingResol_Async(Stitcher self, double inval, CvCallback_0 callback); +CvStatus *Stitcher_GetPanoConfidenceThresh_Async(Stitcher self, CvCallback_1 callback); +CvStatus *Stitcher_SetPanoConfidenceThresh_Async(Stitcher self, double inval, CvCallback_0 callback); +CvStatus *Stitcher_GetWaveCorrection_Async(Stitcher self, CvCallback_1 callback); +CvStatus *Stitcher_SetWaveCorrection_Async(Stitcher self, bool inval, CvCallback_0 callback); +CvStatus *Stitcher_GetInterpolationFlags_Async(Stitcher self, CvCallback_1 callback); +CvStatus *Stitcher_SetInterpolationFlags_Async(Stitcher self, int inval, CvCallback_0 callback); +CvStatus *Stitcher_GetWaveCorrectKind_Async(Stitcher self, CvCallback_1 callback); +CvStatus *Stitcher_SetWaveCorrectKind_Async(Stitcher self, int inval, CvCallback_0 callback); + +// Asynchronous functions +CvStatus *Stitcher_EstimateTransform_Async(Stitcher self, VecMat mats, VecMat masks, CvCallback_1 callback); +CvStatus *Stitcher_ComposePanorama_Async(Stitcher self, CvCallback_2 callback); +CvStatus *Stitcher_ComposePanorama_1_Async(Stitcher self, VecMat mats, CvCallback_2 callback); +CvStatus *Stitcher_Stitch_Async(Stitcher self, VecMat mats, CvCallback_2 callback); +CvStatus *Stitcher_Stitch_1_Async(Stitcher self, VecMat mats, VecMat masks, CvCallback_2 callback); +CvStatus *Stitcher_Component_Async(Stitcher self, CvCallback_1 callback); + +#ifdef __cplusplus +} +#endif + +#endif // OPENCV_DART_LIBRARY_STITCHING_ASYNC_H diff --git a/src/t.h b/src/t.h new file mode 100644 index 00000000..b6fa2fa1 --- /dev/null +++ b/src/t.h @@ -0,0 +1,13 @@ +/* + Created by Rainyl. + Licensed: Apache 2.0 license. Copyright (c) 2024 Rainyl. +*/ + +#ifndef CVD_ASYNC__H +#define CVD_ASYNC__H + +#include "core/types.h" + +// this file is a template to create more headers + +#endif // CVD_ASYNC__H diff --git a/src/video/video.cpp b/src/video/video.cpp index a09d9811..3fd532c8 100644 --- a/src/video/video.cpp +++ b/src/video/video.cpp @@ -26,7 +26,7 @@ CvStatus *BackgroundSubtractorMOG2_CreateWithParams(int history, double varThres void BackgroundSubtractorMOG2_Close(BackgroundSubtractorMOG2Ptr self) { self->ptr->reset(); - CVD_FREE(self) + CVD_FREE(self); } CvStatus *BackgroundSubtractorMOG2_Apply(BackgroundSubtractorMOG2 self, Mat src, Mat dst) @@ -52,7 +52,7 @@ CvStatus *BackgroundSubtractorKNN_CreateWithParams(int history, double dist2Thre void BackgroundSubtractorKNN_Close(BackgroundSubtractorKNNPtr self) { self->ptr->reset(); - CVD_FREE(self) + CVD_FREE(self); } CvStatus *BackgroundSubtractorKNN_Apply(BackgroundSubtractorKNN self, Mat src, Mat dst) @@ -126,7 +126,7 @@ CvStatus *TrackerMIL_Create(TrackerMIL *rval) void TrackerMIL_Close(TrackerMILPtr self) { self->ptr->reset(); - CVD_FREE(self) + CVD_FREE(self); } CvStatus *KalmanFilter_New(int dynamParams, int measureParams, int controlParams, int type, @@ -136,7 +136,7 @@ CvStatus *KalmanFilter_New(int dynamParams, int measureParams, int controlParams *rval = {new cv::KalmanFilter(dynamParams, measureParams, controlParams, type)}; END_WRAP } -void KalmanFilter_Close(KalmanFilterPtr self){CVD_FREE(self)} +void KalmanFilter_Close(KalmanFilterPtr self) { CVD_FREE(self); } CvStatus *KalmanFilter_Init(KalmanFilter self, int dynamParams, int measureParams) { diff --git a/src/video/video.h b/src/video/video.h index 1f9cfb17..dd5f3d28 100644 --- a/src/video/video.h +++ b/src/video/video.h @@ -18,19 +18,19 @@ extern "C" { #endif #ifdef __cplusplus -CVD_TYPEDEF(cv::Ptr, BackgroundSubtractorMOG2) -CVD_TYPEDEF(cv::Ptr, BackgroundSubtractorKNN) -CVD_TYPEDEF(cv::Ptr, Tracker) -CVD_TYPEDEF(cv::Ptr, TrackerMIL) -CVD_TYPEDEF(cv::Ptr, TrackerGOTURN) -CVD_TYPEDEF(cv::KalmanFilter, KalmanFilter) +CVD_TYPEDEF(cv::Ptr, BackgroundSubtractorMOG2); +CVD_TYPEDEF(cv::Ptr, BackgroundSubtractorKNN); +CVD_TYPEDEF(cv::Ptr, Tracker); +CVD_TYPEDEF(cv::Ptr, TrackerMIL); +CVD_TYPEDEF(cv::Ptr, TrackerGOTURN); +CVD_TYPEDEF(cv::KalmanFilter, KalmanFilter); #else -CVD_TYPEDEF(void, BackgroundSubtractorMOG2) -CVD_TYPEDEF(void, BackgroundSubtractorKNN) -CVD_TYPEDEF(void, Tracker) -CVD_TYPEDEF(void, TrackerMIL) -CVD_TYPEDEF(void, TrackerGOTURN) -CVD_TYPEDEF(void, KalmanFilter) +CVD_TYPEDEF(void, BackgroundSubtractorMOG2); +CVD_TYPEDEF(void, BackgroundSubtractorKNN); +CVD_TYPEDEF(void, Tracker); +CVD_TYPEDEF(void, TrackerMIL); +CVD_TYPEDEF(void, TrackerGOTURN); +CVD_TYPEDEF(void, KalmanFilter); #endif CvStatus *BackgroundSubtractorMOG2_Create(BackgroundSubtractorMOG2 *rval); 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.cpp b/src/video/videoio.cpp index b97d7382..6857da33 100644 --- a/src/video/videoio.cpp +++ b/src/video/videoio.cpp @@ -27,7 +27,7 @@ CvStatus *VideoCapture_NewFromIndex(int index, int apiPreference, VideoCapture * *rval = {new cv::VideoCapture(index, apiPreference)}; END_WRAP } -void VideoCapture_Close(VideoCapturePtr self){CVD_FREE(self)} +void VideoCapture_Close(VideoCapturePtr self) { CVD_FREE(self); } CvStatus *VideoCapture_Open(VideoCapture self, const char *uri, bool *rval) { @@ -97,7 +97,7 @@ CvStatus *VideoWriter_New(VideoWriter *rval) *rval = {new cv::VideoWriter()}; END_WRAP } -void VideoWriter_Close(VideoWriterPtr self){CVD_FREE(self)} +void VideoWriter_Close(VideoWriterPtr self) { CVD_FREE(self); } CvStatus *VideoWriter_Open(VideoWriter self, const char *name, const char *codec, double fps, int width, int height, bool isColor) diff --git a/src/video/videoio.h b/src/video/videoio.h index 5f0231d2..c3921896 100644 --- a/src/video/videoio.h +++ b/src/video/videoio.h @@ -17,11 +17,11 @@ extern "C" { #include "core/core.h" #ifdef __cplusplus -CVD_TYPEDEF(cv::VideoCapture, VideoCapture) -CVD_TYPEDEF(cv::VideoWriter, VideoWriter) +CVD_TYPEDEF(cv::VideoCapture, VideoCapture); +CVD_TYPEDEF(cv::VideoWriter, VideoWriter); #else -CVD_TYPEDEF(void, VideoCapture) -CVD_TYPEDEF(void, VideoWriter) +CVD_TYPEDEF(void, VideoCapture); +CVD_TYPEDEF(void, VideoWriter); #endif // VideoCapture 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/calib3d_test.dart b/test/calib3d_test.dart index a8ba75e2..ce709eca 100644 --- a/test/calib3d_test.dart +++ b/test/calib3d_test.dart @@ -2,7 +2,7 @@ import 'package:opencv_dart/opencv_dart.dart' as cv; import 'package:test/test.dart'; void main() async { - test('cv.Fisheye.undistortImage', () { + test('cv.Fisheye.undistortImage', () async { final img = cv.imread("test/images/fisheye_sample.jpg", flags: cv.IMREAD_UNCHANGED); expect(img.isEmpty, false); final k = cv.Mat.zeros(3, 3, cv.MatType.CV_64FC1); @@ -20,11 +20,17 @@ void main() async { final d = cv.Mat.zeros(1, 4, cv.MatType.CV_64FC1); - final dst = cv.Fisheye.undistortImage(img, k, d); - expect(dst.isEmpty, false); + { + final dst = cv.Fisheye.undistortImage(img, k, d); + expect(dst.isEmpty, false); + } + { + final dst = await cv.Fisheye.undistortImageAsync(img, k, d); + expect(dst.isEmpty, false); + } }); - test('cv.undistortPoints', () { + test('cv.undistortPoints', () async { final k = cv.Mat.zeros(3, 3, cv.MatType.CV_64FC1); k.set(0, 0, 1094.7249578198823); k.set(0, 1, 0.0); @@ -65,14 +71,23 @@ void main() async { src.set(2, 0, 1920.0); src.set(2, 1, 1080.0); - cv.undistortPoints(src, k, d); - final dst = cv.undistortPoints(src, k, d, R: r, P: k); - expect(dst.isEmpty, false); - expect(dst.at(0, 0), lessThan(480)); - expect(dst.at(0, 1), lessThan(270)); + { + cv.undistortPoints(src, k, d); + final dst = cv.undistortPoints(src, k, d, R: r, P: k); + expect(dst.isEmpty, false); + expect(dst.at(0, 0), lessThan(480)); + expect(dst.at(0, 1), lessThan(270)); + } + { + await cv.undistortPointsAsync(src, k, d); + final dst = await cv.undistortPointsAsync(src, k, d, R: r, P: k); + expect(dst.isEmpty, false); + expect(dst.at(0, 0), lessThan(480)); + expect(dst.at(0, 1), lessThan(270)); + } }); - test('cv.Fisheye.undistortPoints', () { + test('cv.Fisheye.undistortPoints', () async { final k = cv.Mat.zeros(3, 3, cv.MatType.CV_64FC1); k.set(0, 0, 1094.7249578198823); k.set(0, 1, 0.0); @@ -109,23 +124,40 @@ void main() async { knew.set(0, 0, 0.4 * k.at(0, 0)); knew.set(1, 1, 0.4 * k.at(1, 1)); - cv.Fisheye.estimateNewCameraMatrixForUndistortRectify( - k, - d, - (1920, 1080), - r, - P: knew, - balance: 1, - newSize: (1920, 1080), - ); - - cv.Fisheye.undistortPoints(src, k, d); - cv.Fisheye.undistortPoints(src, k, d, undistorted: dst, R: r, P: k); - expect(dst.isEmpty, false); - expect(dst.at(0, 0) != 0, true); + { + cv.Fisheye.estimateNewCameraMatrixForUndistortRectify( + k, + d, + (1920, 1080), + r, + P: knew, + balance: 1, + newSize: (1920, 1080), + ); + + cv.Fisheye.undistortPoints(src, k, d); + cv.Fisheye.undistortPoints(src, k, d, undistorted: dst, R: r, P: k); + expect(dst.isEmpty, false); + expect(dst.at(0, 0) != 0, true); + } + { + await cv.Fisheye.estimateNewCameraMatrixForUndistortRectifyAsync( + k, + d, + (1920, 1080), + r, + balance: 1, + newSize: (1920, 1080), + ); + + await cv.Fisheye.undistortPointsAsync(src, k, d); + await cv.Fisheye.undistortPointsAsync(src, k, d, R: r, P: k); + expect(dst.isEmpty, false); + expect(dst.at(0, 0) != 0, true); + } }); - test('cv.initUndistortRectifyMap', () { + test('cv.initUndistortRectifyMap', () async { final img = cv.imread("test/images/distortion.jpg", flags: cv.IMREAD_UNCHANGED); expect(img.isEmpty, false); @@ -149,59 +181,107 @@ void main() async { d.set(0, 3, 2.05841873e-04); d.set(0, 4, -2.35021914e-02); - final (newC, roi) = cv.getOptimalNewCameraMatrix(k, d, (img.cols, img.rows), 1); - expect(newC.isEmpty, false); - expect(roi.width, greaterThan(0)); - - final r = cv.Mat.empty(); - final (map1, map2) = cv.initUndistortRectifyMap(k, d, r, newC, (img.cols, img.rows), 5); - final dst = cv.remap(img, map1, map2, cv.INTER_LINEAR); - expect(dst.isEmpty, false); - final success = cv.imwrite("test/images/distortion-correct.png", dst); - expect(success, true); + { + final (newC, roi) = cv.getOptimalNewCameraMatrix(k, d, (img.cols, img.rows), 1); + expect(newC.isEmpty, false); + expect(roi.width, greaterThan(0)); + + final r = cv.Mat.empty(); + final (map1, map2) = cv.initUndistortRectifyMap(k, d, r, newC, (img.cols, img.rows), 5); + final dst = cv.remap(img, map1, map2, cv.INTER_LINEAR); + expect(dst.isEmpty, false); + final success = cv.imwrite("test/images/distortion-correct.png", dst); + expect(success, true); + } + { + final (newC, roi) = await cv.getOptimalNewCameraMatrixAsync(k, d, (img.cols, img.rows), 1); + expect(newC.isEmpty, false); + expect(roi.width, greaterThan(0)); + + final r = cv.Mat.empty(); + final (map1, map2) = await cv.initUndistortRectifyMapAsync(k, d, r, newC, (img.cols, img.rows), 5); + final dst = cv.remap(img, map1, map2, cv.INTER_LINEAR); + expect(dst.isEmpty, false); + final success = cv.imwrite("test/images/distortion-correct.png", dst); + expect(success, true); + } }); - test('cv.findChessboardCorners, cv.drawChessboardCorners', () { + test('cv.findChessboardCorners, cv.drawChessboardCorners', () async { final img = cv.imread("test/images/chessboard_4x6.png", flags: cv.IMREAD_UNCHANGED); expect(img.isEmpty, false); - final (found, corners) = cv.findChessboardCorners(img, (4, 6), flags: 0); - expect(found, true); - expect(corners.isEmpty, false); + { + final (found, corners) = cv.findChessboardCorners(img, (4, 6), flags: 0); + expect(found, true); + expect(corners.isEmpty, false); - final img2 = cv.Mat.zeros(150, 150, cv.MatType.CV_8UC1); - cv.drawChessboardCorners(img2, (4, 6), corners, true); - expect(img2.isEmpty, false); + final img2 = cv.Mat.zeros(150, 150, cv.MatType.CV_8UC1); + cv.drawChessboardCorners(img2, (4, 6), corners, true); + expect(img2.isEmpty, false); + } + { + final (found, corners) = await cv.findChessboardCornersAsync(img, (4, 6)); + expect(found, true); + expect(corners.isEmpty, false); + + // final img2 = cv.Mat.zeros(150, 150, cv.MatType.CV_8UC1); + // await cv.drawChessboardCornersAsync(img2, (4, 6), corners, true); + // expect(img2.isEmpty, false); + } }); - test('cv.findChessboardCornersSB', () { + test('cv.findChessboardCornersSB', () async { final img = cv.imread("test/images/chessboard_4x6.png", flags: cv.IMREAD_UNCHANGED); expect(img.isEmpty, false); - final (found, corners) = cv.findChessboardCornersSB(img, (4, 6), 0); - expect(found, true); - expect(corners.isEmpty, false); + { + final (found, corners) = cv.findChessboardCornersSB(img, (4, 6), 0); + expect(found, true); + expect(corners.isEmpty, false); - final img2 = cv.Mat.zeros(150, 150, cv.MatType.CV_8UC1); - cv.drawChessboardCorners(img2, (4, 6), corners, true); - expect(img2.isEmpty, false); + final img2 = cv.Mat.zeros(150, 150, cv.MatType.CV_8UC1); + cv.drawChessboardCorners(img2, (4, 6), corners, true); + expect(img2.isEmpty, false); + } + { + final (found, corners) = await cv.findChessboardCornersSBAsync(img, (4, 6), 0); + expect(found, true); + expect(corners.isEmpty, false); + + final img2 = cv.Mat.zeros(150, 150, cv.MatType.CV_8UC1); + await cv.drawChessboardCornersAsync(img2, (4, 6), corners, true); + expect(img2.isEmpty, false); + } }); - test('cv.findChessboardCornersSBWithMeta', () { + test('cv.findChessboardCornersSBWithMeta', () async { final img = cv.imread("test/images/chessboard_4x6.png", flags: cv.IMREAD_UNCHANGED); expect(img.isEmpty, false); - final (found, corners, meta) = cv.findChessboardCornersSBWithMeta(img, (4, 6), 0); - expect(found, true); - expect(corners.isEmpty, false); - expect(meta.isEmpty, false); + { + final (found, corners, meta) = cv.findChessboardCornersSBWithMeta(img, (4, 6), 0); + expect(found, true); + expect(corners.isEmpty, false); + expect(meta.isEmpty, false); - final img2 = cv.Mat.zeros(150, 150, cv.MatType.CV_8UC1); - cv.drawChessboardCorners(img2, (4, 6), corners, true); - expect(img2.isEmpty, false); + final img2 = cv.Mat.zeros(150, 150, cv.MatType.CV_8UC1); + cv.drawChessboardCorners(img2, (4, 6), corners, true); + expect(img2.isEmpty, false); + } + { + final (found, corners, meta) = await cv.findChessboardCornersSBWithMetaAsync(img, (4, 6), 0); + expect(found, true); + expect(corners.isEmpty, false); + expect(meta.isEmpty, false); + + final img2 = cv.Mat.zeros(150, 150, cv.MatType.CV_8UC1); + await cv.drawChessboardCornersAsync(img2, (4, 6), corners, true); + expect(img2.isEmpty, false); + } }); - test('cv.calibrateCamera', () { + test('cv.calibrateCamera', () async { final img = cv.imread("test/images/chessboard_4x6_distort.png", flags: cv.IMREAD_GRAYSCALE); expect(img.isEmpty, false); @@ -221,26 +301,47 @@ void main() async { cv.VecPoint2f.fromMat(corners).toList(), ]); - final cameraMatrix = cv.Mat.empty(); - final distCoeffs = cv.Mat.empty(); - final (rmsErr, mtx, dist, rvecs, tvecs) = cv.calibrateCamera( - objectPointsVector, - imagePointsVector, - (img.cols, img.rows), - cameraMatrix, - distCoeffs, - ); - expect(rmsErr, greaterThan(0)); - expect(mtx.isEmpty || dist.isEmpty || rvecs.isEmpty || tvecs.isEmpty, false); - - final dst = cv.undistort(img, cameraMatrix, distCoeffs); - final target = cv.imread("test/images/chessboard_4x6_distort_correct.png", flags: cv.IMREAD_GRAYSCALE); - final xor = cv.bitwiseXOR(dst, target); - final sum = xor.sum(); - expect(sum.val1, lessThan(img.rows * img.cols * 0.005)); + { + final cameraMatrix = cv.Mat.empty(); + final distCoeffs = cv.Mat.empty(); + final (rmsErr, mtx, dist, rvecs, tvecs) = cv.calibrateCamera( + objectPointsVector, + imagePointsVector, + (img.cols, img.rows), + cameraMatrix, + distCoeffs, + ); + expect(rmsErr, greaterThan(0)); + expect(mtx.isEmpty || dist.isEmpty || rvecs.isEmpty || tvecs.isEmpty, false); + + final dst = cv.undistort(img, cameraMatrix, distCoeffs); + final target = cv.imread("test/images/chessboard_4x6_distort_correct.png", flags: cv.IMREAD_GRAYSCALE); + final xor = cv.bitwiseXOR(dst, target); + final sum = xor.sum(); + expect(sum.val1, lessThan(img.rows * img.cols * 0.005)); + } + { + final cameraMatrix = cv.Mat.empty(); + final distCoeffs = cv.Mat.empty(); + final (rmsErr, mtx, dist, rvecs, tvecs) = await cv.calibrateCameraAsync( + objectPointsVector, + imagePointsVector, + (img.cols, img.rows), + cameraMatrix, + distCoeffs, + ); + expect(rmsErr, greaterThan(0)); + expect(mtx.isEmpty || dist.isEmpty || rvecs.isEmpty || tvecs.isEmpty, false); + + final dst = await cv.undistortAsync(img, cameraMatrix, distCoeffs); + final target = cv.imread("test/images/chessboard_4x6_distort_correct.png", flags: cv.IMREAD_GRAYSCALE); + final xor = cv.bitwiseXOR(dst, target); + final sum = xor.sum(); + expect(sum.val1, lessThan(img.rows * img.cols * 0.005)); + } }); - test('cv.estimateAffinePartial2D', () { + test('cv.estimateAffinePartial2D', () async { final src = [ cv.Point2f(0, 0), cv.Point2f(10, 5), @@ -253,16 +354,24 @@ void main() async { cv.Point2f(10, 10), cv.Point2f(0, 10), ].cvd; - final (m, inliers) = cv.estimateAffinePartial2D( - src, - dst, - ); - expect(inliers.isEmpty, false); - expect(m.isEmpty, false); - expect((m.rows, m.cols), (2, 3)); + { + final (m, inliers) = cv.estimateAffinePartial2D( + src, + dst, + ); + expect(inliers.isEmpty, false); + expect(m.isEmpty, false); + expect((m.rows, m.cols), (2, 3)); + } + { + final (m, inliers) = await cv.estimateAffinePartial2DAsync(src, dst); + expect(inliers.isEmpty, false); + expect(m.isEmpty, false); + expect((m.rows, m.cols), (2, 3)); + } }); - test('cv.estimateAffine2D', () { + test('cv.estimateAffine2D', () async { final src = [ cv.Point2f(0, 0), cv.Point2f(10, 5), @@ -275,12 +384,23 @@ void main() async { cv.Point2f(10, 10), cv.Point2f(0, 10), ].cvd; - final (m, inliers) = cv.estimateAffine2D( - src, - dst, - ); - expect(inliers.isEmpty, false); - expect(m.isEmpty, false); - expect((m.rows, m.cols), (2, 3)); + { + final (m, inliers) = cv.estimateAffine2D( + src, + dst, + ); + expect(inliers.isEmpty, false); + expect(m.isEmpty, false); + expect((m.rows, m.cols), (2, 3)); + } + { + final (m, inliers) = await cv.estimateAffine2DAsync( + src, + dst, + ); + expect(inliers.isEmpty, false); + expect(m.isEmpty, false); + expect((m.rows, m.cols), (2, 3)); + } }); } diff --git a/test/core/core_async_test.dart b/test/core/core_async_test.dart new file mode 100644 index 00000000..a8fbd10b --- /dev/null +++ b/test/core/core_async_test.dart @@ -0,0 +1,691 @@ +// ignore_for_file: avoid_print + +import 'package:opencv_dart/opencv_dart.dart' as cv; +import 'package:test/test.dart'; + +void main() async { + test('openCvVersionAsync', () async { + final version = await cv.openCvVersionAsync(); + expect(version.length, greaterThan(0)); + }); + + test('cv.getBuildInformationAsync', () async { + final info = await cv.getBuildInformationAsync(); + expect(info.length, greaterThan(0)); + }); + + test('cv.absDiffAsync', () async { + final mat0 = cv.Mat.ones(100, 100, cv.MatType.CV_8UC3); + final mat1 = cv.Mat.zeros(100, 100, cv.MatType.CV_8UC3); + final dst = await cv.absDiffAsync(mat0, mat1); + expect(dst.at(0, 0, 0), equals(1)); + }); + + test('cv.addAsync', () async { + final mat0 = cv.Mat.ones(100, 100, cv.MatType.CV_8UC3); + final mat1 = cv.Mat.zeros(100, 100, cv.MatType.CV_8UC3); + final dst = await cv.addAsync(mat0, mat1); + expect(dst.at(0, 0, 0), equals(1)); + }); + + test('cv.addWeightedAsync', () async { + final mat0 = cv.Mat.ones(100, 100, cv.MatType.CV_8UC3).setTo(cv.Scalar.all(100)); + final mat1 = cv.Mat.zeros(100, 100, cv.MatType.CV_8UC3).setTo(cv.Scalar.all(50)); + final dst = await cv.addWeightedAsync(mat0, 0.5, mat1, 0.5, 1); + expect(dst.at(0, 0, 0), equals(75 + 1)); + }); + + test('cv.bitwise_and async', () async { + final mat0 = cv.Mat.ones(100, 100, cv.MatType.CV_8UC3).setTo(cv.Scalar.all(100)); + final mat1 = cv.Mat.zeros(100, 100, cv.MatType.CV_8UC3).setTo(cv.Scalar.all(50)); + final dst = await cv.bitwiseANDAsync(mat0, mat1); + expect(dst.at(0, 0, 0), equals(100 & 50)); + }); + + test('cv.bitwise_not async', () async { + final mat0 = cv.Mat.ones(100, 100, cv.MatType.CV_8UC3).setTo(cv.Scalar.all(100)); + final dst = await cv.bitwiseNOTAsync(mat0); + expect(dst.at(0, 0, 0), equals(155)); + }); + + test('cv.bitwise_or async', () async { + final mat0 = cv.Mat.ones(100, 100, cv.MatType.CV_8UC3).setTo(cv.Scalar.all(100)); + final mat1 = cv.Mat.zeros(100, 100, cv.MatType.CV_8UC3).setTo(cv.Scalar.all(50)); + final dst = await cv.bitwiseORAsync(mat0, mat1); + expect(dst.at(0, 0, 0), equals(100 | 50)); + }); + + test('cv.bitwise_xor async', () async { + final mat0 = cv.Mat.ones(100, 100, cv.MatType.CV_8UC3).setTo(cv.Scalar.all(100)); + final mat1 = cv.Mat.zeros(100, 100, cv.MatType.CV_8UC3).setTo(cv.Scalar.all(50)); + final dst = await cv.bitwiseXORAsync(mat0, mat1); + expect(dst.at(0, 0, 0), equals(100 ^ 50)); + }); + + test('cv.batchDistance async', () async { + final mat0 = cv.Mat.zeros(100, 100, cv.MatType.CV_8UC1); + final mat1 = cv.Mat.zeros(100, 100, cv.MatType.CV_8UC1); + final mask = cv.Mat.zeros(100, 100, cv.MatType.CV_8UC1); + final (dist, _) = await cv.batchDistanceAsync(mat0, mat1, -1, K: 15, mask: mask); + expect(dist.isEmpty, equals(false)); + }); + + test('cv.borderInterpolate async', () async { + final n = await cv.borderInterpolateAsync(1, 5, cv.BORDER_DEFAULT); + expect(n != 0, equals(true)); + }); + + test('cv.calcCovarMatrix async', () async { + final samples = cv.Mat.zeros(10, 10, cv.MatType.CV_32FC1); + final mean = cv.Mat.empty(); + final (covar, _) = await cv.calcCovarMatrixAsync(samples, mean, cv.COVAR_ROWS); + expect(covar.isEmpty, equals(false)); + }); + + test('cv.cartToPolar async', () async { + final x = cv.Mat.zeros(100, 100, cv.MatType.CV_32FC1); + final y = cv.Mat.zeros(100, 100, cv.MatType.CV_32FC1); + final (magnitude, angle) = await cv.cartToPolarAsync(x, y, angleInDegrees: false); + expect(magnitude.isEmpty || angle.isEmpty, equals(false)); + }); + + test('cv.checkRange async', () async { + final mat1 = cv.Mat.zeros(101, 102, cv.MatType.CV_8UC1); + final (success, pos) = await cv.checkRangeAsync(mat1); + expect(success, equals(true)); + expect(pos, equals(cv.Point(0, 0))); + }); + + test('cv.compare async', () async { + final mat1 = cv.Mat.zeros(101, 102, cv.MatType.CV_8UC1); + final mat2 = cv.Mat.zeros(101, 102, cv.MatType.CV_8UC1); + final dst = await cv.compareAsync(mat1, mat2, cv.CMP_EQ); + expect(dst.isEmpty, equals(false)); + }); + + test('cv.countNonZero async', () async { + final mat1 = cv.Mat.ones(101, 102, cv.MatType.CV_8UC1); + final n = await cv.countNonZeroAsync(mat1); + expect(n, equals(101 * 102)); + }); + + test('cv.completeSymm async', () async { + final mat1 = cv.Mat.randn(100, 100, cv.MatType.CV_32FC1); + await cv.completeSymmAsync(mat1); + expect(mat1.at(99, 0), equals(mat1.at(0, 99))); + }); + + test("cv.convertScaleAbs async", () async { + final src = cv.Mat.create(cols: 100, rows: 100, type: cv.MatType.CV_32FC1); + final dst = await cv.convertScaleAbsAsync(src, alpha: 1, beta: 0); + expect(dst.isEmpty, equals(false)); + }); + + test('cv.copyMakeBorder async', () async { + final src = cv.Mat.randn(100, 100, cv.MatType.CV_32FC1); + final dst = await cv.copyMakeBorderAsync(src, 10, 10, 10, 10, cv.BORDER_REFLECT, value: cv.Scalar.all(0)); + expect(dst.isEmpty, equals(false)); + }); + + test('cv.dct async', () async { + final src = cv.Mat.randn(100, 100, cv.MatType.CV_32FC1); + final dst = await cv.dctAsync(src); + expect(dst.isEmpty, equals(false)); + }); + + test('cv.determinant async', () async { + final src = cv.Mat.zeros(101, 101, cv.MatType.CV_32FC1); + final ret = await cv.determinantAsync(src); + expect(ret, equals(0)); + }); + + test('cv.dft async', () async { + final src = cv.Mat.randn(101, 102, cv.MatType.CV_32FC1); + final m = await cv.getOptimalDFTSizeAsync(101); + final n = await cv.getOptimalDFTSizeAsync(102); + expect(m, equals(108)); + expect(n, equals(108)); + final dst = await cv.dftAsync(src); + expect(dst.isEmpty, equals(false)); + }); + + test('cv.divide async', () async { + final mat1 = cv.Mat.ones(101, 102, cv.MatType.CV_32FC1); + final mat2 = cv.Mat.ones(101, 102, cv.MatType.CV_32FC1); + final dst = await cv.divideAsync(mat1, mat2); + expect(dst.isEmpty, equals(false)); + }); + + test('cv.eigen async', () async { + final src = cv.Mat.randn(10, 10, cv.MatType.CV_32FC1); + final (_, eigenValues, eigenVectors) = await cv.eigenAsync(src); + expect(eigenValues.isEmpty || eigenVectors.isEmpty, equals(false)); + }); + + test('cv.eigenNonSymmetric async', () async { + final src = cv.Mat.randn(10, 10, cv.MatType.CV_32FC1); + final (eigenValues, eigenVectors) = await cv.eigenNonSymmetricAsync(src); + expect(eigenValues.isEmpty || eigenVectors.isEmpty, equals(false)); + }); + + test('cv.PCACompute async', () async { + final src = cv.Mat.randn(10, 10, cv.MatType.CV_32FC1); + final mean = cv.Mat.empty(); + final (_, eigenvectors, eigenvalues) = await cv.PCAComputeAsync( + src, + mean, + maxComponents: 2, + ); + expect(mean.isEmpty || eigenvectors.isEmpty || eigenvalues.isEmpty, equals(false)); + expect(eigenvectors.rows, equals(2)); + }); + + test('cv.exp async', () async { + final src = cv.Mat.zeros(10, 10, cv.MatType.CV_32FC1); + final dst = await cv.expAsync(src); + expect(dst.isEmpty, equals(false)); + expect(dst.at(0, 0), equals(1)); + }); + + test('cv.extractChannel async', () async { + final src = cv.Mat.randn(10, 10, cv.MatType.CV_32FC3); + final dst = await cv.extractChannelAsync(src, 2); + expect(dst.isEmpty, equals(false)); + }); + + test('cv.findNonZero async', () async { + final src = cv.Mat.randu(10, 10, cv.MatType.CV_8UC1); + final dst = await cv.findNonZeroAsync(src); + expect(dst.isEmpty, equals(false)); + }); + + test('cv.flip async', () async { + final src = cv.Mat.randu(10, 10, cv.MatType.CV_8UC1); + final dst = await cv.flipAsync(src, 0); + expect(dst.isEmpty, equals(false)); + }); + + test('cv.gemm async', () async { + final src1 = cv.Mat.randu(3, 4, cv.MatType.CV_32FC1); + final src2 = cv.Mat.randu(4, 3, cv.MatType.CV_32FC1); + final src3 = cv.Mat.empty(); + final dst = await cv.gemmAsync(src1, src2, 1, src3, 0); + expect(dst.isEmpty, equals(false)); + expect(dst.rows, equals(src1.rows)); + }); + + test('cv.hconcat async', () async { + final src = cv.Mat.zeros(10, 10, cv.MatType.CV_32FC1); + final dst = await cv.hconcatAsync(src, src); + expect(dst.isEmpty, equals(false)); + expect(dst.cols, equals(src.cols * 2)); + }); + + test('cv.vconcat async', () async { + final src = cv.Mat.zeros(10, 10, cv.MatType.CV_32FC1); + final dst = await cv.vconcatAsync(src, src); + expect(dst.isEmpty, equals(false)); + expect(dst.rows, equals(src.rows * 2)); + }); + + test('cv.rotate async', () async { + final src = cv.Mat.zeros(10, 20, cv.MatType.CV_8UC1); + final dst = await cv.rotateAsync(src, cv.ROTATE_90_CLOCKWISE); + expect(dst.isEmpty, equals(false)); + expect((dst.rows, dst.cols), (src.cols, src.rows)); + }); + + test('cv.idct async', () async { + final src = cv.Mat.randu(4, 4, cv.MatType.CV_32FC1); + final dst = await cv.idctAsync(src); + expect(dst.isEmpty, equals(false)); + expect(dst.rows, equals(src.rows)); + }); + + test('cv.idft async', () async { + final src = cv.Mat.randu(4, 4, cv.MatType.CV_32FC1); + final dst = await cv.idftAsync(src); + expect(dst.isEmpty, equals(false)); + expect(dst.rows, equals(src.rows)); + }); + + test('cv.inRange async', () async { + final mat1 = cv.Mat.randu(101, 102, cv.MatType.CV_8UC1); + final lb = cv.Mat.fromScalar(1, 1, cv.MatType.CV_8UC1, cv.Scalar(20, 100, 100, 0)); + final ub = cv.Mat.fromScalar(1, 1, cv.MatType.CV_8UC1, cv.Scalar(20, 100, 100, 0)); + final dst = await cv.inRangeAsync(mat1, lb, ub); + expect(dst.isEmpty, equals(false)); + }); + + test('cv.inRangebyScalar async', () async { + final mat1 = cv.Mat.randu(101, 102, cv.MatType.CV_8UC1); + final lb = cv.Scalar(20, 100, 100, 0); + final ub = cv.Scalar(20, 100, 100, 0); + final dst = await cv.inRangebyScalarAsync(mat1, lb, ub); + expect(dst.isEmpty, equals(false)); + }); + + test('cv.insertChannel async', () async { + final src = cv.Mat.randu(4, 4, cv.MatType.CV_8UC1); + final dst = cv.Mat.randu(4, 4, cv.MatType.CV_8UC3); + await cv.insertChannelAsync(src, dst, 1); + expect(dst.channels, equals(3)); + }); + + test('cv.invert async', () async { + final src = cv.Mat.randu(4, 4, cv.MatType.CV_32FC1); + final (_, dst) = await cv.invertAsync(src); + expect(dst.isEmpty, equals(false)); + }); + + test('cv.kmeans async', () async { + final src = cv.Mat.randu(4, 4, cv.MatType.CV_32FC1); + final bestLabels = cv.Mat.empty(); + const criteria = (cv.TERM_COUNT, 10, 1.0); + final (_, _, centers) = await cv.kmeansAsync(src, 2, bestLabels, criteria, 2, cv.KMEANS_RANDOM_CENTERS); + expect(centers.isEmpty, equals(false)); + }); + + test('cv.kmeansByPoints async', () async { + final src = [cv.Point2f(0, 0), cv.Point2f(1, 1)].cvd; + final bestLabels = cv.Mat.empty(); + const criteria = (cv.TERM_COUNT, 10, 1.0); + final (_, _, centers) = + await cv.kmeansByPointsAsync(src, 2, bestLabels, criteria, 2, cv.KMEANS_RANDOM_CENTERS); + expect(centers.isEmpty, equals(false)); + }); + + test('cv.log async', () async { + final src = cv.Mat.randu(4, 3, cv.MatType.CV_32FC1); + final dst = await cv.logAsync(src); + expect(dst.isEmpty, equals(false)); + }); + + test('cv.LUT async', () async { + Future testOneLUT(cv.Mat src, cv.Mat lut) async { + expect(lut.channels == src.channels || lut.channels == 1, true); + expect(lut.isContinus, true); + final sw = Stopwatch(); + sw.start(); + final dst = await cv.LUTAsync(src, lut); + sw.stop(); + // print('${src.type} -> ${lut.type}(${src.rows}x${src.cols}): ${sw.elapsedMilliseconds}ms'); + expect(dst.isEmpty, false); + expect(src.shape, dst.shape); + } + + final depthSrc = [cv.MatType.CV_8U, cv.MatType.CV_8S, cv.MatType.CV_16U, cv.MatType.CV_16S]; + final depthLut = [ + cv.MatType.CV_8U, + cv.MatType.CV_8S, + cv.MatType.CV_16U, + cv.MatType.CV_16S, + cv.MatType.CV_32S, + cv.MatType.CV_32F, + cv.MatType.CV_64F, + ]; + for (final int channel in [1, 2, 3, 4]) { + for (final depth in depthSrc) { + final srcType = cv.MatType.makeType(depth, channel); + final src = cv.Mat.randu(3, 3, srcType, low: cv.Scalar.all(0), high: cv.Scalar.all(255)); + final lutSize = switch (depth) { + cv.MatType.CV_8U || cv.MatType.CV_8S => 256, + cv.MatType.CV_16U || cv.MatType.CV_16S => 65536, + _ => throw Exception("Unsupported type"), + }; + for (final lutDepth in depthLut) { + final lutType = cv.MatType.makeType(lutDepth, channel); + // 0-1: 65536-1-0 2-3: 65536-1-1 3-4: 65536-1-2 + final lutData = switch (lutDepth) { + cv.MatType.CV_32F || + cv.MatType.CV_64F => + List.generate(lutSize * lutType.channels, (i) => (lutSize - (i ~/ channel) - 1).toDouble()), + _ => List.generate(lutSize * lutType.channels, (i) => lutSize - (i ~/ channel) - 1), + }; + final lutInverse = cv.Mat.fromList(1, lutSize, lutType, lutData); + await testOneLUT(src, lutInverse); + } + } + } + }); + + test('cv.LUT 1 async', () async { + final mat = cv.imread("test/images/lenna.png", flags: cv.IMREAD_COLOR); + final src = mat.convertTo(cv.MatType.CV_16UC3, alpha: 65536.0 / 255.0); + final lutData = List.generate(65536 * 3, (i) => 65536 - (i ~/ 3) - 1); + final lut = cv.Mat.fromList(1, 65536, cv.MatType.CV_16UC3, lutData); + final dst = await cv.LUTAsync(src, lut); + expect(dst.isEmpty, equals(false)); + expect(dst.shape, src.shape); + // cv.imwrite("lut.png", dst.convertTo(cv.MatType.CV_8UC3, alpha: 255.0/65536.0)); + }); + + test('cv.magnitude async', () async { + final src1 = cv.Mat.randu(4, 4, cv.MatType.CV_32FC1); + final src2 = cv.Mat.randu(4, 4, cv.MatType.CV_32FC1); + final dst = await cv.magnitudeAsync(src1, src2); + expect(dst.isEmpty, equals(false)); + }); + + test('cv.max async', () async { + final src1 = cv.Mat.randu(4, 4, cv.MatType.CV_32FC1); + final src2 = cv.Mat.randu(4, 4, cv.MatType.CV_32FC1); + final dst = await cv.maxAsync(src1, src2); + expect(dst.isEmpty, equals(false)); + }); + + test('cv.min async', () async { + final src1 = cv.Mat.randu(4, 4, cv.MatType.CV_32FC1); + final src2 = cv.Mat.randu(4, 4, cv.MatType.CV_32FC1); + final dst = await cv.minAsync(src1, src2); + expect(dst.isEmpty, equals(false)); + }); + + test('cv.meanStdDev async', () async { + final src = cv.Mat.randu(101, 102, cv.MatType.CV_8UC3); + final (mean, stdDev) = await cv.meanStdDevAsync(src); + expect(mean.val, isNotEmpty); + expect(stdDev.val, isNotEmpty); + }); + + test('cv.merge async', () async { + final src = [ + cv.Mat.randu(101, 102, cv.MatType.CV_8UC1), + cv.Mat.randu(101, 102, cv.MatType.CV_8UC1), + cv.Mat.randu(101, 102, cv.MatType.CV_8UC1), + ].cvd; + final dst = await cv.mergeAsync(src); + expect(dst.isEmpty, equals(false)); + expect(dst.channels, equals(3)); + }); + + test('cv.minMaxIdx async', () async { + final src = cv.Mat.randu(10, 10, cv.MatType.CV_32FC1); + final (min, max, minIdx, maxIdx) = await cv.minMaxIdxAsync(src); + expect(minIdx, greaterThanOrEqualTo(0)); + expect(maxIdx, greaterThanOrEqualTo(0)); + expect(max > min, equals(true)); + }); + + test('cv.minMaxLoc async', () async { + final src = cv.Mat.randu(10, 10, cv.MatType.CV_32FC1); + final (min, max, minLoc, maxLoc) = await cv.minMaxLocAsync(src); + expect(minLoc.x, greaterThanOrEqualTo(0)); + expect(maxLoc.x, greaterThanOrEqualTo(0)); + expect(max > min, equals(true)); + }); + + test('cv.mixChannels async', () async { + final bgra = cv.Mat.fromScalar(100, 100, cv.MatType.CV_8UC4, cv.Scalar(255, 0, 0, 255)); + final bgr = cv.Mat.create(cols: bgra.cols, rows: bgra.rows, type: cv.MatType.CV_8UC3); + final alpha = cv.Mat.create(cols: bgra.cols, rows: bgra.rows, type: cv.MatType.CV_8UC1); + final out = [bgr, alpha].cvd; + final fromTo = [0, 2, 1, 1, 2, 0, 3, 3].i32; + final dst = await cv.mixChannelsAsync([bgra].cvd, out, fromTo); + expect(dst.isEmpty, false); + }); + + test('cv.mulSpectrums async', () async { + final a = cv.Mat.zeros(101, 102, cv.MatType.CV_32FC1); + final b = cv.Mat.zeros(101, 102, cv.MatType.CV_32FC1); + + final dst = await cv.mulSpectrumsAsync(a, b, 0); + expect(dst.isEmpty, false); + + final dst1 = await cv.mulSpectrumsAsync(a, b, cv.DFT_ROWS); + expect(dst1.isEmpty, false); + }); + + test('cv.multiply async', () async { + final mat1 = cv.Mat.randn(101, 102, cv.MatType.CV_64FC1); + final mat2 = cv.Mat.randn(101, 102, cv.MatType.CV_64FC1); + final mat3 = await cv.multiplyAsync(mat1, mat2); + expect(mat3.isEmpty, equals(false)); + expect(mat3.at(0, 0), equals(mat1.at(0, 0) * mat2.at(0, 0))); + }); + + test('cv.normalize async', () async { + final src = cv.Mat.randn(101, 102, cv.MatType.CV_8UC1); + final dst = cv.Mat.empty(); + await cv.normalizeAsync(src, dst); + expect(dst.isEmpty, equals(false)); + }); + + test('cv.norm async', () async { + final src1 = cv.Mat.zeros(100, 100, cv.MatType.CV_8UC1); + final n = await cv.normAsync(src1); + expect(n, equals(0)); + + final src2 = cv.Mat.zeros(100, 100, cv.MatType.CV_8UC1); + final n1 = await cv.norm1Async(src1, src2); + expect(n1, equals(0)); + }); + + test('cv.perspectiveTransform async', () async { + final src = cv.Mat.zeros(100, 1, cv.MatType.CV_32FC2); + final tm = cv.Mat.zeros(3, 3, cv.MatType.CV_32FC1); + final dst = await cv.perspectiveTransformAsync(src, tm); + expect(dst.isEmpty, equals(false)); + }); + + test('cv.solve async', () async { + final a = cv.Mat.zeros(3, 3, cv.MatType.CV_32FC1); + final b = cv.Mat.zeros(3, 1, cv.MatType.CV_32FC1); + final testPoints = [ + (1.0, 1.0, 1.0, 0.0), + (0.0, 0.0, 1.0, 2.0), + (9.0, 3.0, 1.0, 2.0), + ]; + for (var i = 0; i < testPoints.length; i++) { + a.set(i, 0, testPoints[i].$1); + a.set(i, 1, testPoints[i].$2); + a.set(i, 2, testPoints[i].$3); + b.set(i, 0, testPoints[i].$4); + } + final (solved, solve) = await cv.solveAsync(a, b, flags: cv.DECOMP_LU); + expect(solved, equals(true)); + expect((solve.at(0, 0), solve.at(1, 0), solve.at(2, 0)), (1, -3, 2)); + }); + + test('cv.solveCubic async', () async { + final coeffs = cv.Mat.zeros(1, 4, cv.MatType.CV_32FC1); + coeffs.set(0, 0, 2.0); + coeffs.set(0, 1, 3.0); + coeffs.set(0, 2, -11.0); + coeffs.set(0, 3, -6.0); + + final (rootsCount, roots) = await cv.solveCubicAsync(coeffs); + expect(rootsCount, equals(3)); + expect((roots.at(0, 0), roots.at(0, 1), roots.at(0, 2)), (-3.0, 2.0, -0.5)); + }); + + test('cv.solvePoly async', () async { + final coeffs = cv.Mat.zeros(1, 3, cv.MatType.CV_32FC1); + coeffs.set(0, 0, 49.0); + coeffs.set(0, 1, -14.0); + coeffs.set(0, 2, 1.0); + + final (diffError, roots) = await cv.solvePolyAsync(coeffs); + expect(diffError, lessThan(1.0e-61)); + expect(roots.at(0, 0), equals(7.0)); + }); + + test('cv.reduce async', () async { + final src = cv.Mat.randu(2, 3, cv.MatType.CV_8UC1); + for (var i = 0; i < src.rows; i++) { + for (var j = 0; j < src.cols; j++) { + src.set(i, j, j + 1); + } + } + final dst = await cv.reduceAsync(src, 0, cv.REDUCE_SUM, dtype: cv.MatType.CV_32FC1.value); + expect((dst.rows, dst.cols), equals((1, 3))); + expect((dst.at(0, 0), dst.at(0, 1), dst.at(0, 2)), (2, 4, 6)); + + final dst1 = await cv.reduceAsync(src, 1, cv.REDUCE_SUM, dtype: cv.MatType.CV_32FC1.value); + expect((dst1.rows, dst1.cols), equals((2, 1))); + expect((dst1.at(0, 0), dst1.at(1, 0)), (6, 6)); + }); + + test('cv.reduceArgMax async', () async { + final src = cv.Mat.randu(2, 3, cv.MatType.CV_8UC1); + for (var i = 0; i < src.rows; i++) { + for (var j = 0; j < src.cols; j++) { + src.set(i, j, j + 1); + } + } + final dst = await cv.reduceArgMaxAsync(src, 1); + expect((dst.rows, dst.cols), equals((2, 1))); + expect((dst.at(0, 0), dst.at(1, 0)), (2, 2)); + }); + + test('cv.reduceArgMin async', () async { + final src = cv.Mat.randu(2, 3, cv.MatType.CV_8UC1); + for (var i = 0; i < src.rows; i++) { + for (var j = 0; j < src.cols; j++) { + src.set(i, j, j + 1); + } + } + final dst = await cv.reduceArgMinAsync(src, 1); + expect((dst.rows, dst.cols), equals((2, 1))); + expect((dst.at(0, 0), dst.at(1, 0)), (0, 0)); + }); + + test('cv.repeat async', () async { + final src = cv.Mat.randu(1, 3, cv.MatType.CV_8UC1); + for (var i = 0; i < src.rows; i++) { + for (var j = 0; j < src.cols; j++) { + src.set(i, j, j); + } + } + final dst = await cv.repeatAsync(src, 3, 1); + expect((dst.rows, dst.cols), equals((3, 3))); + }); + + test('cv.scaleAdd async', () async { + final src = cv.Mat.randu(2, 3, cv.MatType.CV_64FC1); + final src2 = cv.Mat.randu(2, 3, cv.MatType.CV_64FC1); + final dst = await cv.scaleAddAsync(src, 0.6, src2); + expect(dst.at(0, 0), closeTo(src.at(0, 0) * 0.6 + src2.at(0, 0), 1e-4)); + }); + + test('cv.setIdentity async', () async { + final src = cv.Mat.randu(4, 3, cv.MatType.CV_64FC1); + await cv.setIdentityAsync(src, s: cv.Scalar.all(2.5)); + expect(src.isEmpty, false); + expect((src.at(0, 0), src.at(1, 1), src.at(2, 2)), (2.5, 2.5, 2.5)); + }); + + test('cv.sort async', () async { + final src = cv.Mat.randu(2, 3, cv.MatType.CV_8UC1); + for (var i = 0; i < src.rows; i++) { + for (var j = 0; j < src.cols; j++) { + src.set(i, j, j); + } + } + final dst = await cv.sortAsync(src, cv.SORT_EVERY_ROW + cv.SORT_DESCENDING); + expect(dst.isEmpty, false); + expect(dst.at(0, 0), 2); + }); + + test('cv.sortIdx async', () async { + final src = cv.Mat.randu(2, 3, cv.MatType.CV_8UC1); + for (var i = 0; i < src.rows; i++) { + for (var j = 0; j < src.cols; j++) { + src.set(i, j, j); + } + } + final dst = await cv.sortIdxAsync(src, cv.SORT_EVERY_ROW + cv.SORT_DESCENDING); + expect(dst.isEmpty, false); + + expect(dst.at(0, 0), 2); + }); + + test('cv.split async', () async { + final src = cv.imread("test/images/lenna.png", flags: cv.IMREAD_COLOR); + final chans = cv.split(src); + expect(chans.length, equals(src.channels)); + + final dst = await cv.mergeAsync(chans); + expect(dst.isEmpty, false); + + final diff = await cv.absDiffAsync(src, dst); + expect(diff.isEmpty, false); + + final sum = diff.sum(); + expect(sum, equals(cv.Scalar.black)); + }); + + test('cv.subtract async', () async { + final src1 = cv.Mat.zeros(10, 10, cv.MatType.CV_8UC3); + final src2 = cv.Mat.ones(10, 10, cv.MatType.CV_8UC3); + final dst = await cv.subtractAsync(src2, src1); + expect(dst.isEmpty, false); + expect(dst.at(0, 0), equals(1)); + }); + + test('cv.trace async', () async { + final src = cv.Mat.randu(3, 3, cv.MatType.CV_8UC1); + for (var row = 0; row < src.rows; row++) { + for (var col = 0; col < src.cols; col++) { + if (row == col) { + src.set(row, col, 1); + } + } + } + + final trace = await cv.traceAsync(src); + expect(trace, equals(cv.Scalar(3, 0, 0, 0))); + }); + + test('cv.transform async', () async { + final src = cv.Mat.randu(3, 3, cv.MatType.CV_8UC3); + final tm = cv.Mat.zeros(4, 4, cv.MatType.CV_8UC4); + final dst = await cv.transformAsync(src, tm); + expect(dst.isEmpty, false); + }); + + test('cv.transpose async', () async { + final src = cv.imread("test/images/lenna.png", flags: cv.IMREAD_COLOR); + final dst = await cv.transposeAsync(src); + expect((dst.rows, dst.cols), (src.cols, src.rows)); + }); + + test('cv.pow async', () async { + final src = cv.Mat.fromScalar(512, 512, cv.MatType.CV_8UC3, cv.Scalar.all(2)); + final dst = await cv.powAsync(src, 3); + expect(dst.at(0, 0), 8); + }); + + test('cv.polarToCart async', () async { + final magnitude = cv.Mat.zeros(101, 102, cv.MatType.CV_32FC1); + final angle = cv.Mat.zeros(101, 102, cv.MatType.CV_32FC1); + final (x, y) = await cv.polarToCartAsync(magnitude, angle); + expect(x.isEmpty || y.isEmpty, false); + }); + + test('cv.phase async', () async { + final x = cv.Mat.fromScalar(1, 1, cv.MatType.CV_32FC1, cv.Scalar(1.1, 2.2, 3.3, 4.4)); + final y = cv.Mat.fromScalar(1, 1, cv.MatType.CV_32FC1, cv.Scalar(5.5, 6.6, 7.7, 8.8)); + final angle = await cv.phaseAsync(x, y); + expect(angle.isEmpty, false); + expect(angle.rows, equals(x.rows)); + }); + + test('cv.randn async', () async { + final dst = cv.Mat.zeros(10, 10, cv.MatType.CV_32FC1); + await cv.randnAsync(dst, cv.Scalar.all(10), cv.Scalar.all(1)); + expect(dst.isEmpty, false); + }); + + test('cv.randu async', () async { + final dst = cv.Mat.zeros(10, 10, cv.MatType.CV_32FC1); + await cv.randuAsync(dst, cv.Scalar.all(10), cv.Scalar.all(100)); + expect(dst.isEmpty, false); + }); + + test('cv.randShuffle async', () async { + final dst = cv.Mat.zeros(10, 10, cv.MatType.CV_32FC1); + await cv.randShuffleAsync(dst); + expect(dst.isEmpty, false); + }); +} diff --git a/test/core/core_test.dart b/test/core/core_test.dart index 6bf82dbb..2f8b111b 100644 --- a/test/core/core_test.dart +++ b/test/core/core_test.dart @@ -4,16 +4,28 @@ import 'package:opencv_dart/opencv_dart.dart' as cv; import 'package:test/test.dart'; void main() async { - test('openCvVersion', () { - final version = cv.openCvVersion(); - print(version); - expect(version.length, greaterThan(0)); + test('openCvVersion', () async { + { + final version = cv.openCvVersion(); + print(version); + expect(version.length, greaterThan(0)); + } + { + final version = await cv.openCvVersionAsync(); + expect(version.length, greaterThan(0)); + } }); - test('cv.getBuildInformation', () { - final info = cv.getBuildInformation(); - print(info); - expect(info.length, greaterThan(0)); + test('cv.getBuildInformation', () async { + { + final info = cv.getBuildInformation(); + print(info); + expect(info.length, greaterThan(0)); + } + { + final info = await cv.getBuildInformationAsync(); + expect(info.length, greaterThan(0)); + } }); test('cv.AsyncArray', () { @@ -706,10 +718,10 @@ void main() async { expect(dst.isEmpty, false); }); - test('cv.theRNG', () { + test('cv.theRNG', () async { final rng = cv.theRNG(); for (var i = 0; i < 10000; i++) { - expect(rng.next(), isA()); + expect(await rng.next().first, isA()); } }); diff --git a/test/core/mat_async_test.dart b/test/core/mat_async_test.dart new file mode 100644 index 00000000..acee0523 --- /dev/null +++ b/test/core/mat_async_test.dart @@ -0,0 +1,125 @@ +import 'package:opencv_dart/opencv_dart.dart' as cv; +import 'package:test/test.dart'; + +void main() async { + test('Mat Creation Async', () async { + final mat0 = await cv.MatAsync.emptyAsync(); + expect(mat0.isEmpty, true); + + final mat1 = await cv.MatAsync.createAsync(cols: 100, rows: 100, r: 255, g: 255, b: 255); + expect(mat1.isEmpty, equals(false)); + expect((mat1.width, mat1.height, mat1.channels), (100, 100, 3)); + expect(mat1.type, cv.MatType.CV_8UC3); + expect(mat1.total, equals(100 * 100)); + expect(mat1.isContinus, equals(true)); + expect(mat1.step, equals(100 * 3)); + expect(mat1.elemSize, equals(3)); + expect(mat1.at(0, 0, 0), 255); + + final mat2 = await cv.MatAsync.zerosAsync(3, 3, cv.MatType.CV_8UC1); + expect((mat2.width, mat2.height, mat2.channels), (3, 3, 1)); + expect(mat2.countNoneZero, equals(0)); + mat2.setU8(0, 0, 241); + expect(mat2.toList()[0][0], 241); + + final mat3 = await cv.MatAsync.eyeAsync(3, 3, cv.MatType.CV_8UC3); + expect((mat3.width, mat3.height, mat3.channels), (3, 3, 3)); + final expected3 = List.generate( + mat3.rows, + (row) => List.generate( + mat3.cols, + (col) => List.generate(mat3.channels, (c) => row == col && c == 0 ? 1 : 0), + ), + ); + expect(mat3.toList3D(), expected3); + + final mat4 = await cv.MatAsync.onesAsync(100, 100, cv.MatType.CV_8UC3); + expect((mat4.width, mat4.height, mat4.channels), (100, 100, 3)); + + final mat5 = await mat4.convertToAsync(cv.MatType.CV_8UC1); + mat5.setTo(cv.Scalar.all(255)); + expect(mat5.at(0, 0), equals(255)); + }); + + test('cv.MatAsync.fromVecAsync', () async { + final points = [cv.Point(1, 2), cv.Point(3, 4), cv.Point(5, 6), cv.Point(7, 8)]; + final mat = await cv.MatAsync.fromVecAsync(points.cvd); + expect(mat.rows, equals(4)); + expect(mat.cols, equals(1)); + expect(mat.channels, equals(2)); + expect(mat.at(0, 0), 1); + + final points1 = [cv.Point2f(1, 2), cv.Point2f(3, 4), cv.Point2f(5, 6), cv.Point2f(7, 8)]; + final mat1 = await cv.MatAsync.fromVecAsync(points1.cvd); + expect(mat1.rows, equals(4)); + expect(mat1.cols, equals(1)); + expect(mat1.channels, equals(2)); + expect(mat1.at(0, 0), 1); + + final points2 = [cv.Point3f(1, 2, 1), cv.Point3f(3, 4, 3), cv.Point3f(5, 6, 5), cv.Point3f(7, 8, 7)]; + final mat2 = await cv.MatAsync.fromVecAsync(points2.cvd); + expect(mat2.rows, equals(4)); + expect(mat2.cols, equals(1)); + expect(mat2.channels, equals(3)); + expect(mat2.at(0, 0), 1); + }); + + test('cv.MatAsync Operations', () async { + final mat1 = await cv.MatAsync.fromScalarAsync(3, 3, cv.MatType.CV_16UC3, cv.Scalar.all(999)); + expect(mat1.at(0, 0), equals(999)); + + final mat2 = await mat1.cloneAsync(); + expect(mat2.at(0, 0), mat1.at(0, 0)); + + final mat3 = await mat2.regionAsync(cv.Rect(0, 0, 2, 2)); + expect(mat3.rows, equals(2)); + expect(mat3.cols, equals(2)); + expect(mat3.at(0, 0), equals(999)); + + final mat4 = await cv.MatAsync.emptyAsync(); + await mat1.copyToAsync(mat4); + + final mat5 = await mat1.reshapeAsync(3, 9); + expect(mat5.rows, equals(9)); + expect(mat5.cols, equals(1)); + }); + + test('Mat Rotate async', () async { + final mat0 = await cv.MatAsync.onesAsync(200, 100, cv.MatType.CV_8UC3); + final mat1 = await mat0.rotateAsync(cv.ROTATE_90_CLOCKWISE); + expect((mat1.height, mat1.width, mat1.channels), (100, 200, 3)); + + final mat2 = await mat1.rotateAsync(cv.ROTATE_90_CLOCKWISE); + expect((mat2.height, mat2.width, mat2.channels), (200, 100, 3)); + }); + + test('Mat test others Async', () async { + final mat0 = await cv.MatAsync.fromScalarAsync(200, 100, cv.MatType.CV_8UC3, cv.Scalar.all(1)); + expect(mat0.props, equals([mat0.ptr.address])); + final data = mat0.data; + expect(data.length, greaterThan(0)); + + final mean_ = await mat0.meanAsync(); + expect(mean_.val1, equals(1)); + + final sum_ = await mat0.sumAsync(); + expect(sum_.val1, equals(200 * 100)); + + final mat1 = await mat0.convertToAsync(cv.MatType.CV_32FC3); + expect(mat1.at(0, 0), 1); + final sqrt_ = await mat1.sqrtAsync(); + expect(sqrt_.at(0, 0), equals(1.0)); + + final matB = await cv.extractChannelAsync(mat0, 0); + final meanB = await matB.meanAsync(); + expect(meanB.val1, equals(1)); + final sumB = await matB.sumAsync(); + expect(sumB.val1, equals(200 * 100)); + + final matG = await cv.extractChannelAsync(mat0, 1); + final meanG = await matG.meanAsync(); + expect(meanG.val1, equals(1)); + + await matG.convertTo(cv.MatType.CV_32FC1).patchNaNsAsync(val: 1); + }); +} diff --git a/test/core/others_test.dart b/test/core/others_test.dart index 7435df31..2cdd01c9 100644 --- a/test/core/others_test.dart +++ b/test/core/others_test.dart @@ -2,7 +2,6 @@ import 'dart:ffi'; import 'package:ffi/ffi.dart'; import 'package:opencv_dart/opencv_dart.dart' as cv; -import 'package:opencv_dart/src/core/termcriteria.dart'; import 'package:test/test.dart'; void main() { @@ -271,16 +270,4 @@ void main() { vec.dispose(); }); - - test('cv.TermCriteria', () { - final arena = Arena(); - const tc = (cv.TERM_COUNT, 10, 0.1); - final tcNative = tc.toNativePtr(arena); - final tc1 = tcNative.ref.toDart(); - expect(tc1, tc); - expect(tc.type, cv.TERM_COUNT); - expect(tc.count, 10); - expect(tc.eps, closeTo(0.1, 1e-6)); - arena.releaseAll(); - }); } diff --git a/test/core/rng_async_test.dart b/test/core/rng_async_test.dart new file mode 100644 index 00000000..d846de36 --- /dev/null +++ b/test/core/rng_async_test.dart @@ -0,0 +1,33 @@ +import 'package:opencv_dart/opencv_dart.dart' as cv; +import 'package:test/test.dart'; + +void main() async { + test("cv.RNG", () async { + final rng = await cv.RngAsync.createAsync(); + final v = await rng.uniformAsync(0, 241, maxCount: 10000).take(10000).toList(); + expect(v, everyElement(greaterThanOrEqualTo(0))); + final v1 = await rng.uniformAsync(2.41, 241.0).take(10000).toList(); + expect(v1, everyElement(greaterThanOrEqualTo(2.41))); + + rng.dispose(); + }); + + test("cv.RNG.fromSeed", () async { + final rng = await cv.RngAsync.fromSeedAsync(241); + final v = await rng.gaussianAsync(2.41).take(10000).toList(); + expect(v.length, equals(10000)); + + final v1 = await rng.nextAsync().first; + expect(v1, isA()); + + final rng1 = cv.Rng.fromSeed(241); + expect(rng == rng1, false); + }); + + test("cv.RNG.fill", () async { + final rng = cv.Rng.fromSeed(241); + final mat = cv.Mat.zeros(241, 241, cv.MatType.CV_32FC3); + await rng.fillAsync(mat, cv.RNG_DIST_NORMAL, 0, 10, inplace: true); + expect(mat.at(0, 0) != 0, true); + }); +} diff --git a/test/core/rng_test.dart b/test/core/rng_test.dart index c9b7cbb9..a22af11c 100644 --- a/test/core/rng_test.dart +++ b/test/core/rng_test.dart @@ -2,22 +2,22 @@ import 'package:opencv_dart/opencv_dart.dart' as cv; import 'package:test/test.dart'; void main() { - test("cv.RNG", () { + test("cv.RNG", () async { final rng = cv.Rng(); - final v = List.generate(100000, (index) => rng.uniform(0, 241)); + final v = await rng.uniformAsync(0, 241, maxCount: 100000).take(10000).toList(); expect(v, everyElement(greaterThanOrEqualTo(0))); - final v1 = List.generate(100000, (index) => rng.uniform(2.41, 241.0)); + final v1 = await rng.uniformAsync(2.41, 241.0).take(100000).toList(); expect(v1, everyElement(greaterThanOrEqualTo(2.41))); rng.dispose(); }); - test("cv.RNG.fromSeed", () { + test("cv.RNG.fromSeed", () async { final rng = cv.Rng.fromSeed(241); - final v = List.generate(100000, (index) => rng.gaussian(2.41)); + final v = await rng.gaussian(2.41).take(100000).toList(); expect(v.length, equals(100000)); - final v1 = rng.next(); + final v1 = await rng.next().first; expect(v1, isA()); final rng1 = cv.Rng.fromSeed(241); diff --git a/test/core/vec_test.dart b/test/core/vec_test.dart index d82972b2..bf234e4f 100644 --- a/test/core/vec_test.dart +++ b/test/core/vec_test.dart @@ -120,9 +120,9 @@ void main() { expect(rect.points.length, greaterThan(0)); expect(rect.boundingRect, cv.Rect(-6, -6, 15, 15)); expect(rect.center, cv.Point2f(1, 1)); - expect(rect.size, (10, 10)); + expect(rect.size, cv.Size2f(10, 10)); expect(rect.angle, 60); - expect(rect.toString(), 'RotatedRect(Point2f(1.000, 1.000), (10.0, 10.0), 60.000)'); + expect(rect.toString(), 'RotatedRect(Point2f(1.000, 1.000), Size2f(10.000, 10.000), 60.000)'); final rect2 = cv.RotatedRect.fromNative(rect.ref); expect(rect2, rect); diff --git a/test/dnn/dnn_async_test.dart b/test/dnn/dnn_async_test.dart new file mode 100644 index 00000000..8173df38 --- /dev/null +++ b/test/dnn/dnn_async_test.dart @@ -0,0 +1,274 @@ +@Tags(["no-local-files"]) + +import 'dart:io'; +import 'package:opencv_dart/opencv_dart.dart' as cv; +import 'package:test/test.dart'; + +Future checkCaffeNetAsync(cv.Net net) async { + expect(net.isEmpty, false); + await net.setPreferableBackendAsync(cv.DNN_BACKEND_DEFAULT); + await net.setPreferableTargetAsync(cv.DNN_TARGET_CPU); + + final img = await cv.imreadAsync("test/images/space_shuttle.jpg", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + + final blob = await cv.blobFromImageAsync( + img, + scalefactor: 1.0, + size: (224, 224), + mean: cv.Scalar.all(0), + swapRB: false, + crop: false, + ); + expect(blob.isEmpty, false); + + await net.setInputAsync(blob, name: "data"); + final layer = await net.getLayerAsync(0); + expect(await layer.inputNameToIndexAsync("notthere"), -1); + expect(await layer.outputNameToIndexAsync("notthere"), -1); + expect(await layer.nameAsync, "_input"); + expect(await layer.typeAsync, ""); + + final ids = await net.getUnconnectedOutLayersAsync(); + expect((ids.length, ids.first), (1, 142)); + + final lnames = await net.getLayerNamesAsync(); + expect((lnames.length, lnames[1]), (142, "conv1/relu_7x7")); + + final prob = await net.forwardLayersAsync(["prob"]); + expect(prob.length, greaterThan(0)); + expect(prob.first.isEmpty, false); + + final probMat = prob.first.reshape(1, 1); + //TODO: Migrate to async + final (_, maxVal, minLoc, maxLoc) = cv.minMaxLoc(probMat); + expect(maxVal, closeTo(0.9998, 5e-5)); + expect((minLoc.x, minLoc.y), (955, 0)); + expect((maxLoc.x, maxLoc.y), (812, 0)); + + final perf = await net.getPerfProfileAsync(); + expect(perf, greaterThan(0)); + + return true; +} + +Future checkTensorflowAsync(cv.Net net) async { + expect(net.isEmpty, false); + final img = await cv.imreadAsync("test/images/space_shuttle.jpg", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + + final blob = await cv.blobFromImageAsync( + img, + scalefactor: 1.0, + size: (224, 224), + mean: cv.Scalar.all(0), + swapRB: true, + crop: false, + ); + expect(blob.isEmpty, false); + + await net.setInputAsync(blob, name: "input"); + final prob = await net.forwardLayersAsync(["softmax2"]); + expect(prob.isEmpty, false); + + final probMat = prob.first.reshape(1, 1); + //TODO: Migrate to async + final (_, maxVal, minLoc, maxLoc) = cv.minMaxLoc(probMat); + expect(maxVal, closeTo(1.0, 5e-5)); + expect((minLoc.x, minLoc.y), (481, 0)); + expect((maxLoc.x, maxLoc.y), (234, 0)); + + final perf = await net.getPerfProfileAsync(); + expect(perf, greaterThan(0)); + + return true; +} + +Future checkOnnxAsync(cv.Net net) async { + expect(net.isEmpty, false); + final img = await cv.imreadAsync("test/images/space_shuttle.jpg", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + + final blob = await cv.blobFromImageAsync( + img, + scalefactor: 1.0, + size: (224, 224), + mean: cv.Scalar.all(0), + swapRB: true, + crop: false, + ); + expect(blob.isEmpty, false); + + await net.setInputAsync(blob, name: "data_0"); + final prob = await net.forwardLayersAsync(["prob_1"]); + expect(prob.isEmpty, false); + + final probMat = prob.first.reshape(1, 1); + //TODO: Migrate to async + final (_, maxVal, minLoc, maxLoc) = cv.minMaxLoc(probMat); + expect(maxVal, closeTo(0.9965, 5e-3)); + expect((minLoc.x, minLoc.y), (955, 0)); + expect((maxLoc.x, maxLoc.y), (812, 0)); + + final perf = await net.getPerfProfileAsync(); + expect(perf, greaterThan(0)); + + return true; +} + +Future checkTfliteAsync(cv.Net net) async { + expect(net.isEmpty, false); + final img = await cv.imreadAsync("test/images/space_shuttle.jpg", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + + final blob = await cv.blobFromImageAsync( + img, + scalefactor: 1.0, + size: (224, 224), + mean: cv.Scalar.all(0), + swapRB: true, + crop: false, + ); + expect(blob.isEmpty, false); + + // TODO: TFLite support of opencv is not complete + // print(net.getLayerNames()); + // net.setInput(blob, name: "inputs_0"); + + return true; +} + +void main() async { + test('cv.NetAsync.fromFileAsync', () async { + final net = await cv.NetAsync.emptyAsync(); + expect(net.isEmpty, true); + + final model = await cv.NetAsync.fromFileAsync( + "test/models/bvlc_googlenet.caffemodel", + config: "test/models/bvlc_googlenet.prototxt", + ); + await checkCaffeNetAsync(model); + expect(await model.dumpAsync(), isNotEmpty); + + model.dispose(); + }); + + test('cv.NetAsync.fromBytesAsync', () async { + final bytes = await File("test/models/bvlc_googlenet.caffemodel").readAsBytes(); + final config = await File("test/models/bvlc_googlenet.prototxt").readAsBytes(); + final model = await cv.NetAsync.fromBytesAsync("caffe", bytes, bufferConfig: config); + await checkCaffeNetAsync(model); + + model.dispose(); + }); + + test('cv.NetAsync.fromCaffeAsync', () async { + final model = await cv.NetAsync.fromCaffeAsync( + "test/models/bvlc_googlenet.prototxt", + "test/models/bvlc_googlenet.caffemodel", + ); + await checkCaffeNetAsync(model); + }); + + test('cv.NetAsync.fromCaffeBytesAsync', () async { + final bytes = await File("test/models/bvlc_googlenet.caffemodel").readAsBytes(); + final config = await File("test/models/bvlc_googlenet.prototxt").readAsBytes(); + final model = await cv.NetAsync.fromCaffeBytesAsync(config, bytes); + await checkCaffeNetAsync(model); + }); + + test('cv.NetAsync.fromOnnxAsync', () async { + final model = await cv.NetAsync.fromOnnxAsync("test/models/googlenet-9.onnx"); + await checkOnnxAsync(model); + }); + + test('cv.NetAsync.fromOnnxBytesAsync', () async { + final bytes = await File("test/models/googlenet-9.onnx").readAsBytes(); + final model = await cv.NetAsync.fromOnnxBytesAsync(bytes); + await checkOnnxAsync(model); + }); + + test('cv.NetAsync.fromTensorflowAsync', () async { + final model = await cv.NetAsync.fromTensorflowAsync("test/models/tensorflow_inception_graph.pb"); + expect(model.isEmpty, false); + await checkTensorflowAsync(model); + }); + + test('cv.NetAsync.fromTensorflowBytesAsync', () async { + final bytes = await File("test/models/tensorflow_inception_graph.pb").readAsBytes(); + final model = await cv.NetAsync.fromTensorflowBytesAsync(bytes); + expect(model.isEmpty, false); + await checkTensorflowAsync(model); + }); + + test('cv.NetAsync.fromTFLiteAsync', skip: true, () async { + final model = await cv.NetAsync.fromTFLiteAsync("test/models/googlenet_float32.tflite"); + await checkTfliteAsync(model); + }); + + test('cv.NetAsync.fromTorchAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + final model = await cv.NetAsync.fromTorchAsync("test/models/openface.nn4.small2.v1.t7"); + expect(model.isEmpty, false); + + final blob = await cv.blobFromImageAsync( + img, + scalefactor: 1.0, + size: (224, 224), + mean: cv.Scalar.all(0), + swapRB: false, + crop: false, + ); + expect(blob.isEmpty, false); + }); + + test('cv.blobFromImagesAsync, cv.imagesFromBlobAsync, cv.getBlobChannelAsync', () async { + final imgs = [ + await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR), + await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR), + ].cvd; + + final blob = await cv.blobFromImagesAsync(imgs); + expect(blob.isEmpty, false); + expect(await cv.getBlobSizeAsync(blob), cv.Scalar(2, 3, 480, 512)); + + final images = await cv.imagesFromBlobAsync(blob); + expect(images.length, 2); + expect((images.first.rows, images.first.cols), (imgs.first.rows, imgs.first.cols)); + expect((images.last.rows, images.last.cols), (imgs.last.rows, imgs.last.cols)); + + final ch2 = await cv.getBlobChannelAsync(blob, 0, 1); + expect(ch2.isEmpty, false); + expect((ch2.rows, ch2.cols), (imgs.first.rows, imgs.first.cols)); + }); + + test('cv.blobFromImagesAsync GrayScale', () async { + final imgs = [ + await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_GRAYSCALE), + await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_GRAYSCALE), + ].cvd; + + final blob = await cv.blobFromImagesAsync(imgs); + expect(blob.isEmpty, false); + expect(await cv.getBlobSizeAsync(blob), cv.Scalar(2, 1, 480, 512)); + }); + + test('cv.NMSBoxesAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + //TODO: Migrate to async + img.convertTo(cv.MatType.CV_32FC1); + + final bboxes = [ + cv.Rect(53, 47, 589, 451), + cv.Rect(118, 54, 618, 450), + cv.Rect(53, 66, 605, 480), + cv.Rect(111, 65, 630, 480), + cv.Rect(156, 51, 640, 480), + ].cvd; + final scores = [0.82094115, 0.7998236, 0.9809663, 0.99717456, 0.89628726].f32; + final indices = await cv.NMSBoxesAsync(bboxes, scores, 0.5, 0.4); + expect(indices.first, 3); + }); +} diff --git a/test/dnn_test.dart b/test/dnn/dnn_test.dart similarity index 100% rename from test/dnn_test.dart rename to test/dnn/dnn_test.dart diff --git a/test/features2d/features2d_async_test.dart b/test/features2d/features2d_async_test.dart new file mode 100644 index 00000000..54bb750a --- /dev/null +++ b/test/features2d/features2d_async_test.dart @@ -0,0 +1,356 @@ +import 'package:opencv_dart/opencv_dart.dart' as cv; +import 'package:test/test.dart'; + +void main() async { + test('cv.AKAZEAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + + final ak = await cv.AKAZEAsync.emptyAsync(); + final kp = await ak.detectAsync(img); + expect(kp.length, greaterThan(512)); + + final mask = cv.Mat.empty(); + final (kp2, desc) = await ak.detectAndComputeAsync(img, mask); + expect(kp2.length, greaterThan(512)); + expect(desc.isEmpty, false); + + ak.dispose(); + }); + + test('cv.AgastFeatureDetectorAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + + final ad = await cv.AgastFeatureDetectorAsync.emptyAsync(); + final kp = await ad.detectAsync(img); + expect(kp.length, greaterThan(2800)); + + ad.dispose(); + }); + + test('cv.BRISKAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + + final br = await cv.BRISKAsync.emptyAsync(); + final kp = await br.detectAsync(img); + expect(kp.length, greaterThan(512)); + + final mask = cv.Mat.empty(); + final (kp2, desc) = await br.detectAndComputeAsync(img, mask); + expect(kp2.length, greaterThan(512)); + expect(desc.isEmpty, false); + + br.dispose(); + }); + + test('cv.FastFeatureDetectorAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + + final fd = await cv.FastFeatureDetectorAsync.emptyAsync(); + final kp = await fd.detectAsync(img); + expect(kp.length, greaterThan(2690)); + + final fd1 = await cv.FastFeatureDetectorAsync.createAsync(); + final kp1 = await fd1.detectAsync(img); + expect(kp1.length, greaterThan(2690)); + + fd.dispose(); + }); + + test('cv.GFTTDetectorAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + + final gf = await cv.GFTTDetectorAsync.emptyAsync(); + final kp = await gf.detectAsync(img); + expect(kp.length, greaterThan(512)); + + gf.dispose(); + }); + + test('cv.KAZEAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + + final ka = await cv.KAZEAsync.emptyAsync(); + final kp = await ka.detectAsync(img); + expect(kp.length, greaterThan(0)); + + final mask = cv.Mat.empty(); + final (kp2, desc) = await ka.detectAndComputeAsync(img, mask); + expect(kp2.length, greaterThan(0)); + expect(desc.isEmpty, false); + + ka.dispose(); + }); + + test('cv.MSERAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + + final gf = await cv.MSERAsync.emptyAsync(); + final kp = await gf.detectAsync(img); + expect(kp.length, greaterThan(0)); + + gf.dispose(); + }); + + test('cv.ORBAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + + final ka = await cv.ORBAsync.emptyAsync(); + final kp = await ka.detectAsync(img); + expect(kp.length, 500); + + final orb = await cv.ORBAsync.createAsync(); + final kp1 = await orb.detectAsync(img); + expect(kp1.length, 500); + + final mask = cv.Mat.empty(); + final (kp2, desc) = await ka.detectAndComputeAsync(img, mask); + expect(kp2.length, 500); + expect(desc.isEmpty, false); + + orb.dispose(); + }); + + test('cv.SimpleBlobDetectorAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + + final detector = await cv.SimpleBlobDetectorAsync.emptyAsync(); + final kp = await detector.detectAsync(img); + expect(kp.length, 1); + + final params = cv.SimpleBlobDetectorParams( + blobColor: 200, + filterByArea: false, + filterByCircularity: true, + filterByConvexity: false, + filterByInertia: false, + filterByColor: false, + maxArea: 1000, + maxInertiaRatio: 0.97, + maxThreshold: 241, + maxCircularity: 0.99, + maxConvexity: 0.98, + minArea: 230, + minCircularity: 0.9, + minConvexity: 0.89, + minDistBetweenBlobs: 15.5, + minInertiaRatio: 0.8, + minRepeatability: 5, + minThreshold: 200, + thresholdStep: 2.0, + ); + + final params1 = cv.SimpleBlobDetectorParams.fromNative(params.ref); + expect(params1, params); + + expect(params.blobColor, 200); + params.blobColor = 201; + final blobColor = params.blobColor; + expect(blobColor, 201); + + expect(params.filterByArea, false); + params.filterByArea = true; + final filterByArea = params.filterByArea; + expect(filterByArea, true); + + expect(params.filterByCircularity, true); + params.filterByCircularity = false; + final filterByCircularity = params.filterByCircularity; + expect(filterByCircularity, false); + + expect(params.filterByColor, false); + params.filterByColor = true; + final filterByColor = params.filterByColor; + expect(filterByColor, true); + + expect(params.filterByConvexity, false); + params.filterByConvexity = true; + final filterByConvexity = params.filterByConvexity; + expect(filterByConvexity, true); + + expect(params.filterByInertia, false); + params.filterByInertia = true; + final filterByInertia = params.filterByInertia; + expect(filterByInertia, true); + + expect(params.maxArea, 1000); + params.maxArea = 2000; + final maxArea = params.maxArea; + expect(maxArea, 2000); + + expect(params.maxCircularity, closeTo(0.99, 1e-4)); + params.maxCircularity = 0.98; + final maxCircularity = params.maxCircularity; + expect(maxCircularity, closeTo(0.98, 1e-4)); + + expect(params.maxConvexity, closeTo(0.98, 1e-4)); + params.maxConvexity = 0.99; + final maxConvexity = params.maxConvexity; + expect(maxConvexity, closeTo(0.99, 1e-4)); + + expect(params.maxInertiaRatio, closeTo(0.97, 1e-4)); + params.maxInertiaRatio = 0.99; + final maxInertiaRatio = params.maxInertiaRatio; + expect(maxInertiaRatio, closeTo(0.99, 1e-4)); + + expect(params.maxThreshold, 241); + params.maxThreshold = 255; + final maxThreshold = params.maxThreshold; + expect(maxThreshold, 255); + + expect(params.minArea, 230); + params.minArea = 10; + final minArea = params.minArea; + expect(minArea, 10); + + expect(params.minCircularity, closeTo(0.9, 1e-4)); + params.minCircularity = 0.8; + final minCircularity = params.minCircularity; + expect(minCircularity, closeTo(0.8, 1e-4)); + + expect(params.minConvexity, closeTo(0.89, 1e-4)); + params.minConvexity = 0.8; + final minConvexity = params.minConvexity; + expect(minConvexity, closeTo(0.8, 1e-4)); + + expect(params.minDistBetweenBlobs, closeTo(15.5, 1e-4)); + params.minDistBetweenBlobs = 10; + final minDistBetweenBlobs = params.minDistBetweenBlobs; + expect(minDistBetweenBlobs, closeTo(10, 1e-4)); + + expect(params.minInertiaRatio, closeTo(0.8, 1e-4)); + params.minInertiaRatio = 0.7; + final minInertiaRatio = params.minInertiaRatio; + expect(minInertiaRatio, closeTo(0.7, 1e-4)); + + expect(params.minRepeatability, 5); + params.minRepeatability = 10; + final minRepeatability = params.minRepeatability; + expect(minRepeatability, 10); + + expect(params.minThreshold, 200); + params.minThreshold = 100; + final minThreshold = params.minThreshold; + expect(minThreshold, 100); + + expect(params.thresholdStep, closeTo(2.0, 1e-4)); + params.thresholdStep = 1.0; + final thresholdStep = params.thresholdStep; + expect(thresholdStep, closeTo(1.0, 1e-4)); + + final detector1 = await cv.SimpleBlobDetectorAsync.createAsync(params); + final kp1 = await detector1.detectAsync(img); + expect(kp1.length, 0); + + detector1.dispose(); + params.dispose(); + }); + + test('cv.BFMatcherAsync', () async { + final desc1 = await cv.imreadAsync( + "test/images/sift_descriptor.png", + flags: cv.IMREAD_GRAYSCALE, + ); + expect(desc1.isEmpty, false); + final desc2 = await cv.imreadAsync( + "test/images/sift_descriptor.png", + flags: cv.IMREAD_GRAYSCALE, + ); + expect(desc2.isEmpty, false); + + final matcher = await cv.BFMatcherAsync.emptyAsync(); + final dmatches = await matcher.knnMatchAsync(desc1, desc2, 2); + expect(dmatches.length, greaterThan(0)); + + final matcher1 = await cv.BFMatcherAsync.createAsync(); + final dmatches1 = await matcher1.knnMatchAsync(desc1, desc2, 2); + expect(dmatches1.length, greaterThan(0)); + + final matches = await matcher.matchAsync(desc1, desc2); + expect(matches.length, greaterThan(0)); + + matcher.dispose(); + }); + + test('cv.FlannBasedMatcherAsync', () async { + final desc1 = await cv.imreadAsync( + "test/images/sift_descriptor.png", + flags: cv.IMREAD_GRAYSCALE, + ); + expect(desc1.isEmpty, false); + final desc2 = await cv.imreadAsync( + "test/images/sift_descriptor.png", + flags: cv.IMREAD_GRAYSCALE, + ); + expect(desc2.isEmpty, false); + + final desc11 = desc1.convertTo(cv.MatType.CV_32FC1); + final desc21 = desc2.convertTo(cv.MatType.CV_32FC1); + + final matcher = await cv.FlannBasedMatcherAsync.emptyAsync(); + final dmatches = await matcher.knnMatchAsync(desc11, desc21, 2); + expect(dmatches.length, greaterThan(0)); + + matcher.dispose(); + }); + + test('cv.SIFTAsync', () async { + final img = await cv.imreadAsync( + "test/images/lenna.png", + flags: cv.IMREAD_GRAYSCALE, + ); + expect(img.isEmpty, false); + + final si = await cv.SIFTAsync.emptyAsync(); + final kp = await si.detectAsync(img); + expect(kp.length, greaterThan(0)); + + final mask = cv.Mat.empty(); + final (kp2, desc) = await si.detectAndComputeAsync(img, mask); + expect(kp2.length, greaterThan(0)); + expect(desc.isEmpty, false); + + si.dispose(); + }); + + test('cv.drawMatchesAsync', () async { + final query = await cv.imreadAsync("test/images/box.png", flags: cv.IMREAD_GRAYSCALE); + final train = await cv.imreadAsync( + "test/images/box_in_scene.png", + flags: cv.IMREAD_GRAYSCALE, + ); + expect(query.isEmpty, false); + expect(train.isEmpty, false); + + final m1 = cv.Mat.empty(), m2 = cv.Mat.empty(); + final (kp1, des1) = await (await cv.SIFTAsync.emptyAsync()).detectAndComputeAsync(query, m1); + final (kp2, des2) = await (await cv.SIFTAsync.emptyAsync()).detectAndComputeAsync(train, m2); + + final bf = await cv.BFMatcherAsync.emptyAsync(); + final dmatches = await bf.knnMatchAsync(des1, des2, 2); + expect(dmatches.length, greaterThan(0)); + + final out = cv.Mat.empty(); + await cv.drawMatchesAsync( + query, + kp1, + train, + kp2, + dmatches.first, + out, + matchColor: cv.Scalar.red, + singlePointColor: cv.Scalar.green, + ); + expect(out.cols, query.cols + train.cols); + + bf.dispose(); + }); +} diff --git a/test/features2d_test.dart b/test/features2d/features2d_test.dart similarity index 100% rename from test/features2d_test.dart rename to test/features2d/features2d_test.dart diff --git a/test/gapi/structs_test.dart b/test/gapi/structs_test.dart new file mode 100644 index 00000000..3f101e04 --- /dev/null +++ b/test/gapi/structs_test.dart @@ -0,0 +1,50 @@ +import 'package:opencv_dart/opencv_dart.dart' as cv; +import 'package:opencv_dart/opencv_gapi.dart' as cv_gapi; +import 'package:test/test.dart'; + +void main() { + test("cv.GMat", () { + { + final m = cv_gapi.GMat.empty(); + expect(m.ptr.address, isNonZero); + } + + { + final m = cv.Mat.zeros(10, 10, cv.MatType.CV_8UC1); + final gm = cv_gapi.GMat.fromMat(m); + expect(gm.ptr.address, isNonZero); + } + }); + + test("cv.GScalar", () { + { + final m = cv_gapi.GScalar.empty(); + expect(m.ptr.address, isNonZero); + } + + { + final s = cv.Scalar(2, 5, 4, 1); + final gs = cv_gapi.GScalar.fromScalar(s); + expect(gs.ptr.address, isNonZero); + } + + { + final gs = cv_gapi.GScalar(2541); + expect(gs.ptr.address, isNonZero); + } + }); + + test("cv.GComputation", () async { + { + final gmIn = cv_gapi.GMat.empty(); + final gmOut = cv_gapi.addMat(gmIn, gmIn); + final gmOut1 = cv_gapi.addC(gmOut, cv_gapi.GScalar(21)); + final computation = cv_gapi.GComputation.mimo(gmIn, gmOut1); + + final inMat = cv.Mat.ones(10, 10, cv.MatType.CV_8UC1).setTo(cv.Scalar(21, 21, 21, 21)); + final outMat = await computation.apply(inMat); + expect(outMat.at(0, 1), 63); + expect(computation.ptr.address, isNonZero); + } + }); +} diff --git a/test/imgcodecs_test.dart b/test/imgcodecs_test.dart index b6fd8bd8..ca3ac398 100644 --- a/test/imgcodecs_test.dart +++ b/test/imgcodecs_test.dart @@ -4,13 +4,23 @@ import 'package:opencv_dart/opencv_dart.dart' as cv; import 'package:test/test.dart'; void main() async { - test("cv2.imread, cv2.imwrite", () { - final cvImage = cv.imread("test/images/circles.jpg", flags: cv.IMREAD_COLOR); - expect((cvImage.width, cvImage.height), (512, 512)); - expect(cv.imwrite("test/images_out/test_imwrite.png", cvImage), true); - final params = [cv.IMWRITE_PNG_COMPRESSION, 9].i32; - final res = cv.imwrite("test/images_out/test_imwrite.png", cvImage, params: params); - expect(res, true); + test("cv2.imread, cv2.imwrite", () async { + { + final cvImage = cv.imread("test/images/circles.jpg", flags: cv.IMREAD_COLOR); + expect((cvImage.width, cvImage.height), (512, 512)); + expect(cv.imwrite("test/images_out/test_imwrite.png", cvImage), true); + final params = [cv.IMWRITE_PNG_COMPRESSION, 9].i32; + final res = cv.imwrite("test/images_out/test_imwrite.png", cvImage, params: params); + expect(res, true); + } + { + final cvImage = await cv.imreadAsync("test/images/circles.jpg", flags: cv.IMREAD_COLOR); + expect((cvImage.width, cvImage.height), (512, 512)); + expect(await cv.imwriteAsync("test/images_out/test_imwrite.png", cvImage), true); + final params = [cv.IMWRITE_PNG_COMPRESSION, 9].i32; + final res = await cv.imwriteAsync("test/images_out/test_imwrite.png", cvImage, params: params); + expect(res, true); + } }); test("cv2.imencode, cv2.imdecode", () async { @@ -33,4 +43,22 @@ void main() async { expect(dst.isEmpty, false); expect((dst.rows, dst.cols, dst.channels), (cvImage.rows, cvImage.cols, cvImage.channels)); }); + test("cv2.imencodeAsync, cv2.imdecodeAsync", () async { + final cvImage = await cv.imreadAsync("test/images/circles.jpg", flags: cv.IMREAD_COLOR); + expect((cvImage.width, cvImage.height), (512, 512)); + final (success, buf) = await cv.imencodeAsync(".png", cvImage); + expect(success, true); + expect(buf.length, greaterThan(0)); + + await File("test/images_out/test_imencode.png").writeAsBytes(buf); + final params = [cv.IMWRITE_PNG_COMPRESSION, 9].i32; + final (success1, buf1) = await cv.imencodeAsync(".png", cvImage, params: params); + expect(success1, true); + expect(buf1.length, greaterThan(0)); + + final cvimgDecode = await cv.imdecodeAsync(buf, cv.IMREAD_COLOR); + expect(cvimgDecode.height, equals(cvImage.height)); + expect(cvimgDecode.width, equals(cvImage.width)); + expect(cvimgDecode.channels, equals(cvImage.channels)); + }); } diff --git a/test/imgproc/clahe_test.dart b/test/imgproc/clahe_test.dart index af27fdfa..08a7165a 100644 --- a/test/imgproc/clahe_test.dart +++ b/test/imgproc/clahe_test.dart @@ -2,15 +2,23 @@ import 'package:opencv_dart/opencv_dart.dart' as cv; import 'package:test/test.dart'; void main() { - test("cv.CLAHE", () { + test("cv.CLAHE", () async { final mat = cv.imread("test/images/circles.jpg", flags: cv.IMREAD_GRAYSCALE); - final clahe = cv.CLAHE(); - final dst = clahe.apply(mat); - expect(dst.isEmpty, false); + final clahe = cv.CLAHE.create(); + { + final dst = clahe.apply(mat); + expect(dst.isEmpty, false); + } + + { + final clahe = await cv.CLAHEAsync.createAsync(); + final dst = await clahe.applyAsync(mat); + expect(dst.isEmpty, false); + } clahe.clipLimit = 50; - clahe.tilesGridSize = (10, 10); - expect(clahe.tilesGridSize, (10, 10)); + clahe.tilesGridSize = (10, 10).cvd; + expect(clahe.tilesGridSize, cv.Size(10, 10)); expect(clahe.clipLimit, closeTo(50, 1e-6)); clahe.dispose(); diff --git a/test/imgproc/imgproc_async_test.dart b/test/imgproc/imgproc_async_test.dart new file mode 100644 index 00000000..05d96b55 --- /dev/null +++ b/test/imgproc/imgproc_async_test.dart @@ -0,0 +1,948 @@ +import 'package:opencv_dart/opencv_dart.dart' as cv; +import 'package:test/test.dart'; + +void main() async { + test("cv.approxPolyDPAsync, cv.arcLengthAsync", () async { + final img = cv.Mat.create(cols: 100, rows: 200, type: cv.MatType.CV_8UC1); + final color = cv.Scalar.all(255); + cv.line( + img, + cv.Point(25, 25), + cv.Point(25, 75), + color, + ); + cv.line( + img, + cv.Point(25, 75), + cv.Point(75, 50), + color, + ); + cv.line( + img, + cv.Point(75, 50), + cv.Point(25, 25), + color, + ); + await cv.rectangleAsync(img, cv.Rect(125, 25, 175, 75), color); + + final (contours, _) = await cv.findContoursAsync( + img, + cv.RETR_EXTERNAL, + cv.CHAIN_APPROX_SIMPLE, + ); + final length = await cv.arcLengthAsync(contours.first, true); + final triangleContour = await cv.approxPolyDPAsync(contours.first, 0.04 * length, true); + final expected = [cv.Point(25, 25), cv.Point(25, 75), cv.Point(75, 50)]; + expect(triangleContour.length, equals(expected.length)); + expect(triangleContour.toList(), expected); + }); + + test('cv.convexHullAsync, cv.convexityDefectsAsync', () async { + final img = await cv.imreadAsync("test/images/face-detect.jpg", flags: cv.IMREAD_GRAYSCALE); + expect(img.isEmpty, false); + final (contours, hierarchy) = await cv.findContoursAsync(img, cv.RETR_EXTERNAL, cv.CHAIN_APPROX_SIMPLE); + expect(contours.length, greaterThan(0)); + expect(hierarchy.isEmpty, false); + + final area = await cv.contourAreaAsync(contours.first); + expect(area, closeTo(127280.0, 1e-4)); + + final hull = await cv.convexHullAsync(contours.first, clockwise: true, returnPoints: false); + expect(hull.isEmpty, false); + + final defects = await cv.convexityDefectsAsync(contours.first, hull); + expect(defects.isEmpty, false); + }); + + test('cv.calcBackProjectAsync', () async { + final img = await cv.imreadAsync("test/images/face-detect.jpg", flags: cv.IMREAD_GRAYSCALE); + expect(img.isEmpty, false); + + final mask = cv.Mat.empty(); + final hist = await cv.calcHistAsync([img].cvd, [0].i32, mask, [256].i32, [0.0, 256.0].f32); + final backProject = await cv.calcBackProjectAsync([img].cvd, [0].i32, hist, [0.0, 256.0].f32); + expect(backProject.isEmpty, false); + }); + + test('cv.compareHistAsync', () async { + final img = await cv.imreadAsync("test/images/face-detect.jpg", flags: cv.IMREAD_GRAYSCALE); + expect(img.isEmpty, false); + + final mask = cv.Mat.empty(); + final hist1 = await cv.calcHistAsync([img].cvd, [0].i32, mask, [256].i32, [0.0, 256.0].f32); + final hist2 = await cv.calcHistAsync([img].cvd, [0].i32, mask, [256].i32, [0.0, 256.0].f32); + final dist = await cv.compareHistAsync(hist1, hist2, method: cv.HISTCMP_CORREL); + expect(dist, closeTo(1.0, 1e-4)); + }); + + test('cv.clipLineAsync', () async { + final (result, _, _) = await cv.clipLineAsync(cv.Rect(0, 0, 100, 100), cv.Point(5, 5), cv.Point(5, 5)); + expect(result, true); + }); + + test('cv.bilateralFilterAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_GRAYSCALE); + expect(img.isEmpty, false); + + final dst = await cv.bilateralFilterAsync(img, 1, 2.0, 3.0); + expect(dst.isEmpty || dst.rows != img.rows || dst.cols != img.cols, false); + }); + + test('cv.blurAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_GRAYSCALE); + expect(img.isEmpty, false); + + final dst = await cv.blurAsync(img, (3, 3)); + expect(dst.isEmpty || dst.rows != img.rows || dst.cols != img.cols, false); + }); + + test('cv.boxFilterAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_GRAYSCALE); + expect(img.isEmpty, false); + + final dst = await cv.boxFilterAsync(img, -1, (3, 3)); + expect(dst.isEmpty || dst.rows != img.rows || dst.cols != img.cols, false); + }); + + test('cv.sqrBoxFilterAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_GRAYSCALE); + expect(img.isEmpty, false); + + final dst = await cv.sqrBoxFilterAsync(img, -1, (3, 3)); + expect(dst.isEmpty || dst.rows != img.rows || dst.cols != img.cols, false); + }); + + test("cv.findContoursAsync, cv.drawContoursAsync", () async { + final src = await cv.imreadAsync("test/images/markers_6x6_250.png", flags: cv.IMREAD_GRAYSCALE); + expect((src.width, src.height, src.channels), (612, 760, 1)); + cv.bitwiseNOT(src, dst: src); + expect((src.width, src.height, src.channels), (612, 760, 1)); + final (contours, hierarchy) = await cv.findContoursAsync( + src, + cv.RETR_EXTERNAL, + cv.CHAIN_APPROX_SIMPLE, + ); + expect(contours.length, greaterThan(0)); + expect(hierarchy.isEmpty, equals(false)); + expect( + List.generate(contours.length, (index) => contours.elementAt(index).length) + .every((element) => element == 4), + equals(true), + ); + + // draw + final canvas = await cv.cvtColorAsync(src, cv.COLOR_GRAY2BGR); + await cv.drawContoursAsync(canvas, contours, -1, cv.Scalar.red, thickness: 2); + final success = await cv.imwriteAsync("test/images_out/markers_6x6_250_contours.png", canvas); + expect(success, equals(true)); + + // trigger GC + // contours = null; + // int size = 100000; + // List list = []; + // for (int i = 0; i < size; i++) { + // list.add("AAAAAAAAA_" + i.toString()); + // } + }); + + test("cv.cvtColorAsync", () async { + final cvImage = await cv.imreadAsync("test/images/circles.jpg", flags: cv.IMREAD_COLOR); + final gray = await cv.cvtColorAsync(cvImage, cv.COLOR_BGR2GRAY); + expect((gray.width, gray.height, gray.channels), (512, 512, 1)); + expect(await cv.imwriteAsync("test/images_out/test_cvtcolor.png", gray), true); + }); + + test("cv.equalizeHistAsync", () async { + final cvImage = await cv.imreadAsync("test/images/circles.jpg", flags: cv.IMREAD_GRAYSCALE); + expect((cvImage.width, cvImage.height), (512, 512)); + final imgNew = await cv.equalizeHistAsync(cvImage); + expect( + (cvImage.width, cvImage.height, cvImage.channels), + (imgNew.width, imgNew.height, imgNew.channels), + ); + expect(await cv.imwriteAsync("test/images_out/circles_equalized.jpg", imgNew), equals(true)); + }); + + test("cv.calcHistAsync", () async { + final src = await cv.imreadAsync("test/images/circles.jpg", flags: cv.IMREAD_GRAYSCALE); + final mask = cv.Mat.empty(); + final hist = await cv.calcHistAsync([src].cvd, [0].i32, mask, [256].i32, [0.0, 256.0].f32); + expect(hist.height == 256 && hist.width == 1 && !hist.isEmpty, equals(true)); + }); + + test('cv.erodeAsync', () async { + final src = await cv.imreadAsync("test/images/circles.jpg", flags: cv.IMREAD_GRAYSCALE); + final kernel = await cv.getStructuringElementAsync( + cv.MORPH_RECT, + (3, 3), + ); + final dst = await cv.erodeAsync(src, kernel); + expect((dst.width, dst.height, dst.channels), (src.width, src.height, src.channels)); + }); + + test('cv.dilateAsync', () async { + final src = await cv.imreadAsync("test/images/circles.jpg", flags: cv.IMREAD_GRAYSCALE); + final kernel = await cv.getStructuringElementAsync( + cv.MORPH_RECT, + (3, 3), + ); + final dst = await cv.dilateAsync(src, kernel); + expect((dst.width, dst.height, dst.channels), (src.width, src.height, src.channels)); + }); + + // cv.contourAreaAsync + test('cv.contourAreaAsync', () async { + final contour = [ + cv.Point(0, 0), + cv.Point(100, 0), + cv.Point(100, 100), + cv.Point(0, 100), + ].cvd; + expect(await cv.contourAreaAsync(contour), equals(10000)); + }); + + test('cv.getStructuringElementAsync', () async { + final kernel = await cv.getStructuringElementAsync( + cv.MORPH_RECT, + (3, 3), + ); + expect(kernel.height == 3 && kernel.width == 3 && !kernel.isEmpty, equals(true)); + }); + + test('basic drawings Async', () async { + final src = cv.Mat.create(cols: 100, rows: 100, type: cv.MatType.CV_8UC3); + cv.line( + src, + cv.Point(10, 10), + cv.Point(90, 90), + cv.Scalar.red, + thickness: 2, + lineType: cv.LINE_AA, + ); + await cv.ellipseAsync(src, cv.Point(50, 50), cv.Point(10, 20), 30.0, 0, 360, cv.Scalar.green); + await cv.rectangleAsync(src, cv.Rect(20, 20, 30, 50), cv.Scalar.blue); + final pts = [(10, 5), (20, 30), (70, 20), (50, 10)].map((e) => cv.Point(e.$1, e.$2)).toList(); + await cv.polylinesAsync(src, [pts].cvd, false, cv.Scalar.white, thickness: 2, lineType: cv.LINE_AA); + await cv.putTextAsync(src, "OpenCv-Dart", cv.Point(1, 90), cv.FONT_HERSHEY_SIMPLEX, 0.4, cv.Scalar.white); + await cv.arrowedLineAsync(src, cv.Point(5, 0), cv.Point(5, 10), cv.Scalar.blue); + await cv.circleAsync(src, cv.Point(50, 50), 10, cv.Scalar.red); + expect((src.width, src.height, src.channels), (100, 100, 3)); + + await cv.fillPolyAsync( + src, + [ + [cv.Point(10, 10), cv.Point(10, 30), cv.Point(30, 30)], + ].cvd, + cv.Scalar.green, + ); + + await cv.imwriteAsync("test/images_out/basic_drawings.png", src); + }); + + test('cv.thresholdAsync', () async { + final src = await cv.imreadAsync("test/images/circles.jpg", flags: cv.IMREAD_COLOR); + final (_, dst) = await cv.thresholdAsync(src, 100, 255, cv.THRESH_BINARY); + expect((dst.width, dst.height, dst.channels), (src.width, src.height, src.channels)); + }); + + test('cv.distanceTransformAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + + final gray = await cv.cvtColorAsync(img, cv.COLOR_BGR2GRAY); + + final (_, thres) = await cv.thresholdAsync(gray, 25, 255, cv.THRESH_BINARY); + + final (dest, labels) = + await cv.distanceTransformAsync(thres, cv.DIST_L2, cv.DIST_MASK_3, cv.DIST_LABEL_CCOMP); + expect(dest.isEmpty || dest.rows != img.rows || dest.cols != img.cols, false); + expect(labels.isEmpty, false); + }); + + test('cv.boundingRectAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_GRAYSCALE); + expect(img.isEmpty, false); + + final (contours, _) = await cv.findContoursAsync(img, cv.RETR_EXTERNAL, cv.CHAIN_APPROX_SIMPLE); + final r = await cv.boundingRectAsync(contours.first); + expect(r.width > 0 && r.height > 0, true); + }); + + test('cv.boxPointsAsync, cv.minAreaRectAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_GRAYSCALE); + expect(img.isEmpty, false); + + final (_, thresImg) = await cv.thresholdAsync(img, 25, 255, cv.THRESH_BINARY); + final (contours, _) = await cv.findContoursAsync(thresImg, cv.RETR_EXTERNAL, cv.CHAIN_APPROX_SIMPLE); + + final rect = await cv.minAreaRectAsync(contours.first); + expect(rect.size.width > 0 && rect.points.isNotEmpty, true); + + final pts = await cv.boxPointsAsync(rect); + expect(pts.length, 4); + }); + + // fitEllipse + test('cv.fitEllipseAsync', () async { + final pv = [ + cv.Point(1, 1), + cv.Point(0, 1), + cv.Point(0, 2), + cv.Point(1, 3), + cv.Point(2, 3), + cv.Point(4, 2), + cv.Point(4, 1), + cv.Point(0, 3), + cv.Point(0, 2), + ].cvd; + final rect = await cv.fitEllipseAsync(pv); + expect(rect.center.x, closeTo(1.92, 0.1)); + expect(rect.center.y, closeTo(1.78, 0.1)); + expect(rect.angle, closeTo(78.60807800292969, 1e-4)); + }); + + // minEnclosingCircle + test('cv.minEnclosingCircleAsync', () async { + final pts = [ + cv.Point(0, 2), + cv.Point(2, 0), + cv.Point(0, -2), + cv.Point(-2, 0), + cv.Point(1, -1), + ].cvd; + + final (center, radius) = await cv.minEnclosingCircleAsync(pts); + expect(radius, closeTo(2.0, 1e-3)); + expect(center.x, closeTo(0.0, 1e-3)); + expect(center.y, closeTo(0.0, 1e-3)); + }); + + // pointPolygonTest + test('cv.pointPolygonTestAsync', () async { + final tests = [ + ("Inside the polygon - measure=false", 1, cv.Point2f(20, 30), 1.0, false), + ("Outside the polygon - measure=false", 1, cv.Point2f(5, 15), -1.0, false), + ("On the polygon - measure=false", 1, cv.Point2f(10, 10), 0.0, false), + ("Inside the polygon - measure=true", 1, cv.Point2f(20, 20), 10.0, true), + ("Outside the polygon - measure=true", 1, cv.Point2f(5, 15), -5.0, true), + ("On the polygon - measure=true", 1, cv.Point2f(10, 10), 0.0, true), + ]; + final pts = [ + cv.Point(10, 10), + cv.Point(10, 80), + cv.Point(80, 80), + cv.Point(80, 10), + ]; + for (final t in tests) { + final r = await cv.pointPolygonTestAsync(pts.cvd, t.$3, t.$5); + expect(r, closeTo(t.$4, 1e-3)); + } + }); + + // connectedComponents + test('cv.connectedComponentsAsync', () async { + final src = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_GRAYSCALE); + final (res, dst) = await cv.connectedComponentsAsync(src, 8, cv.MatType.CV_32SC1.value, cv.CCL_DEFAULT); + expect(dst.isEmpty, false); + expect(res, greaterThan(1)); + }); + + // connectedComponentsWithStats + test('cv.connectedComponentsWithStatsAsync', () async { + final src = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_GRAYSCALE); + final (res, dst, stats, centroids) = await cv.connectedComponentsWithStatsAsync( + src, + 8, + cv.MatType.CV_32SC1.value, + cv.CCL_DEFAULT, + ); + expect(dst.isEmpty || stats.isEmpty || centroids.isEmpty, false); + expect(res, greaterThan(1)); + }); + + // matchTemplate + test('cv.matchTemplateAsync', () async { + final imgScene = await cv.imreadAsync("test/images/face.jpg", flags: cv.IMREAD_GRAYSCALE); + expect(imgScene.isEmpty, false); + + final imgTemplate = await cv.imreadAsync("test/images/toy.jpg", flags: cv.IMREAD_GRAYSCALE); + expect(imgTemplate.isEmpty, false); + + final result = await cv.matchTemplateAsync(imgScene, imgTemplate, cv.TM_CCOEFF_NORMED); + final (_, maxConfidence, _, _) = cv.minMaxLoc(result); + expect(maxConfidence, greaterThan(0.95)); + }); + + // moments + test('cv.momentsAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_GRAYSCALE); + expect(img.isEmpty, false); + final m = await cv.momentsAsync(img); + expect(m.m00, greaterThan(0)); + final m1 = await cv.momentsAsync(img); + expect(m, m1); + + m1.dispose(); + }); + + // test pyrDown + test('cv.pyrDownAsync, cv.pyrUpAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + + final dst = await cv.pyrDownAsync(img, borderType: cv.BORDER_DEFAULT); + expect(dst.isEmpty, false); + + final dst1 = await cv.pyrUpAsync(dst, borderType: cv.BORDER_DEFAULT); + expect(dst1.isEmpty, false); + }); + + test('cv.morphologyDefaultBorderValueAsync', () async { + final value = await cv.morphologyDefaultBorderValueAsync(); + expect(value.val.length, 4); + }); + + // morphologyEx + test('cv.morphologyExAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + + final kernel = await cv.getStructuringElementAsync(cv.MORPH_RECT, (1, 1)); + final dst = await cv.morphologyExAsync(img, cv.MORPH_OPEN, kernel); + expect(dst.isEmpty || img.rows != dst.rows || img.cols != dst.cols, false); + }); + + // gaussianBlur + test('cv.gaussianBlurAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + + final dst = await cv.gaussianBlurAsync(img, (23, 23), 30, sigmaY: 30, borderType: cv.BORDER_CONSTANT); + expect(dst.isEmpty || img.rows != dst.rows || img.cols != dst.cols, false); + }); + + // getGaussianKernel + test('cv.getGaussianKernelAsync', () async { + final ketnel = await cv.getGaussianKernelAsync(1, 0.5); + expect(ketnel.isEmpty, false); + }); + + // sobel + test('cv.sobelAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + + final dst = await cv.sobelAsync(img, cv.MatType.CV_16S, 0, 1, borderType: cv.BORDER_DEFAULT); + expect(dst.isEmpty || img.rows != dst.rows || img.cols != dst.cols, false); + }); + + // spatialGradient + test('cv.spatialGradientAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_GRAYSCALE); + expect(img.isEmpty, false); + + final (dx, dy) = await cv.spatialGradientAsync(img, borderType: cv.BORDER_DEFAULT); + expect( + dx.isEmpty || + dy.isEmpty || + img.rows != dx.rows || + img.cols != dx.cols || + img.rows != dy.rows || + img.cols != dy.cols, + false, + ); + }); + + // Laplacian + test('cv.LaplacianAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + final dst = await cv.laplacianAsync(img, cv.MatType.CV_16S); + expect(dst.isEmpty || img.rows != dst.rows || img.cols != dst.cols, false); + }); + + // Scharr + test('cv.scharrAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + final dst = await cv.scharrAsync(img, cv.MatType.CV_16S, 1, 0); + expect(dst.isEmpty || img.rows != dst.rows || img.cols != dst.cols, false); + }); + + // medianBlur + test('cv.medianBlurAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + final dst = await cv.medianBlurAsync(img, 3); + expect(dst.isEmpty || img.rows != dst.rows || img.cols != dst.cols, false); + }); + + // Canny + test('cv.cannyAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_GRAYSCALE); + expect(img.isEmpty, false); + final dst = await cv.cannyAsync(img, 50, 150); + expect(dst.isEmpty || img.rows != dst.rows || img.cols != dst.cols, false); + }); + + // cornerSubPix + test('cv.goodFeaturesToTrackAsync, cv.cornerSubPixAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_GRAYSCALE); + expect(img.isEmpty, false); + final corners = await cv.goodFeaturesToTrackAsync(img, 500, 0.01, 10); + expect(corners.isEmpty, false); + expect(corners.length, 500); + + const tc = (cv.TERM_COUNT | cv.TERM_EPS, 20, 0.03); + final corners1 = await cv.cornerSubPixAsync(img, corners, (10, 10), (-1, -1), tc); + + expect(corners1.isEmpty, false); + expect(corners1.length, greaterThan(0)); + }); + + // grabCut + test('cv.grabCutAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + expect(img.type, cv.MatType.CV_8UC3); + + final mask = cv.Mat.zeros(img.rows, img.cols, cv.MatType.CV_8UC1); + final bgdModel = cv.Mat.empty(); + final fgdModel = cv.Mat.empty(); + final r = cv.Rect(0, 0, 50, 50); + await cv.grabCutAsync(img, mask, r, bgdModel, fgdModel, 1); + expect(bgdModel.isEmpty, false); + expect(fgdModel.isEmpty, false); + }); + + // HoughCircles + test('cv.HoughCirclesAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_GRAYSCALE); + expect(img.isEmpty, false); + + final circles = await cv.HoughCirclesAsync(img, cv.HOUGH_GRADIENT, 5.0, 5.0); + expect(circles.isEmpty, false); + expect((circles.rows, circles.cols), (1, 815)); + }); + + // HoughLines + test('cv.HoughLinesAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_GRAYSCALE); + expect(img.isEmpty, false); + + final circles = await cv.HoughLinesAsync(img, 1, cv.CV_PI / 180, 50); + expect(circles.isEmpty, false); + }); + + // HoughLinesP + test('cv.HoughLinesPAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_GRAYSCALE); + expect(img.isEmpty, false); + + final circles = await cv.HoughLinesPAsync(img, 1, cv.CV_PI / 180, 50); + expect(circles.isEmpty, false); + }); + + // HoughLinesPointSet + + // integral + test('cv.integralAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + + final (sum, sqSum, tilted) = await cv.integralAsync(img); + expect(sum.isEmpty || sqSum.isEmpty || tilted.isEmpty, false); + }); + + // adaptiveThreshold + test('cv.adaptiveThresholdAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_GRAYSCALE); + expect(img.isEmpty, false); + + final dst = await cv.adaptiveThresholdAsync(img, 255, cv.ADAPTIVE_THRESH_MEAN_C, cv.THRESH_BINARY, 11, 2); + expect(dst.isEmpty || img.rows != dst.rows || img.cols != dst.cols, false); + }); + + // getTextSize + test('cv.getTextSizeAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_GRAYSCALE); + expect(img.isEmpty, false); + + final (textSize, baseline) = await cv.getTextSizeAsync("Hello World", cv.FONT_HERSHEY_PLAIN, 1.0, 1); + expect((textSize.width, textSize.height, baseline), (91, 10, 6)); + }); + + // resize + test('cv.resizeAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + final dst = await cv.resizeAsync(img, (100, 100)); + expect(dst.isEmpty, false); + expect((dst.rows, dst.cols), (100, 100)); + }); + + // getRectSubPix + test('cv.getRectSubPixAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + final dst = await cv.getRectSubPixAsync(img, (100, 100), cv.Point2f(200, 200)); + expect(dst.isEmpty, false); + expect((dst.rows, dst.cols), (100, 100)); + }); + + // warpAffine + test('cv.getRotationMatrix2DAsync, cv.warpAffineAsync', () async { + final src = cv.Mat.zeros(256, 256, cv.MatType.CV_8UC1); + final rot = await cv.getRotationMatrix2DAsync(cv.Point2f(0, 0), 1.0, 1.0); + final dst = await cv.warpAffineAsync(src, rot, (256, 256)); + final res = cv.norm(dst, normType: cv.NORM_L2); + expect(res, closeTo(0.0, 1e-4)); + }); + + // warpPerspective + test('cv.warpPerspectiveAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_UNCHANGED); + expect(img.isEmpty, false); + final pvs = [ + cv.Point(0, 0), + cv.Point(10, 5), + cv.Point(10, 10), + cv.Point(5, 10), + ]; + + final pvd = [ + cv.Point(0, 0), + cv.Point(10, 0), + cv.Point(10, 10), + cv.Point(0, 10), + ]; + + final m = await cv.getPerspectiveTransformAsync(pvs.cvd, pvd.cvd); + final dst = await cv.warpPerspectiveAsync(img, m, (img.width, img.height)); + expect((dst.rows, dst.cols), (img.rows, img.cols)); + }); + + // watershed + test('cv.watershedAsync', () async { + final src = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_UNCHANGED); + expect(src.isEmpty, false); + + final gray = await cv.cvtColorAsync(src, cv.COLOR_BGR2GRAY); + expect(gray.isEmpty, false); + + final (_, imgThresh) = await cv.thresholdAsync(gray, 5, 50, cv.THRESH_OTSU + cv.THRESH_BINARY); + + final (_, markers) = + await cv.connectedComponentsAsync(imgThresh, 8, cv.MatType.CV_32SC1.value, cv.CCL_DEFAULT); + await cv.watershedAsync(src, markers); + expect(markers.isEmpty, false); + expect((markers.rows, markers.cols), (src.rows, src.cols)); + }); + + // applyColorMap + test('cv.applyColorMapAsync', () async { + final src = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_UNCHANGED); + final dst = await cv.applyColorMapAsync(src, cv.COLORMAP_AUTUMN); + expect((dst.rows, dst.cols), (src.rows, src.cols)); + }); + + // applyCustomColorMap + test('cv.applyCustomColorMapAsync', () async { + final src = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_GRAYSCALE); + final cmap = cv.Mat.zeros(256, 1, cv.MatType.CV_8UC1); + final dst = await cv.applyCustomColorMapAsync(src, cmap); + expect((dst.rows, dst.cols), (src.rows, src.cols)); + }); + + // getPerspectiveTransform + test('cv.getPerspectiveTransformAsync', () async { + final src = [ + cv.Point(0, 0), + cv.Point(10, 5), + cv.Point(10, 10), + cv.Point(5, 10), + ]; + final dst = [ + cv.Point(0, 0), + cv.Point(10, 0), + cv.Point(10, 10), + cv.Point(0, 10), + ]; + final m = await cv.getPerspectiveTransformAsync(src.cvd, dst.cvd); + expect((m.rows, m.cols), (3, 3)); + }); + + // getPerspectiveTransform2f + test('cv.getPerspectiveTransform2fAsync', () async { + final src = [ + cv.Point2f(0, 0), + cv.Point2f(10, 5), + cv.Point2f(10, 10), + cv.Point2f(5, 10), + ]; + final dst = [ + cv.Point2f(0, 0), + cv.Point2f(10, 0), + cv.Point2f(10, 10), + cv.Point2f(0, 10), + ]; + final m = await cv.getPerspectiveTransform2fAsync(src.cvd, dst.cvd); + expect((m.rows, m.cols), (3, 3)); + }); + + // getAffineTransform + test('cv.getAffineTransformAsync', () async { + final src = [ + cv.Point(0, 0), + cv.Point(10, 5), + cv.Point(10, 10), + ]; + + final dst = [ + cv.Point(0, 0), + cv.Point(10, 0), + cv.Point(10, 10), + ]; + final m = await cv.getAffineTransformAsync(src.cvd, dst.cvd); + expect((m.rows, m.cols), (2, 3)); + }); + + // getAffineTransform2f + test('cv.getAffineTransform2fAsync', () async { + final src = [ + cv.Point2f(0, 0), + cv.Point2f(10, 5), + cv.Point2f(10, 10), + ]; + + final dst = [ + cv.Point2f(0, 0), + cv.Point2f(10, 0), + cv.Point2f(10, 10), + ]; + final m = await cv.getAffineTransform2fAsync(src.cvd, dst.cvd); + expect((m.rows, m.cols), (2, 3)); + }); + + // findHomography + test('cv.findHomographyAsync', () async { + final src = cv.Mat.zeros(4, 1, cv.MatType.CV_64FC2); + final dst = cv.Mat.zeros(4, 1, cv.MatType.CV_64FC2); + final srcPts = [ + cv.Point2f(193, 932), + cv.Point2f(191, 378), + cv.Point2f(1497, 183), + cv.Point2f(1889, 681), + ]; + final dstPts = [ + cv.Point2f(51.51206544281359, -0.10425475260813055), + cv.Point2f(51.51211051314331, -0.10437947532732306), + cv.Point2f(51.512222354139325, -0.10437679311830816), + cv.Point2f(51.51214828037607, -0.1042212249954444), + ]; + for (var i = 0; i < srcPts.length; i++) { + src.setF64(i, 0, srcPts[i].x); + src.setF64(i, 1, srcPts[i].y); + } + for (var i = 0; i < dstPts.length; i++) { + dst.setF64(i, 0, dstPts[i].x); + dst.setF64(i, 1, dstPts[i].y); + } + + final (m, _) = await cv.findHomographyAsync( + src, + dst, + method: cv.HOMOGRAPY_ALL_POINTS, + ransacReprojThreshold: 3, + ); + expect(m.isEmpty, false); + }); + + // remap + test('cv.remapAsync', () async { + final src = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_UNCHANGED); + expect(src.isEmpty, false); + final map1 = cv.Mat.zeros(256, 256, cv.MatType.CV_16SC2); + map1.set(50, 50, 25); + final map2 = cv.Mat.empty(); + final dst = await cv.remapAsync(src, map1, map2, cv.INTER_LINEAR, borderValue: cv.Scalar.black); + expect(dst.isEmpty, false); + }); + + // filter2D + test('cv.filter2DAsync', () async { + final src = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_UNCHANGED); + expect(src.isEmpty, false); + final kernel = await cv.getStructuringElementAsync(cv.MORPH_RECT, (1, 1)); + final dst = await cv.filter2DAsync(src, -1, kernel); + expect(dst.isEmpty, false); + }); + + // sepFilter2D + test('cv.sepFilter2DAsync', () async { + final src = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_UNCHANGED); + expect(src.isEmpty, false); + final kernelX = await cv.getStructuringElementAsync(cv.MORPH_RECT, (1, 1)); + final kernelY = await cv.getStructuringElementAsync(cv.MORPH_RECT, (1, 1)); + final dst = await cv.sepFilter2DAsync(src, -1, kernelX, kernelY, anchor: cv.Point(-1, -1), delta: 0); + expect(dst.isEmpty, false); + }); + + // logPolar + test('cv.logPolarAsync', () async { + final src = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_UNCHANGED); + expect(src.isEmpty, false); + final dst = await cv.logPolarAsync(src, cv.Point2f(21, 21), 1, cv.INTER_LINEAR); + expect(dst.isEmpty, false); + }); + + // linearPolar + test('cv.linearPolarAsync', () async { + final src = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_UNCHANGED); + expect(src.isEmpty, false); + final dst = await cv.linearPolarAsync(src, cv.Point2f(21, 21), 1, cv.INTER_LINEAR); + expect(dst.isEmpty, false); + }); + + // fitLine + test('cv.fitLineAsync', () async { + final pts = [ + cv.Point(125, 24), + cv.Point(124, 75), + cv.Point(175, 76), + cv.Point(176, 25), + ]; + final dst = await cv.fitLineAsync(pts.cvd, cv.DIST_L2, 0, 0.01, 0.01); + expect(dst.isEmpty, false); + }); + + // matchShapes + test('cv.matchShapesAsync', () async { + final pts1 = [ + cv.Point(0, 0), + cv.Point(1, 0), + cv.Point(2, 2), + cv.Point(3, 3), + cv.Point(3, 4), + ]; + final pts2 = [ + cv.Point(0, 0), + cv.Point(1, 0), + cv.Point(2, 3), + cv.Point(3, 3), + cv.Point(3, 5), + ]; + final similarity = await cv.matchShapesAsync(pts1.cvd, pts2.cvd, cv.CONTOURS_MATCH_I2, 0); + expect(2.0 <= similarity && similarity <= 3.0, true); + }); + + test('cv.invertAffineTransformAsync', () async { + final src = [ + cv.Point(0, 0), + cv.Point(10, 5), + cv.Point(10, 10), + ]; + + final dst = [ + cv.Point(0, 0), + cv.Point(10, 0), + cv.Point(10, 10), + ]; + final m = await cv.getAffineTransformAsync(src.cvd, dst.cvd); + final inv = await cv.invertAffineTransformAsync(m); + expect(inv.isEmpty, false); + expect((inv.rows, inv.cols), (2, 3)); + }); + + test('cv.phaseCorrelateAsync', () async { + final template = await cv.imreadAsync("test/images/simple.jpg", flags: cv.IMREAD_GRAYSCALE); + final matched = await cv.imreadAsync("test/images/simple-translated.jpg", flags: cv.IMREAD_GRAYSCALE); + final notMatchedOrig = await cv.imreadAsync("test/images/space_shuttle.jpg", flags: cv.IMREAD_GRAYSCALE); + + final notMatched = await cv.resizeAsync(notMatchedOrig, (matched.size[1], matched.size[0])); + + final template32F = template.convertTo(cv.MatType.CV_32FC1); + final matched32F = matched.convertTo(cv.MatType.CV_32FC1); + final notMatched32F = notMatched.convertTo(cv.MatType.CV_32FC1); + + final (shiftTranslated, responseTranslated) = await cv.phaseCorrelateAsync(template32F, matched32F); + final (_, responseDiff) = await cv.phaseCorrelateAsync(template32F, notMatched32F); + expect(shiftTranslated.x, isA()); + expect(shiftTranslated.y, isA()); + + expect(responseTranslated, greaterThan(0.85)); + expect(responseDiff, lessThan(0.05)); + }); + + // accumulate + test('cv.accumulateAsync', () async { + final src = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(src.isEmpty, false); + final dst = cv.Mat.zeros(src.rows, src.cols, cv.MatType.CV_64FC3); + final mask = cv.Mat.zeros(src.rows, src.cols, cv.MatType.CV_8UC1); + await cv.accumulateAsync(src, dst, mask: mask); + expect(dst.isEmpty, false); + }); + + // accumulateSquare + test('cv.accumulateSquareAsync', () async { + final src = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(src.isEmpty, false); + final dst = cv.Mat.zeros(src.rows, src.cols, cv.MatType.CV_64FC3); + final mask = cv.Mat.zeros(src.rows, src.cols, cv.MatType.CV_8UC1); + await cv.accumulateSquareAsync(src, dst, mask: mask); + expect(dst.isEmpty, false); + }); + + // accumulateProduct + test('cv.accumulateProductAsync', () async { + final src = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(src.isEmpty, false); + final src2 = src.clone(); + final dst = cv.Mat.zeros(src.rows, src.cols, cv.MatType.CV_64FC3); + final mask = cv.Mat.zeros(src.rows, src.cols, cv.MatType.CV_8UC1); + await cv.accumulateProductAsync(src, src2, dst, mask: mask); + expect(dst.isEmpty, false); + }); + + // accumulateWeighted + test('cv.accumulateWeightedAsync', () async { + final src = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(src.isEmpty, false); + final dst = cv.Mat.zeros(src.rows, src.cols, cv.MatType.CV_64FC3); + final mask = cv.Mat.zeros(src.rows, src.cols, cv.MatType.CV_8UC1); + await cv.accumulateWeightedAsync(src, dst, 0.1, mask: mask); + expect(dst.isEmpty, false); + }); + + test("Issue 8 Async", () async { + final cv.Mat mask = cv.Mat.ones(512, 512, cv.MatType.CV_32FC1); + + final List faceTemplate = [ + cv.Point2f(192.98138, 239.94708), + cv.Point2f(318.90277, 240.1936), + cv.Point2f(256.63416, 314.01935), + cv.Point2f(201.26117, 371.41043), + cv.Point2f(314.08905, 371.15118), + ]; + + final List landmarks = [ + cv.Point2f(916.1744018554688, 436.8168579101563), + cv.Point2f(1179.1181030273438, 448.0384765625), + cv.Point2f(1039.171106147766, 604.8748825073242), + cv.Point2f(908.7911743164062, 683.4760314941407), + cv.Point2f(1167.2201416015625, 693.495068359375), + ]; + + final (affineMatrix, _) = + await cv.estimateAffinePartial2DAsync(landmarks.cvd, faceTemplate.cvd, method: cv.LMEDS); + + final invMask = await cv.warpAffineAsync(mask, affineMatrix, (2048, 2048)); + for (int i = 0; i < 2047; i++) { + for (int j = 0; j < 2047; j++) { + final val = invMask.at(i, j); + expect(val == 0 || val == 1, true); + } + } + }); +} diff --git a/test/imgproc/imgproc_test.dart b/test/imgproc/imgproc_test.dart index da574e41..da387f13 100644 --- a/test/imgproc/imgproc_test.dart +++ b/test/imgproc/imgproc_test.dart @@ -60,7 +60,7 @@ void main() async { final mask = cv.Mat.empty(); final hist = cv.calcHist([img].cvd, [0].i32, mask, [256].i32, [0.0, 256.0].f32); - final backProject = cv.calcBackProject([img].cvd, [0].i32, hist, [0.0, 256.0].f32, uniform: false); + final backProject = cv.calcBackProject([img].cvd, [0].i32, hist, [0.0, 256.0].f32); expect(backProject.isEmpty, false); }); @@ -155,6 +155,31 @@ void main() async { expect(cv.imwrite("test/images_out/test_cvtcolor.png", gray), true); }); + // test('cv.cvtColorAsync', () async { + // final m = cv.imread("test/images/circles.jpg", flags: cv.IMREAD_COLOR); + // for (var i = 0; i < 10; i++) { + // print("$i start"); + // final gray = await cv.cvtColorAsync(m, cv.COLOR_BGR2GRAY); + // expect((gray.width, gray.height, gray.channels), (512, 512, 1)); + // // expect(cv.imwrite("test/images_out/test_cvtcolor.png", gray), true); + // final sleep = Random().nextInt(1000); + // await Future.delayed(Duration(seconds: 2)); + // print("$i finished, sleep: $sleep"); + // } + // }); + + // test('test name', () async { + // Future asyncFunction() async { + // // 模拟耗时操作 + // await Future.delayed(Duration(seconds: 2)); + // print('Inside async function'); + // } + + // print('Before calling async function'); + // await asyncFunction(); + // print('After calling async function'); + // }); + test("cv2.equalizeHist", () async { final cvImage = cv.imread("test/images/circles.jpg", flags: cv.IMREAD_GRAYSCALE); expect((cvImage.width, cvImage.height), (512, 512)); @@ -278,7 +303,7 @@ void main() async { final (contours, _) = cv.findContours(thresImg, cv.RETR_EXTERNAL, cv.CHAIN_APPROX_SIMPLE); final rect = cv.minAreaRect(contours.first); - expect(rect.size.$1 > 0 && rect.points.isNotEmpty, true); + expect(rect.size.width > 0 && rect.points.isNotEmpty, true); final pts = cv.boxPoints(rect); expect(pts.isEmpty, false); @@ -578,7 +603,7 @@ void main() async { expect(img.isEmpty, false); final (textSize, baseline) = cv.getTextSize("Hello World", cv.FONT_HERSHEY_PLAIN, 1.0, 1); - expect((textSize.$1, textSize.$2, baseline), (91, 10, 6)); + expect((textSize.width, textSize.height, baseline), (91, 10, 6)); }); // resize diff --git a/test/imgproc/subdiv2d_test.dart b/test/imgproc/subdiv2d_test.dart index 072a0ec5..59951b68 100644 --- a/test/imgproc/subdiv2d_test.dart +++ b/test/imgproc/subdiv2d_test.dart @@ -43,7 +43,7 @@ void main() { sub1.insert(cv.Point2f(241, 241)); }); - test('cv.Subdiv2D others', () { + test('cv.Subdiv2D others', () async { final subdiv = cv.Subdiv2D.fromRect(cv.Rect(0, 0, src.width, src.height)); subdiv.insertVec(points.cvd); @@ -108,4 +108,74 @@ void main() { expect(sEdge, 2); } }); + + test('cv.Subdiv2D Async', () async { + { + final sub1 = await cv.Subdiv2DAsync.emptyAsync(); + await sub1.initDelaunayAsync(cv.Rect(0, 0, src.width, src.height)); + await sub1.insertAsync(cv.Point2f(241, 241)); + } + + final subdiv = await cv.Subdiv2DAsync.fromRectAsync(cv.Rect(0, 0, src.width, src.height)); + await subdiv.insertVecAsync(points.cvd); + { + final (rval, pt) = await subdiv.edgeDstAsync(1); + expect(rval, 0); + expect(pt, cv.Point2f(0, 0)); + } + + { + final (rval, pt) = await subdiv.edgeOrgAsync(1); + expect(rval, 0); + expect(pt, cv.Point2f(0, 0)); + } + + { + final (rval, pt) = await subdiv.findNearestAsync(cv.Point2f(241, 241)); + expect(rval, 7); + expect(pt, cv.Point2f(180, 230)); + } + + { + final edge = await subdiv.getEdgeAsync(1, cv.Subdiv2D.NEXT_AROUND_LEFT); + expect(edge, 1); + } + { + final edges = await subdiv.getEdgeListAsync(); + expect(edges.length, greaterThan(0)); + } + + { + final r = await subdiv.getLeadingEdgeListAsync(); + expect(r.length, greaterThan(0)); + } + + { + final (pt, v) = await subdiv.getVertexAsync(0); + expect(pt, cv.Point2f(0, 0)); + expect(v, 0); + } + + { + final (fl, fc) = await subdiv.getVoronoiFacetListAsync([0, 1].i32); + expect(fl.length, greaterThan(0)); + expect(fc.length, greaterThan(0)); + } + + { + final (rval, edge, vertex) = await subdiv.locateAsync(cv.Point2f(241, 241)); + expect(rval, cv.Subdiv2D.PTLOC_INSIDE); + expect(edge, 72); + expect(vertex, 0); + } + + { + final nextEdge = await subdiv.nextEdgeAsync(0); + expect(nextEdge, 0); + final rEdge = await subdiv.rotateEdgeAsync(0, 90); + expect(rEdge, 2); + final sEdge = await subdiv.symEdgeAsync(0); + expect(sEdge, 2); + } + }); } diff --git a/test/objdetect/objdetect_async_test.dart b/test/objdetect/objdetect_async_test.dart new file mode 100644 index 00000000..560f3730 --- /dev/null +++ b/test/objdetect/objdetect_async_test.dart @@ -0,0 +1,318 @@ +import 'dart:io'; +import 'dart:typed_data'; + +import 'package:opencv_dart/opencv_dart.dart' as cv; +import 'package:opencv_dart/src/core/mat_type.dart'; +import 'package:test/test.dart'; + +cv.Mat visualizeFaceDetect(cv.Mat img, cv.Mat faces) { + expect(faces.rows, greaterThanOrEqualTo(1)); + for (int row = 0; row < faces.rows; row++) { + final rect = cv.Rect( + faces.at(row, 0).toInt(), + faces.at(row, 1).toInt(), + faces.at(row, 2).toInt(), + faces.at(row, 3).toInt(), + ); + final points = [ + cv.Point(faces.at(row, 4).toInt(), faces.at(row, 5).toInt()), + cv.Point(faces.at(row, 6).toInt(), faces.at(row, 7).toInt()), + cv.Point(faces.at(row, 8).toInt(), faces.at(row, 9).toInt()), + cv.Point(faces.at(row, 10).toInt(), faces.at(row, 11).toInt()), + cv.Point(faces.at(row, 12).toInt(), faces.at(row, 13).toInt()), + ]; + cv.rectangle(img, rect, cv.Scalar.green, thickness: 2); + for (final p in points) { + cv.circle(img, p, 2, cv.Scalar.blue, thickness: 2); + } + } + return img; +} + +void main() async { + test('cv.CascadeClassifierAsync', () async { + final img = await cv.imreadAsync("test/images/face.jpg", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + + final classifier = await cv.CascadeClassifierAsync.emptyNewAsync(); + await classifier.loadAsync("test/data/haarcascade_frontalface_default.xml"); + final rects = await classifier.detectMultiScaleAsync(img); + expect(rects.length, 1); + + classifier.dispose(); + + final cls = + await cv.CascadeClassifierAsync.fromFileAsync("test/data/haarcascade_frontalface_default.xml"); + expect(cls.empty(), false); + + { + final (objects, nums) = await cls.detectMultiScale2Async(img); + expect(objects.length, 1); + expect(nums.length, 1); + } + + { + final (objects, nums, weights) = await cls.detectMultiScale3Async(img, outputRejectLevels: true); + expect(objects.length, 1); + expect(nums.length, 1); + expect(weights.length, 1); + } + + expect(await cls.getFeatureTypeAsync(), 0); + expect(await cls.getOriginalWindowSizeAsync(), (24, 24)); + expect(await cls.isOldFormatCascadeAsync(), false); + }); + + test('cv.HOGDescriptorAsync', () async { + final img = await cv.imreadAsync("test/images/face.jpg", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + { + final hog = await cv.HOGDescriptorAsync.emptyNewAsync(); + await hog.setSVMDetectorAsync(await cv.HOGDescriptorAsync.getDefaultPeopleDetectorAsync()); + final rects = await hog.detectMultiScaleAsync(img); + expect(rects.length, 1); + hog.dispose(); + } + { + final hog = await cv.HOGDescriptorAsync.emptyNewAsync(); + expect(await hog.getDescriptorSizeAsync(), 3780); + expect(await hog.getWinSigmaAsync(), closeTo(4.0, 1e-6)); + final d = await cv.HOGDescriptorAsync.getDaimlerPeopleDetectorAsync(); + expect(d.length, 1981); + final success = await hog.loadAsync("test/data/hog.xml"); + expect(success, true); + // hog.setSVMDetector(d); + final rects = await hog.detectMultiScaleAsync(img); + expect(rects.length, greaterThanOrEqualTo(0)); + } + + final hog1 = await cv.HOGDescriptorAsync.fromFileAsync("test/data/hog.xml"); + final (descriptors, locations) = await hog1.computeAsync(img); + expect(descriptors.length, greaterThanOrEqualTo(0)); + expect(locations.length, greaterThanOrEqualTo(0)); + + final grad = cv.Mat.empty(); + final angle = cv.Mat.empty(); + await hog1.computeGradientAsync(img, grad, angle); + expect(grad.isEmpty, false); + expect(angle.isEmpty, false); + + { + final (locs, slocs) = await hog1.detectAsync(img); + expect(locs.length, greaterThanOrEqualTo(0)); + expect(slocs.length, greaterThanOrEqualTo(0)); + } + + { + final (locs, weights, slocs) = await hog1.detect2Async(img); + expect(locs.length, greaterThanOrEqualTo(0)); + expect(weights.length, greaterThanOrEqualTo(0)); + expect(slocs.length, greaterThanOrEqualTo(0)); + } + + { + final rects = await hog1.detectMultiScaleAsync(img); + expect(rects.length, greaterThanOrEqualTo(0)); + } + }); + + test('cv.groupRectanglesAsync', () async { + final rects = [ + cv.Rect(10, 10, 30, 30), + cv.Rect(10, 10, 30, 30), + cv.Rect(10, 10, 30, 30), + cv.Rect(10, 10, 30, 30), + cv.Rect(10, 10, 30, 30), + cv.Rect(10, 10, 30, 30), + cv.Rect(10, 10, 30, 30), + cv.Rect(10, 10, 30, 30), + cv.Rect(10, 10, 30, 30), + cv.Rect(10, 10, 30, 30), + cv.Rect(10, 10, 35, 35), + cv.Rect(10, 10, 35, 35), + cv.Rect(10, 10, 35, 35), + cv.Rect(10, 10, 35, 35), + cv.Rect(10, 10, 35, 35), + cv.Rect(10, 10, 35, 35), + cv.Rect(10, 10, 35, 35), + cv.Rect(10, 10, 35, 35), + cv.Rect(10, 10, 35, 35), + cv.Rect(10, 10, 35, 35), + ]; + + final res = await cv.groupRectanglesAsync(rects.cvd, 1, 0.2); + expect(res.length, 1); + expect(res.first, cv.Rect(10, 10, 32, 32)); + + { + final hog = await cv.HOGDescriptorAsync.emptyNewAsync(); + final w = List.generate(rects.length, (index) => 0.1); + final (res, weights) = await hog.groupRectanglesAsync(rects.cvd, w.f64, 1, 0.1); + expect(res.length, greaterThan(0)); + expect(weights.length, greaterThan(0)); + } + }); + + test('cv.QRCodeDetectorAsync', () async { + final img = await cv.imreadAsync("test/images/qrcode.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + + final detector = await cv.QRCodeDetectorAsync.emptyNewAsync(); + final (res, bbox) = await detector.detectAsync(img); + expect(res, true); + expect(bbox, isNotNull); + + { + final (success, pts) = await detector.detectAsync(img); + expect(success, true); + expect(pts.length, greaterThan(0)); + + final (rval, code) = await detector.decodeCurvedAsync(img, pts); + expect(rval, "Hello World!"); + expect(code.isEmpty, false); + } + + { + final (rval, pts, code) = await detector.detectAndDecodeCurvedAsync(img); + expect(rval, "Hello World!"); + expect(pts.length, greaterThan(0)); + expect(code.isEmpty, false); + } + + final (res2, bbox2, codes2) = await detector.decodeAsync(img); + final (res2_1, bbox2_1, codes2_1) = await detector.decodeAsync(img); + expect(res2_1, equals(res2)); + expect(bbox2_1, bbox2); + expect(codes2?.shape, codes2_1?.shape); + final (res3, bbox3, codes3) = await detector.detectAndDecodeAsync(img); + final (res3_1, bbox3_1, codes3_1) = await detector.detectAndDecodeAsync(img); + expect(bbox3_1, bbox3); + expect(codes3.shape, codes3_1.shape); + expect(res2, equals(res3)); + expect(res3_1, equals(res3)); + + final img2 = await cv.imreadAsync("test/images/multi_qrcodes.png", flags: cv.IMREAD_COLOR); + expect(img2.isEmpty, false); + + final (res4, multiBox) = await detector.detectMultiAsync(img2); + expect(res4, true); + expect(multiBox, isNotNull); + expect(multiBox.length, greaterThan(0)); + + final (success, strs, pts, mats) = await detector.detectAndDecodeMultiAsync(img); + expect(success, true); + expect(strs, ["Hello World!"]); + expect(pts.length, greaterThan(0)); + expect(mats.length, greaterThan(0)); + + await detector.setEpsXAsync(0.1); + await detector.setEpsYAsync(0.1); + await detector.setUseAlignmentMarkersAsync(false); + + detector.dispose(); + }); + + // https://docs.opencv.org/4.x/d0/dd4/tutorial_dnn_face.html + test('cv.FaceDetectorYNAsync', tags: ["no-local-files"], () async { + { + // Test loading from file + const modelPath = "test/models/face_detection_yunet_2023mar.onnx"; + final detector = await cv.FaceDetectorYNAsync.fromFileAsync(modelPath, "", (320, 320)); + + // Test loading image and setting input size + final img = await cv.imreadAsync("test/images/lenna.png"); + expect(img.isEmpty, false); + await detector.setInputSizeAsync((img.width, img.height)); + + // Test detection + final face = await detector.detectAsync(img); + expect(face.rows, greaterThanOrEqualTo(1)); + visualizeFaceDetect(img, face); + + // Test setting parameters + await detector.setScoreThresholdAsync(0.8); + await detector.setNMSThresholdAsync(0.4); + await detector.setTopKAsync(3000); + + // Test getters and compare values + expect(await detector.getScoreThresholdAsync(), closeTo(0.8, 1e-6)); + expect(await detector.getNmsThresholdAsync(), closeTo(0.4, 1e-6)); + expect(await detector.getTopKAsync(), equals(3000)); + expect(await detector.getInputSizeAsync(), equals((img.width, img.height))); + + // Dispose the detector + detector.dispose(); + } + + { + // Test loading from buffer + const modelPath = "test/models/face_detection_yunet_2023mar.onnx"; + final buf = await File(modelPath).readAsBytes(); + final detector = await cv.FaceDetectorYNAsync.fromBufferAsync("onnx", buf, Uint8List(0), (320, 320)); + + // Test loading image and setting input size + final img = await cv.imreadAsync("test/images/lenna.png"); + expect(img.isEmpty, false); + await detector.setInputSizeAsync((img.width, img.height)); + + // Test detection + final face = await detector.detectAsync(img); + expect(face.rows, greaterThanOrEqualTo(1)); + visualizeFaceDetect(img, face); + // cv.imwrite("AAA.png", img); + + // Dispose the detector + detector.dispose(); + } + }); + + // Test for cv.FaceRecognizerSF + test('cv.FaceRecognizerSFAsync', tags: ["no-local-files"], () async { + const modelPath = "test/models/face_recognition_sface_2021dec.onnx"; + final recognizer = await cv.FaceRecognizerSFAsync.fromFileAsync(modelPath, ""); + + // Test loading image + final img = await cv.imreadAsync("test/images/face.jpg"); + expect(img.isEmpty, false); + + // Assume face detection already done and we have faceBox (a Mat object) + final faceBox = cv.Mat.zeros(1, 4, MatType.CV_32SC1); + faceBox.set(0, 0, 50); // x + faceBox.set(0, 1, 50); // y + faceBox.set(0, 2, 100); // width + faceBox.set(0, 3, 100); // height + + // Test alignCrop + final alignedFace = await recognizer.alignCropAsync(img, faceBox); + expect(alignedFace.isEmpty, false); + + // Test feature extraction + final faceFeature = await recognizer.featureAsync(alignedFace); + expect(faceFeature.isEmpty, false); + + // Test loading another image for matching + final img2 = await cv.imreadAsync("test/images/lenna.png"); + expect(img2.isEmpty, false); + + // Test alignCrop and feature extraction for the second image + final alignedFace2 = await recognizer.alignCropAsync(img2, faceBox); + final faceFeature2 = await recognizer.featureAsync(alignedFace2); + + // Test matching features using L2 distance + final matchScoreL2 = + await recognizer.matchAsync(faceFeature, faceFeature2, disType: cv.FaceRecognizerSF.FR_NORM_L2); + expect(matchScoreL2, greaterThanOrEqualTo(0)); + + // Test matching features using Cosine distance + final matchScoreCosine = + await recognizer.matchAsync(faceFeature, faceFeature2, disType: cv.FaceRecognizerSF.FR_COSINE); + expect(matchScoreCosine, greaterThanOrEqualTo(0)); + + // Clean up + recognizer.dispose(); + alignedFace.dispose(); + faceFeature.dispose(); + alignedFace2.dispose(); + faceFeature2.dispose(); + }); +} diff --git a/test/objdetect_test.dart b/test/objdetect/objdetect_test.dart similarity index 100% rename from test/objdetect_test.dart rename to test/objdetect/objdetect_test.dart 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/photo/photo_async_test.dart b/test/photo/photo_async_test.dart new file mode 100644 index 00000000..c07b249a --- /dev/null +++ b/test/photo/photo_async_test.dart @@ -0,0 +1,155 @@ +import 'package:opencv_dart/opencv_dart.dart' as cv; +import 'package:test/test.dart'; + +void main() { + test('cv.colorChangeAsync', () async { + final src = cv.Mat.zeros(20, 20, cv.MatType.CV_8UC3); + final mask = src.clone(); + final dst = await cv.colorChangeAsync(src, mask); + expect(dst.isEmpty, false); + expect((dst.rows, dst.cols), (src.rows, src.cols)); + }); + + test('cv.seamlessCloneAsync', () async { + final src = cv.Mat.zeros(20, 20, cv.MatType.CV_8UC3); + final mask = src.clone(); + final dst = src.clone(); + final p = cv.Point(dst.cols ~/ 2, dst.rows ~/ 2); + final blend = await cv.seamlessCloneAsync(src, dst, mask, p, cv.NORMAL_CLONE); + expect(blend.isEmpty, false); + expect((blend.rows, blend.cols), (dst.rows, dst.cols)); + }); + + test('cv.illuminationChangeAsync', () async { + final src = cv.Mat.zeros(20, 20, cv.MatType.CV_8UC3); + final mask = src.clone(); + final dst = await cv.illuminationChangeAsync(src, mask); + expect(dst.isEmpty, false); + expect((dst.rows, dst.cols), (src.rows, src.cols)); + }); + + test('cv.textureFlatteningAsync', () async { + final src = cv.Mat.zeros(20, 20, cv.MatType.CV_8UC3); + final mask = src.clone(); + final dst = await cv.textureFlatteningAsync(src, mask); + expect(dst.isEmpty, false); + expect((dst.rows, dst.cols), (src.rows, src.cols)); + }); + + test('cv.fastNlMeansDenoisingAsync', () async { + final img = await cv.imreadAsync( + "test/images/lenna.png", + flags: cv.IMREAD_GRAYSCALE, + ); + expect(img.isEmpty, false); + + final dst = await cv.fastNlMeansDenoisingAsync(img); + expect(dst.isEmpty, false); + expect((dst.rows, dst.cols), (img.rows, img.cols)); + }); + + test('cv.fastNlMeansDenoisingColoredMultiAsync', () async { + final src = [ + cv.Mat.zeros(20, 20, cv.MatType.CV_8UC3), + cv.Mat.zeros(20, 20, cv.MatType.CV_8UC3), + cv.Mat.zeros(20, 20, cv.MatType.CV_8UC3), + ]; + + final dst = await cv.fastNlMeansDenoisingColoredMultiAsync(src.cvd, 1, 1); + expect(dst.isEmpty, false); + expect((dst.rows, dst.cols), (src[0].rows, src[0].cols)); + }); + + test('cv.fastNlMeansDenoisingColoredAsync', () async { + final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR); + expect(img.isEmpty, false); + + final dst = await cv.fastNlMeansDenoisingColoredAsync(img); + expect(dst.isEmpty, false); + expect((dst.rows, dst.cols), (img.rows, img.cols)); + }); + + test('cv.detailEnhanceAsync', () async { + final src = cv.Mat.zeros(20, 20, cv.MatType.CV_8UC3); + final dst = await cv.detailEnhanceAsync(src); + expect(dst.isEmpty, false); + expect((dst.rows, dst.cols), (src.rows, src.cols)); + }); + + test('cv.edgePreservingFilterAsync', () async { + final src = cv.Mat.zeros(20, 20, cv.MatType.CV_8UC3); + final dst = await cv.edgePreservingFilterAsync(src); + expect(dst.isEmpty, false); + expect((dst.rows, dst.cols), (src.rows, src.cols)); + }); + + test('cv.pencilSketchAsync', () async { + final src = cv.Mat.zeros(20, 20, cv.MatType.CV_8UC3); + final (dst1, dst2) = await cv.pencilSketchAsync(src); + expect(dst1.isEmpty, false); + expect((dst1.rows, dst1.cols), (src.rows, src.cols)); + expect(dst2.isEmpty, false); + expect((dst2.rows, dst2.cols), (src.rows, src.cols)); + }); + + test('cv.stylizationAsync', () async { + final src = cv.Mat.zeros(20, 20, cv.MatType.CV_8UC3); + final dst = await cv.stylizationAsync(src); + expect(dst.isEmpty, false); + expect((dst.rows, dst.cols), (src.rows, src.cols)); + }); + + test('cv.inpaintAsync', () async { + final src = await cv.imreadAsync( + "test/images/inpaint-src.jpg", + flags: cv.IMREAD_COLOR, + ); + expect(src.isEmpty, false); + final mask = await cv.imreadAsync( + "test/images/inpaint-mask.jpg", + flags: cv.IMREAD_GRAYSCALE, + ); + expect(mask.isEmpty, false); + final dst = await cv.inpaintAsync(src, mask, 10, cv.INPAINT_TELEA); + expect(dst.channels, greaterThan(1)); + final sum = dst.sum(); + expect(sum == cv.Scalar.all(0), false); + }); + + test('cv.MergeMertensAsync', () async { + final src = [ + cv.Mat.zeros(20, 20, cv.MatType.CV_8UC3), + cv.Mat.zeros(20, 20, cv.MatType.CV_8UC3), + cv.Mat.zeros(20, 20, cv.MatType.CV_8UC3), + ]; + final mertens = await cv.MergeMertensAsync.emptyNewAsync(); + final dst = await mertens.processAsync(src.cvd); + expect(dst.isEmpty, false); + expect((dst.rows, dst.cols), (src[0].rows, src[0].cols)); + + final mertens1 = await cv.MergeMertensAsync.createAsync(); + final dst1 = await mertens1.processAsync(src.cvd); + expect(dst1.isEmpty, false); + expect((dst1.rows, dst1.cols), (src[0].rows, src[0].cols)); + + mertens1.dispose(); + }); + + test('cv.AlignMTBAsync', () async { + final src = [ + cv.Mat.zeros(20, 20, cv.MatType.CV_8UC3), + cv.Mat.zeros(20, 20, cv.MatType.CV_8UC3), + cv.Mat.zeros(20, 20, cv.MatType.CV_8UC3), + ]; + + final alignmtb = await cv.AlignMTBAsync.emptyNewAsync(); + final dst = await alignmtb.processAsync(src.cvd); + expect(dst.length, greaterThan(0)); + + final alignmtb1 = await cv.AlignMTBAsync.createAsync(); + final dst1 = await alignmtb1.processAsync(src.cvd); + expect(dst1.length, greaterThan(0)); + + alignmtb1.dispose(); + }); +} diff --git a/test/photo_test.dart b/test/photo/photo_test.dart similarity index 100% rename from test/photo_test.dart rename to test/photo/photo_test.dart diff --git a/test/stitching/stitching_async_test.dart b/test/stitching/stitching_async_test.dart new file mode 100644 index 00000000..70fdb245 --- /dev/null +++ b/test/stitching/stitching_async_test.dart @@ -0,0 +1,78 @@ +import 'package:opencv_dart/opencv_dart.dart' as cv; +import 'package:test/test.dart'; + +void main() { + test('cv.StitcherAsync', () async { + final stitcher = await cv.StitcherAsync.createAsync(mode: cv.StitcherMode.PANORAMA); + final images = [ + await cv.imreadAsync("test/images/barcode1.png", flags: cv.IMREAD_COLOR), + await cv.imreadAsync("test/images/barcode2.png", flags: cv.IMREAD_COLOR), + ]; + final (status, pano) = await stitcher.stitchAsync(images.cvd); + expect(status, cv.StitcherStatus.OK); + expect(pano.isEmpty, false); + stitcher.dispose(); + }); + + test('cv.StitcherAsync with mask', () async { + final stitcher = await cv.StitcherAsync.createAsync(mode: cv.StitcherMode.PANORAMA); + final images = [ + await cv.imreadAsync("test/images/barcode1.png", flags: cv.IMREAD_COLOR), + await cv.imreadAsync("test/images/barcode2.png", flags: cv.IMREAD_COLOR), + ]; + + final masks = [ + await cv.imreadAsync("test/images/barcode_mask1.png", flags: cv.IMREAD_GRAYSCALE), + await cv.imreadAsync("test/images/barcode_mask2.png", flags: cv.IMREAD_GRAYSCALE), + ]; + final (status, pano) = await stitcher.stitchAsync(images.cvd, masks: masks.cvd); + expect(status, cv.StitcherStatus.OK); + expect(pano.isEmpty, false); + stitcher.dispose(); + }); + + test('cv.StitcherAsync getter/setter', () async { + final stitcher = await cv.StitcherAsync.createAsync(mode: cv.StitcherMode.PANORAMA); + await stitcher.setRegistrationResolAsync(3.14159); + expect(await stitcher.getRegistrationResolAsync(), 3.14159); + + await stitcher.setSeamEstimationResolAsync(3.14159); + expect(await stitcher.getSeamEstimationResolAsync(), 3.14159); + + await stitcher.setPanoConfidenceThreshAsync(3.14159); + expect(await stitcher.getPanoConfidenceThreshAsync(), 3.14159); + + await stitcher.setCompositingResolAsync(3.14159); + expect(await stitcher.getCompositingResolAsync(), 3.14159); + + await stitcher.setWaveCorrectionAsync(true); + expect(await stitcher.getWaveCorrectionAsync(), true); + + await stitcher.setWaveCorrectKindAsync(cv.WaveCorrectKind.HORIZONTAL.index); + expect(await stitcher.getWaveCorrectKindAsync(), cv.WaveCorrectKind.HORIZONTAL.index); + + await stitcher.setInterpolationFlagsAsync(cv.INTER_LINEAR); + expect(await stitcher.getInterpolationFlagsAsync(), cv.INTER_LINEAR); + + expect((await stitcher.getComponentAsync()).length, greaterThanOrEqualTo(0)); + }); + + test('Issue 48', () async { + final images = [ + await cv.imreadAsync("test/images/barcode1.png", flags: cv.IMREAD_COLOR), + await cv.imreadAsync("test/images/barcode2.png", flags: cv.IMREAD_COLOR), + ]; + + final stitcher = await cv.StitcherAsync.createAsync(); + final status = await stitcher.estimateTransformAsync(images.cvd); + expect(status, cv.StitcherStatus.OK); + + final result = await stitcher.composePanoramaAsync(); + expect(result.$1, cv.StitcherStatus.OK); + expect(result.$2.isEmpty, false); + + final result1 = await stitcher.composePanoramaAsync(images: images.cvd); + expect(result1.$1, cv.StitcherStatus.OK); + expect(result1.$2.isEmpty, false); + }); +} diff --git a/test/stitching_test.dart b/test/stitching/stitching_test.dart similarity index 100% rename from test/stitching_test.dart rename to test/stitching/stitching_test.dart diff --git a/test/svd_test.dart b/test/svd_test.dart index 50ab2bf3..9004bc33 100644 --- a/test/svd_test.dart +++ b/test/svd_test.dart @@ -1,6 +1,10 @@ import 'package:opencv_dart/opencv_dart.dart' as cv; import 'package:test/test.dart'; +final resultW = [6.410056, 3.4595323]; +final resultU = [-0.32415637, -0.9460035, 0.94600356, -0.3241564]; +final resultVt = [-0.32415637, 0.9460035, 0.9460035, -0.32415637]; + bool checkFunc(List a, List b, {double eps = 1e-4}) { if (a.length != b.length) { return false; @@ -8,12 +12,31 @@ bool checkFunc(List a, List b, {double eps = 1e-4}) { return List.generate(a.length, (i) => a[i] - b[i] < eps).every((e) => e); } -void main() async { - test('SVD.compute', () { - final resultW = [6.410056, 3.4595323]; - final resultU = [-0.32415637, -0.9460035, 0.94600356, -0.3241564]; - final resultVt = [-0.32415637, 0.9460035, 0.9460035, -0.32415637]; +void checkSVD(cv.Mat w, cv.Mat u, cv.Mat vt) { + expect(w.isEmpty || u.isEmpty || vt.isEmpty, false); + expect(w.size, [2, 1]); + expect(u.size, [2, 2]); + expect(vt.size, [2, 2]); + + expect(checkFunc([w.at(0, 0), w.at(1, 0)], resultW), true); + expect( + checkFunc( + [u.at(0, 0), u.at(0, 1), u.at(1, 0), u.at(1, 1)], + resultU, + ), + true, + ); + expect( + checkFunc( + [vt.at(0, 0), vt.at(0, 1), vt.at(1, 0), vt.at(1, 1)], + resultVt, + ), + true, + ); +} +void main() async { + test('SVD.compute', () async { final src = cv.Mat.zeros(2, 2, cv.MatType.CV_32FC1); src.set(0, 0, 3.76956568); src.set(0, 1, -0.90478725); @@ -21,30 +44,40 @@ void main() async { src.set(1, 1, 6.10002347); expect(src.at(0, 0), closeTo(3.76956568, 1e-4)); - final w = cv.Mat.empty(); - final u = cv.Mat.empty(); - final vt = cv.Mat.empty(); - - cv.SVD.compute(src, w, u, vt); - expect(w.isEmpty || u.isEmpty || vt.isEmpty, false); - expect(w.size, [2, 1]); - expect(u.size, [2, 2]); - expect(vt.size, [2, 2]); + { + final w = cv.Mat.empty(); + final u = cv.Mat.empty(); + final vt = cv.Mat.empty(); + cv.SVD.compute(src, w: w, u: u, vt: vt); + checkSVD(w, u, vt); + } + { + final (w, u, vt) = await cv.SVD.computeAsync(src); + checkSVD(w, u, vt); + } + }); - expect(checkFunc([w.at(0, 0), w.at(1, 0)], resultW), true); - expect( - checkFunc( - [u.at(0, 0), u.at(0, 1), u.at(1, 0), u.at(1, 1)], - resultU, - ), - true, - ); - expect( - checkFunc( - [vt.at(0, 0), vt.at(0, 1), vt.at(1, 0), vt.at(1, 1)], - resultVt, - ), - true, - ); + test('cv.SVD.backSubst', () async { + final src = cv.Mat.zeros(2, 2, cv.MatType.CV_32FC1); + src.set(0, 0, 3.76956568); + src.set(0, 1, -0.90478725); + src.set(1, 0, -0.90478725); + src.set(1, 1, 6.10002347); + expect(src.at(0, 0), closeTo(3.76956568, 1e-4)); + { + final w = cv.Mat.empty(); + final u = cv.Mat.empty(); + final vt = cv.Mat.empty(); + cv.SVD.compute(src, w: w, u: u, vt: vt); + checkSVD(w, u, vt); + final dst = cv.SVD.backSubst(w, u, vt, src); + expect(dst.isEmpty, false); + } + { + final (w, u, vt) = await cv.SVD.computeAsync(src); + checkSVD(w, u, vt); + final dst = await cv.SVD.backSubstAsync(w, u, vt, src); + expect(dst.isEmpty, false); + } }); } 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