fromBufferAsync static method

Future<FaceDetectorYN> fromBufferAsync(
  1. String framework,
  2. Uint8List bufferModel,
  3. Uint8List bufferConfig,
  4. (int, int) inputSize, {
  5. double scoreThreshold = 0.9,
  6. double nmsThreshold = 0.3,
  7. int topK = 5000,
  8. int backendId = 0,
  9. int targetId = 0,
})

Implementation

static Future<FaceDetectorYN> fromBufferAsync(
  String framework,
  Uint8List bufferModel,
  Uint8List bufferConfig,
  (int, int) inputSize, {
  double scoreThreshold = 0.9,
  double nmsThreshold = 0.3,
  int topK = 5000,
  int backendId = 0,
  int targetId = 0,
}) async {
  final cFramework = framework.toNativeUtf8().cast<ffi.Char>();
  final bufM = VecUChar.fromList(bufferModel);
  final bufC = VecUChar.fromList(bufferConfig);

  final rval = await cvRunAsync<FaceDetectorYN>(
      (callback) => cobjdetect.FaceDetectorYN_NewFromBuffer_Async(
            cFramework,
            bufM.ref,
            bufC.ref,
            inputSize.cvd.ref,
            scoreThreshold,
            nmsThreshold,
            topK,
            backendId,
            targetId,
            callback,
          ), (c, p) {
    return c.complete(FaceDetectorYN.fromPointer(p.cast<cobjdetect.FaceDetectorYN>()));
  });
  calloc.free(cFramework);
  bufM.dispose();
  bufC.dispose();

  return rval;
}