fromFileAsync static method

Future<VideoCapture> fromFileAsync(
  1. String filename, {
  2. int apiPreference = CAP_ANY,
})

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

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

Implementation

static Future<VideoCapture> fromFileAsync(String filename, {int apiPreference = CAP_ANY}) async {
  final p = calloc<cvg.VideoCapture>();
  final cname = filename.toNativeUtf8().cast<ffi.Char>();
  return cvRunAsync0(
    (callback) => cvideoio.cv_VideoCapture_create_1(cname, apiPreference, p, callback),
    (c) {
      calloc.free(cname);
      return c.complete(VideoCapture.fromPointer(p));
    },
  );
}