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}) {
  return using<Net>((arena) {
    bufferConfig ??= Uint8List(0);
    final cFramework = framework.toNativeUtf8(allocator: arena).cast<ffi.Char>();
    final bufM = VecUChar.fromList(bufferModel);
    final bufC = VecUChar.fromList(bufferConfig!);
    final p = calloc<cdnn.Net>();
    cvRun(() => cdnn.Net_ReadNetBytes(cFramework, bufM.ref, bufC.ref, p));
    final net = Net._(p);
    return net;
  });
}