Net.fromFile constructor

Net.fromFile(
  1. String path, {
  2. String config = "",
  3. String framework = "",
})

Read deep learning network represented in one of the supported formats.

https://docs.opencv.org/4.x/d6/d0f/group__dnn.html#ga4823489a689bf4edfae7447eb807b067

Implementation

factory Net.fromFile(String path, {String config = "", String framework = ""}) {
  final cPath = path.toNativeUtf8().cast<ffi.Char>();
  final cConfig = config.toNativeUtf8().cast<ffi.Char>();
  final cFramework = framework.toNativeUtf8().cast<ffi.Char>();
  final p = calloc<cvg.Net>();
  cvRun(() => cdnn.cv_dnn_Net_readNet(cPath, cConfig, cFramework, p, ffi.nullptr));
  calloc.free(cPath);
  calloc.free(cConfig);
  calloc.free(cFramework);
  final net = Net._(p);
  return net;
}