imwriteAsync function
Implementation
Future<bool> imwriteAsync(String filename, InputArray img, {VecI32? params}) async {
final fname = filename.toNativeUtf8().cast<ffi.Char>();
final p = calloc<ffi.Bool>();
void completeFunc(Completer<bool> c) {
final rval = p.value;
calloc.free(p);
return c.complete(rval);
}
if (params == null) {
return cvRunAsync0(
(callback) => cimgcodecs.cv_imwrite(fname.cast(), img.ref, p, callback),
completeFunc,
);
}
return cvRunAsync0(
(callback) => cimgcodecs.cv_imwrite_1(fname.cast(), img.ref, params.ref, p, callback),
completeFunc,
);
}