diff --git a/lib/opencv_dart.dart b/lib/opencv_dart.dart index 9d6b3a16..9c286afc 100644 --- a/lib/opencv_dart.dart +++ b/lib/opencv_dart.dart @@ -34,8 +34,11 @@ 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'; diff --git a/lib/src/core/base.dart b/lib/src/core/base.dart index 936fe887..7a5ece10 100644 --- a/lib/src/core/base.dart +++ b/lib/src/core/base.dart @@ -13,7 +13,6 @@ import 'package:ffi/ffi.dart'; import "../opencv.g.dart" as cvg; import "exception.dart" show CvException; -import 'mat.dart'; const _libraryName = "opencv_dart"; @@ -153,13 +152,7 @@ Future cvRunAsync3( Future cvRunAsync4( ffi.Pointer Function(cvg.CvCallback_4 callback) func, - void Function( - Completer completer, - VoidPtr p, - VoidPtr p1, - VoidPtr p2, - VoidPtr p3, - ) onComplete, + void Function(Completer completer, VoidPtr p, VoidPtr p1, VoidPtr p2, VoidPtr p3) onComplete, ) { final completer = Completer(); late final NativeCallable ccallback; @@ -189,12 +182,24 @@ Future cvRunAsync5( return completer.future; } -// 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()))); +// async completers +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( diff --git a/lib/src/core/core.dart b/lib/src/core/core.dart index c6059703..45e46e90 100644 --- a/lib/src/core/core.dart +++ b/lib/src/core/core.dart @@ -26,6 +26,12 @@ String openCvVersion() { return s; } +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. @@ -37,6 +43,12 @@ String getBuildInformation() { return s; } +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. /// 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..8706290b 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'; @@ -1410,3 +1411,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/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 6730ec36..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'; @@ -220,3 +221,10 @@ class VecRectIterator extends VecIterator { 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/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/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/gapi/gapi.dart b/lib/src/gapi/gapi.dart index 33b93408..e1a801a0 100644 --- a/lib/src/gapi/gapi.dart +++ b/lib/src/gapi/gapi.dart @@ -4,13 +4,13 @@ import 'dart:ffi' as ffi; import 'package:ffi/ffi.dart'; -import '../constants.g.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 '../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'; diff --git a/lib/src/gapi/gmat.dart b/lib/src/gapi/gmat.dart index e901bc87..7d48f54a 100644 --- a/lib/src/gapi/gmat.dart +++ b/lib/src/gapi/gmat.dart @@ -4,13 +4,13 @@ import 'dart:ffi' as ffi; import 'package:ffi/ffi.dart'; -import '../constants.g.dart'; +// import '../constants.g.dart'; import '../core/base.dart'; -import '../core/dmatch.dart'; -import '../core/keypoint.dart'; +// import '../core/dmatch.dart'; +// import '../core/keypoint.dart'; import '../core/mat.dart'; -import '../core/scalar.dart'; -import '../core/vec.dart'; +// import '../core/scalar.dart'; +// import '../core/vec.dart'; import '../opencv.g.dart' as cvg; class GMat extends CvStruct { diff --git a/lib/src/gapi/gscalar.dart b/lib/src/gapi/gscalar.dart index 81713360..509815f2 100644 --- a/lib/src/gapi/gscalar.dart +++ b/lib/src/gapi/gscalar.dart @@ -4,13 +4,13 @@ import 'dart:ffi' as ffi; import 'package:ffi/ffi.dart'; -import '../constants.g.dart'; +// import '../constants.g.dart'; import '../core/base.dart'; -import '../core/dmatch.dart'; -import '../core/keypoint.dart'; -import '../core/mat.dart'; +// import '../core/dmatch.dart'; +// import '../core/keypoint.dart'; +// import '../core/mat.dart'; import '../core/scalar.dart'; -import '../core/vec.dart'; +// import '../core/vec.dart'; import '../opencv.g.dart' as cvg; class GScalar extends CvStruct { diff --git a/lib/src/imgproc/clahe.dart b/lib/src/imgproc/clahe.dart index 1dda9368..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 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 4e5dd650..c41ab7de 100644 --- a/lib/src/imgproc/imgproc.dart +++ b/lib/src/imgproc/imgproc.dart @@ -2,7 +2,6 @@ library cv; -import 'dart:async'; import 'dart:ffi' as ffi; import 'dart:ffi'; @@ -77,9 +76,6 @@ Mat cvtColor(Mat src, int code, {Mat? dst}) { return dst; } -Future cvtColorAsync(Mat src, int code, {Mat? dst}) async => - cvRunAsync((callback) => CFFI.CvtColor_Async(src.ref, code, callback), matCompleter); - /// EqualizeHist Equalizes the histogram of a grayscale image. /// /// For further details, please see: @@ -130,7 +126,7 @@ Mat calcBackProject( Mat hist, VecFloat ranges, { Mat? dst, - bool uniform = true, + double scale = 1.0, }) { dst ??= Mat.empty(); cvRun( @@ -140,7 +136,7 @@ Mat calcBackProject( hist.ref, dst!.ref, ranges.ref, - uniform, + scale, ), ); return dst; @@ -562,19 +558,6 @@ Mat gaussianBlur( return dst; } -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: 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/opencv.g.dart b/lib/src/opencv.g.dart index c4450e2d..fa6640b9 100644 --- a/lib/src/opencv.g.dart +++ b/lib/src/opencv.g.dart @@ -126,6 +126,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, ) { @@ -267,6 +295,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 +332,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 +373,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 +414,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 +463,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, ) { @@ -2053,6 +2199,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 +2351,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 +2387,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 +2425,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 +2463,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 +2498,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 +2530,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 +2560,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 +2610,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 +2660,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 +2694,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,13 +2728,33 @@ class CvNative { late final _CLAHE_SetClipLimit = _CLAHE_SetClipLimitPtr.asFunction< ffi.Pointer Function(CLAHE, double)>(); - ffi.Pointer CLAHE_SetTilesGridSize( - CLAHE c, - Size size, + ffi.Pointer CLAHE_SetClipLimit_Async( + CLAHE self, + double clipLimit, + CvCallback_0 callback, ) { - return _CLAHE_SetTilesGridSize( - c, - size, + 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, + ) { + return _CLAHE_SetTilesGridSize( + c, + size, ); } @@ -2382,13 +2764,32 @@ class CvNative { late final _CLAHE_SetTilesGridSize = _CLAHE_SetTilesGridSizePtr.asFunction< ffi.Pointer Function(CLAHE, Size)>(); + 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, - bool uniform, + double scale, ) { return _CalcBackProject( mats, @@ -2396,17 +2797,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 +2863,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, @@ -2631,6 +3086,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, ) { @@ -3252,6 +3733,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, @@ -3274,6 +3811,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, @@ -3320,6 +3878,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, @@ -3377,6 +3956,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, @@ -3394,6 +4021,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, @@ -3415,6 +4059,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, @@ -3434,6 +4099,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, @@ -3458,6 +4142,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, ) { @@ -3575,11 +4285,58 @@ class CvNative { late final _DilateWithParams = _DilateWithParamsPtr.asFunction< ffi.Pointer Function(Mat, Mat, Mat, Point, int, int, Scalar)>(); - ffi.Pointer DistanceTransform( + ffi.Pointer DilateWithParams_Async( Mat src, - Mat dst, - Mat labels, - int distanceType, + 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, + Mat labels, + int distanceType, int maskSize, int labelType, ) { @@ -3600,6 +4357,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, @@ -3684,6 +4464,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, @@ -3846,6 +4696,92 @@ class CvNative { ffi.Pointer Function( Mat, Point, Point, double, double, double, Scalar, int, int, int)>(); + 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 _EllipseWithParams_Async( + img, + center, + axes, + angle, + startAngle, + endAngle, + color, + thickness, + lineType, + shift, + callback, + ); + } + + 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 Ellipse_Async( + Mat img, + Point center, + Point axes, + double angle, + double startAngle, + double endAngle, + Scalar color, + int thickness, + CvCallback_0 callback, + ) { + 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, @@ -3862,6 +4798,23 @@ class CvNative { 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, @@ -3907,6 +4860,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, @@ -5068,33 +6068,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< + 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, @@ -5194,6 +6272,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, @@ -5224,6 +6323,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, @@ -5375,6 +6502,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, @@ -5401,6 +6545,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, ) { @@ -5767,6 +6937,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, ) { @@ -5803,6 +7014,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, ) { @@ -5901,6 +7133,52 @@ class CvNative { ffi.Pointer Function( VecPoint2f, VecPoint2f, ffi.Pointer, int)>(); + ffi.Pointer GetPerspectiveTransform2f_Async( + VecPoint2f src, + VecPoint2f dst, + int solveMethod, + CvCallback_1 callback, + ) { + return _GetPerspectiveTransform2f_Async( + src, + dst, + solveMethod, + callback, + ); + } + + 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( + VecPoint2f, VecPoint2f, int, CvCallback_1)>(); + + 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, @@ -5922,6 +7200,27 @@ class CvNative { 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, @@ -5944,6 +7243,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, @@ -5963,16 +7285,38 @@ class CvNative { late final _GetStructuringElement = _GetStructuringElementPtr.asFunction< ffi.Pointer Function(int, Size, ffi.Pointer)>(); - ffi.Pointer GetTextSizeWithBaseline( - ffi.Pointer text, - int fontFace, - double fontScale, - int thickness, - ffi.Pointer baseline, - ffi.Pointer rval, + ffi.Pointer GetStructuringElement_Async( + int shape, + Size ksize, + Point anchor, + CvCallback_1 callback, ) { - return _GetTextSizeWithBaseline( - text, + 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, + double fontScale, + int thickness, + ffi.Pointer baseline, + ffi.Pointer rval, + ) { + return _GetTextSizeWithBaseline( + text, fontFace, fontScale, thickness, @@ -5994,6 +7338,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, ) { @@ -6093,6 +7466,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, @@ -6120,6 +7578,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, @@ -6936,6 +8424,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, @@ -7027,6 +8579,64 @@ class CvNative { ffi.Pointer Function( Mat, Mat, double, double, int, double, double)>(); + ffi.Pointer HoughLinesPWithParams_Async( + Mat src, + double rho, + double theta, + int threshold, + double minLineLength, + double maxLineGap, + CvCallback_1 callback, + ) { + return _HoughLinesPWithParams_Async( + src, + rho, + theta, + threshold, + 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, @@ -7070,27 +8680,111 @@ class CvNative { ffi.Pointer Function(Mat, Mat, int, int, double, double, double, double, double, double)>(); - ffi.Pointer IlluminationChange( - Mat src, - Mat mask, - Mat dst, - double alpha, - double beta, + 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 _IlluminationChange( - src, - mask, - dst, - alpha, - beta, - ); - } - - late final _IlluminationChangePtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - Mat, Mat, Mat, ffi.Float, ffi.Float)>>('IlluminationChange'); - late final _IlluminationChange = _IlluminationChangePtr.asFunction< + 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, + Mat dst, + double alpha, + double beta, + ) { + return _IlluminationChange( + src, + mask, + dst, + alpha, + beta, + ); + } + + late final _IlluminationChangePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, Mat, ffi.Float, ffi.Float)>>('IlluminationChange'); + late final _IlluminationChange = _IlluminationChangePtr.asFunction< ffi.Pointer Function(Mat, Mat, Mat, double, double)>(); ffi.Pointer Image_IMDecode( @@ -7406,6 +9100,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, @@ -7422,6 +9137,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, ) { @@ -8172,6 +9904,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, ) { @@ -8381,6 +10141,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, @@ -8404,6 +10194,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, @@ -8427,6 +10241,30 @@ class CvNative { late final _LogPolar = _LogPolarPtr.asFunction< ffi.Pointer Function(Mat, Mat, Point2f, double, int)>(); + 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, ) { @@ -8545,6 +10383,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, @@ -8579,67 +10463,196 @@ class CvNative { late final _Mat_AccumulateSquareWithMask = _Mat_AccumulateSquareWithMaskPtr .asFunction Function(Mat, Mat, Mat)>(); - ffi.Pointer Mat_AccumulateWithMask( + ffi.Pointer Mat_AccumulateSquareWithMask_Async( Mat src, Mat dst, Mat mask, + CvCallback_0 callback, ) { - return _Mat_AccumulateWithMask( + return _Mat_AccumulateSquareWithMask_Async( src, dst, mask, + callback, ); } - late final _Mat_AccumulateWithMaskPtr = _lookup< - ffi.NativeFunction Function(Mat, Mat, Mat)>>( - 'Mat_AccumulateWithMask'); - late final _Mat_AccumulateWithMask = _Mat_AccumulateWithMaskPtr.asFunction< - ffi.Pointer Function(Mat, Mat, Mat)>(); + 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_AccumulatedWeighted( + ffi.Pointer Mat_AccumulateSquare_Async( Mat src, Mat dst, - double alpha, + CvCallback_0 callback, ) { - return _Mat_AccumulatedWeighted( + return _Mat_AccumulateSquare_Async( src, dst, - alpha, + callback, ); } - late final _Mat_AccumulatedWeightedPtr = _lookup< + late final _Mat_AccumulateSquare_AsyncPtr = _lookup< ffi.NativeFunction< ffi.Pointer Function( - Mat, Mat, ffi.Double)>>('Mat_AccumulatedWeighted'); - late final _Mat_AccumulatedWeighted = _Mat_AccumulatedWeightedPtr.asFunction< - ffi.Pointer Function(Mat, Mat, double)>(); + Mat, Mat, CvCallback_0)>>('Mat_AccumulateSquare_Async'); + late final _Mat_AccumulateSquare_Async = _Mat_AccumulateSquare_AsyncPtr + .asFunction Function(Mat, Mat, CvCallback_0)>(); - ffi.Pointer Mat_AccumulatedWeightedWithMask( + ffi.Pointer Mat_AccumulateWithMask( Mat src, Mat dst, - double alpha, Mat mask, ) { - return _Mat_AccumulatedWeightedWithMask( + return _Mat_AccumulateWithMask( src, dst, - alpha, mask, ); } - late final _Mat_AccumulatedWeightedWithMaskPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - Mat, Mat, ffi.Double, Mat)>>('Mat_AccumulatedWeightedWithMask'); - late final _Mat_AccumulatedWeightedWithMask = - _Mat_AccumulatedWeightedWithMaskPtr.asFunction< - ffi.Pointer Function(Mat, Mat, double, Mat)>(); + late final _Mat_AccumulateWithMaskPtr = _lookup< + ffi.NativeFunction Function(Mat, Mat, Mat)>>( + 'Mat_AccumulateWithMask'); + late final _Mat_AccumulateWithMask = _Mat_AccumulateWithMaskPtr.asFunction< + ffi.Pointer Function(Mat, Mat, Mat)>(); - ffi.Pointer Mat_Add( - Mat src1, + 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, + double alpha, + ) { + return _Mat_AccumulatedWeighted( + src, + dst, + alpha, + ); + } + + late final _Mat_AccumulatedWeightedPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, ffi.Double)>>('Mat_AccumulatedWeighted'); + late final _Mat_AccumulatedWeighted = _Mat_AccumulatedWeightedPtr.asFunction< + ffi.Pointer Function(Mat, Mat, double)>(); + + ffi.Pointer Mat_AccumulatedWeightedWithMask( + Mat src, + Mat dst, + double alpha, + Mat mask, + ) { + return _Mat_AccumulatedWeightedWithMask( + src, + dst, + alpha, + mask, + ); + } + + late final _Mat_AccumulatedWeightedWithMaskPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, Mat, ffi.Double, Mat)>>('Mat_AccumulatedWeightedWithMask'); + late final _Mat_AccumulatedWeightedWithMask = + _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, Mat dst, ) { @@ -13394,6 +15407,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, @@ -13417,6 +15454,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, @@ -13435,6 +15495,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, ) { @@ -13523,6 +15602,23 @@ class CvNative { late final _MinAreaRect = _MinAreaRectPtr.asFunction< ffi.Pointer Function(VecPoint, ffi.Pointer)>(); + ffi.Pointer MinAreaRect_Async( + VecPoint pts, + 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, @@ -13543,6 +15639,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, @@ -13562,6 +15675,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, ) { @@ -13577,6 +15709,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, @@ -13628,6 +15775,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, @@ -15215,6 +17414,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, @@ -15260,14 +17480,35 @@ class CvNative { ffi.Pointer Function( VecPoint, Point2f, bool, ffi.Pointer)>(); - ffi.Pointer Polylines( - Mat img, - VecVecPoint points, - bool isClosed, - Scalar color, - int thickness, - ) { - return _Polylines( + 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, + bool isClosed, + Scalar color, + int thickness, + ) { + return _Polylines( img, points, isClosed, @@ -15283,6 +17524,32 @@ class CvNative { late final _Polylines = _PolylinesPtr.asFunction< ffi.Pointer Function(Mat, VecVecPoint, bool, Scalar, int)>(); + ffi.Pointer Polylines_Async( + Mat img, + VecVecPoint points, + bool isClosed, + Scalar color, + int thickness, + CvCallback_0 callback, + ) { + return _Polylines_Async( + img, + points, + isClosed, + color, + thickness, + callback, + ); + } + + late final _Polylines_AsyncPtr = _lookup< + ffi.NativeFunction< + 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, VecVecPoint, bool, Scalar, int, CvCallback_0)>(); + ffi.Pointer Prim_from_Circle( Point center, Scalar color, @@ -15570,6 +17837,86 @@ class CvNative { ffi.Pointer Function(Mat, ffi.Pointer, Point, int, double, Scalar, int, int, bool)>(); + ffi.Pointer PutTextWithParams_Async( + Mat img, + ffi.Pointer text, + Point org, + int fontFace, + double fontScale, + Scalar color, + int thickness, + int lineType, + bool bottomLeftOrigin, + CvCallback_0 callback, + ) { + return _PutTextWithParams_Async( + img, + text, + org, + fontFace, + fontScale, + color, + thickness, + lineType, + bottomLeftOrigin, + callback, + ); + } + + 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 PutText_Async( + Mat img, + ffi.Pointer text, + Point org, + int fontFace, + double fontScale, + Scalar color, + int thickness, + CvCallback_0 callback, + ) { + return _PutText_Async( + img, + text, + org, + fontFace, + fontScale, + color, + thickness, + callback, + ); + } + + late final _PutText_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + Mat, + 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 PyrDown( Mat src, Mat dst, @@ -15590,6 +17937,27 @@ class CvNative { late final _PyrDown = _PyrDownPtr.asFunction< ffi.Pointer Function(Mat, Mat, Size, int)>(); + ffi.Pointer PyrDown_Async( + Mat src, + Size dstsize, + int borderType, + CvCallback_1 callback, + ) { + return _PyrDown_Async( + src, + dstsize, + borderType, + callback, + ); + } + + late final _PyrDown_AsyncPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + 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 PyrUp( Mat src, Mat dst, @@ -15610,6 +17978,27 @@ class CvNative { late final _PyrUp = _PyrUpPtr.asFunction< ffi.Pointer Function(Mat, Mat, Size, int)>(); + ffi.Pointer PyrUp_Async( + Mat src, + Size dstsize, + int borderType, + CvCallback_1 callback, + ) { + return _PyrUp_Async( + src, + dstsize, + borderType, + callback, + ); + } + + late final _PyrUp_AsyncPtr = _lookup< + ffi.NativeFunction< + 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)>(); + void QRCodeDetector_Close( QRCodeDetectorPtr self, ) { @@ -16339,6 +18728,58 @@ class CvNative { late final _RectangleWithParams = _RectangleWithParamsPtr.asFunction< ffi.Pointer Function(Mat, Rect, Scalar, int, int, int)>(); + ffi.Pointer RectangleWithParams_Async( + Mat img, + Rect rect, + Scalar color, + int thickness, + int lineType, + int shift, + CvCallback_0 callback, + ) { + return _RectangleWithParams_Async( + img, + rect, + color, + thickness, + lineType, + shift, + callback, + ); + } + + 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( + Mat, Rect, Scalar, int, int, int, CvCallback_0)>(); + + ffi.Pointer Rectangle_Async( + Mat img, + Rect rect, + Scalar color, + int thickness, + CvCallback_0 callback, + ) { + return _Rectangle_Async( + img, + rect, + color, + thickness, + callback, + ); + } + + late final _Rectangle_AsyncPtr = _lookup< + ffi.NativeFunction< + 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 Remap( Mat src, Mat dst, @@ -16366,6 +18807,34 @@ class CvNative { late final _Remap = _RemapPtr.asFunction< ffi.Pointer Function(Mat, Mat, Mat, Mat, int, int, Scalar)>(); + ffi.Pointer Remap_Async( + Mat src, + Mat map1, + Mat map2, + int interpolation, + int borderMode, + Scalar borderValue, + CvCallback_1 callback, + ) { + return _Remap_Async( + src, + map1, + map2, + interpolation, + borderMode, + borderValue, + callback, + ); + } + + late final _Remap_AsyncPtr = _lookup< + ffi.NativeFunction< + 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 Resize( Mat src, Mat dst, @@ -16391,6 +18860,32 @@ class CvNative { late final _Resize = _ResizePtr.asFunction< ffi.Pointer Function(Mat, Mat, Size, double, double, int)>(); + ffi.Pointer Resize_Async( + Mat src, + Size sz, + double fx, + double fy, + int interp, + CvCallback_1 callback, + ) { + return _Resize_Async( + src, + sz, + fx, + fy, + interp, + callback, + ); + } + + late final _Resize_AsyncPtr = _lookup< + ffi.NativeFunction< + 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)>(); + void Rng_Close( RNGPtr rng, ) { @@ -16693,6 +19188,36 @@ class CvNative { 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, @@ -16748,10 +19273,40 @@ class CvNative { ffi.Pointer Function( Mat, Mat, int, Mat, Mat, Point, double, int)>(); - ffi.Pointer SetNumThreads( - int n, + ffi.Pointer SepFilter2D_Async( + Mat src, + int ddepth, + Mat kernelX, + Mat kernelY, + Point anchor, + double delta, + int borderType, + CvCallback_1 callback, ) { - return _SetNumThreads( + 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, ); } @@ -16897,6 +19452,46 @@ class CvNative { 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, @@ -16920,6 +19515,27 @@ class CvNative { 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, @@ -16941,6 +19557,27 @@ class CvNative { 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( PtrStitcherPtr stitcher, ) { @@ -17402,6 +20039,22 @@ class CvNative { 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, @@ -17424,6 +20077,25 @@ class CvNative { 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, @@ -17446,6 +20118,25 @@ class CvNative { 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, @@ -17471,6 +20162,26 @@ class CvNative { 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, @@ -17515,6 +20226,44 @@ class CvNative { 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, @@ -17533,6 +20282,24 @@ class CvNative { _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, @@ -17556,6 +20323,24 @@ class CvNative { 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, @@ -17581,6 +20366,26 @@ class CvNative { 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, @@ -17607,6 +20412,26 @@ class CvNative { 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, @@ -17623,6 +20448,26 @@ class CvNative { 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, @@ -17660,6 +20505,45 @@ class CvNative { 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, @@ -17688,6 +20572,25 @@ class CvNative { 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, ) { @@ -17703,6 +20606,20 @@ class CvNative { 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, @@ -17720,6 +20637,23 @@ class CvNative { 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, @@ -17739,27 +20673,68 @@ class CvNative { 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( + 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, - rval, + callback, ); } - late final _Subdiv2D_RotateEdgePtr = _lookup< + late final _Subdiv2D_RotateEdge_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)>(); + 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, @@ -17780,6 +20755,25 @@ class CvNative { 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, @@ -17845,6 +20839,29 @@ class CvNative { 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, @@ -19835,6 +22852,107 @@ class CvNative { 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, @@ -19936,6 +23054,107 @@ class CvNative { 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, @@ -21029,6 +24248,56 @@ class CvNative { 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, @@ -21079,6 +24348,56 @@ class CvNative { 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, @@ -21095,6 +24414,25 @@ class CvNative { 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, ) { @@ -24313,6 +27651,20 @@ 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, @@ -24448,6 +27800,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, @@ -24630,6 +27996,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)>> @@ -24680,6 +28048,8 @@ class _SymbolAddresses { get Stitcher_Close => _library._Stitcher_ClosePtr; 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> @@ -24708,8 +28078,12 @@ class _SymbolAddresses { 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> @@ -25761,12 +29135,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/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/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 index f1a7b5ac..e69de29b 100644 --- a/scripts/pre-commit +++ b/scripts/pre-commit @@ -1,2 +0,0 @@ -#!/bin/sh -exec dart format --fix --set-exit-if-changed -l 110 . diff --git a/src/core/types.h b/src/core/types.h index c9f16e16..75b559fe 100644 --- a/src/core/types.h +++ b/src/core/types.h @@ -115,6 +115,8 @@ 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 { \ @@ -147,6 +149,8 @@ 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 diff --git a/src/core/vec.cpp b/src/core/vec.cpp index 8877b8a2..b949bdf5 100644 --- a/src/core/vec.cpp +++ b/src/core/vec.cpp @@ -4,77 +4,65 @@ #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); ; } -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++) { @@ -85,111 +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); ; } -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); } -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++) { @@ -200,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); } -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); } -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++) { @@ -258,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++) { @@ -313,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); } -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); } -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]; @@ -477,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); } -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); @@ -510,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()); @@ -527,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); } -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); } -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); } -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); } -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); } -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++) { @@ -793,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); } -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++) { @@ -847,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); } -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++) { @@ -901,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); } -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++) { @@ -955,56 +814,48 @@ 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) -{ +void VecVecDMatch_Close(VecVecDMatchPtr vec) { vec->ptr->clear(); CVD_FREE(vec); } -CvStatus *VecVec4i_New(VecVec4i *rval) -{ +CvStatus *VecVec4i_New(VecVec4i *rval) { BEGIN_WRAP *rval = {new std::vector()}; END_WRAP } -CvStatus *VecVec4i_NewFromPointer(Vec4i *data, int length, VecVec4i *rval) -{ +CvStatus *VecVec4i_NewFromPointer(Vec4i *data, int length, VecVec4i *rval) { BEGIN_WRAP std::vector vec; for (int i = 0; i < length; i++) { @@ -1021,27 +872,99 @@ CvStatus *VecVec4i_NewFromPointer(Vec4i *data, int length, VecVec4i *rval) // END_WRAP // } -CvStatus *VecVec4i_At(VecVec4i vec, int idx, Vec4i *rval) -{ +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) -{ +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) -{ +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); +} + +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 VecVec4i_Close(VecVec4iPtr vec) -{ +void VecVec6f_Close(VecVec6fPtr vec) { vec->ptr->clear(); CVD_FREE(vec); } diff --git a/src/core/vec.h b/src/core/vec.h index 19fe82e8..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,7 @@ 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); @@ -184,7 +184,25 @@ 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); +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/imgproc/imgproc.cpp b/src/imgproc/imgproc.cpp index 92b55bf7..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 diff --git a/src/imgproc/imgproc.h b/src/imgproc/imgproc.h index 7cbb075e..7b5e458d 100644 --- a/src/imgproc/imgproc.h +++ b/src/imgproc/imgproc.h @@ -29,9 +29,11 @@ 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 index 1a6abd0c..57724077 100644 --- a/src/imgproc/imgproc_async.cpp +++ b/src/imgproc/imgproc_async.cpp @@ -1,8 +1,49 @@ #include "imgproc_async.h" -#include "opencv2/imgproc.hpp" +#include "core/types.h" +#include "opencv2/core/mat.hpp" +#include "opencv2/core/matx.hpp" +#include "utils.hpp" +#include +#include -CvStatus *CvtColor_Async(Mat src, int code, CVD_OUT CvCallback_1 callback) -{ +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); @@ -10,11 +51,1510 @@ CvStatus *CvtColor_Async(Mat src, int code, CVD_OUT CvCallback_1 callback) END_WRAP } -CvStatus *GaussianBlur_Async(Mat src, Size ps, double sX, double sY, int bt, CVD_OUT CvCallback_1 callback) -{ +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 index a129c9fd..62786466 100644 --- a/src/imgproc/imgproc_async.h +++ b/src/imgproc/imgproc_async.h @@ -7,12 +7,468 @@ #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 *GaussianBlur_Async(Mat src, Size ps, double sX, double sY, int bt, 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 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/test/core/core_test.dart b/test/core/core_test.dart index 6bf82dbb..89b28fb9 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', () { diff --git a/test/imgproc/clahe_test.dart b/test/imgproc/clahe_test.dart index ab0ad0e7..08a7165a 100644 --- a/test/imgproc/clahe_test.dart +++ b/test/imgproc/clahe_test.dart @@ -2,11 +2,19 @@ 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).cvd; 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 7301be1b..da387f13 100644 --- a/test/imgproc/imgproc_test.dart +++ b/test/imgproc/imgproc_test.dart @@ -1,5 +1,3 @@ -import 'dart:math'; - import 'package:opencv_dart/opencv_dart.dart' as cv; import 'package:test/test.dart'; @@ -62,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); }); 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); + } + }); }