openAsync method

Future<bool> openAsync(
  1. String uri, {
  2. int apiPreference = CAP_ANY,
})

Opens a video file or a capturing device or an IP video stream for video capturing with API Preference and parameters.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

https://docs.opencv.org/4.x/d8/dfe/classcv_1_1VideoCapture.html#aa6480e6972ef4c00d74814ec841a2939

Implementation

Future<bool> openAsync(String uri, {int apiPreference = CAP_ANY}) async {
  final cname = uri.toNativeUtf8().cast<ffi.Char>();
  final success = calloc<ffi.Bool>();
  return cvRunAsync0(
    (callback) => cvideoio.cv_VideoCapture_open_1(ref, cname, apiPreference, success, callback),
    (c) {
      final rval = success.value;
      calloc.free(cname);
      calloc.free(success);
      return c.complete(rval);
    },
  );
}