detectAndDecode method

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

DetectAndDecode Both detects and decodes QR code.

Returns true as long as some QR code was detected even in case where the decoding failed For further details, please see: https://docs.opencv.org/master/de/dc3/classcv_1_1QRCodeDetector.html#a7290bd6a5d59b14a37979c3a14fbf394

Implementation

(String ret, VecPoint points, Mat straightCode) detectAndDecode(
  InputArray img, {
  VecPoint? points,
  OutputArray? straightCode,
}) {
  final code = straightCode?.ptr ?? calloc<cobjdetect.Mat>();
  final points = calloc<cobjdetect.VecPoint>();
  final v = calloc<ffi.Pointer<ffi.Char>>();
  cvRun(() => cobjdetect.QRCodeDetector_DetectAndDecode(ref, img.ref, points, code, v));
  final s = v == ffi.nullptr ? "" : v.value.cast<Utf8>().toDartString();
  calloc.free(v);
  return (s, VecPoint.fromPointer(points), Mat.fromPointer(code));
}