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 cname = filename.toNativeUtf8().cast<ffi.Char>();
  final rval = cvRunAsync<VideoCapture>(
    (callback) => cvideo.VideoCapture_NewFromFile_Async(cname, apiPreference, callback),
    (completer, p) => completer.complete(VideoCapture.fromPointer(p.cast<cvideo.VideoCapture>())),
  );
  calloc.free(cname);
  return rval;
}