decode method

(String, VecPoint?, Mat?) decode(
  1. InputArray img, {
  2. VecPoint? points,
  3. Mat? straightCode,
})

Decode decodes QR code in image once it's found by the detect() method. Returns UTF8-encoded output string or empty string if the code cannot be decoded.

For further details, please see: https://docs.opencv.org/master/de/dc3/classcv_1_1QRCodeDetector.html#a4172c2eb4825c844fb1b0ae67202d329

Implementation

(String ret, VecPoint? points, Mat? straightCode) decode(
  InputArray img, {
  VecPoint? points,
  Mat? straightCode,
}) {
  final p = points?.ptr ?? calloc<cvg.VecPoint>();
  final ret = calloc<ffi.Pointer<ffi.Char>>();
  straightCode ??= Mat.empty();
  cvRun(() => cffi.QRCodeDetector_Decode(ref, img.ref, p, straightCode!.ref, ret));
  final info = ret.value.cast<Utf8>().toDartString();
  calloc.free(ret);
  return (info, VecPoint.fromPointer(p), straightCode);
}