Net.fromBytes constructor

Net.fromBytes(
  1. String framework,
  2. Uint8List bufferModel, {
  3. Uint8List? bufferConfig,
})

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

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/d6/d0f/group__dnn.html#ga138439da76f26266fdefec9723f6c5cd

Implementation

factory Net.fromBytes(String framework, Uint8List bufferModel, {Uint8List? bufferConfig}) {
  bufferConfig ??= Uint8List(0);
  final cFramework = framework.toNativeUtf8().cast<ffi.Char>();
  final bufM = VecUChar.fromList(bufferModel);
  final bufC = VecUChar.fromList(bufferConfig);
  final p = calloc<cvg.Net>();
  cvRun(() => cdnn.cv_dnn_Net_readNetBytes(cFramework, bufM.ref, bufC.ref, p, ffi.nullptr));
  calloc.free(cFramework);
  final net = Net._(p);
  return net;
}