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 = ""}) {
  return using<Net>((arena) {
    final cPath = path.toNativeUtf8(allocator: arena).cast<ffi.Char>();
    final cConfig = config.toNativeUtf8(allocator: arena).cast<ffi.Char>();
    final cFramework = framework.toNativeUtf8(allocator: arena).cast<ffi.Char>();
    final p = calloc<cdnn.Net>();
    cvRun(() => cdnn.Net_ReadNet(cPath, cConfig, cFramework, p));
    final net = Net._(p);
    return net;
  });
}