detect static method

PDF417DetectorResult detect(
  1. BinaryBitmap image,
  2. DecodeHint? hints,
  3. bool multiple
)

Detects a PDF417 Code in an image. Checks 0, 90, 180, and 270 degree rotations.

@param image barcode image to decode @param hints optional hints to detector @param multiple if true, then the image is searched for multiple codes. If false, then at most one code will be found and returned @return PDF417DetectorResult encapsulating results of detecting a PDF417 code @throws NotFoundException if no PDF417 Code can be found

Implementation

static PDF417DetectorResult detect(
  BinaryBitmap image,
  DecodeHint? hints,
  bool multiple,
) {
  // TODO detection improvement, tryHarder could try several different luminance thresholds/blackpoints or even
  // different binarizers
  //bool tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_HARDER);

  final originalMatrix = image.blackMatrix;

  // Try 180, 270, 90 degree rotations, in that order
  for (int rotation in _rotations) {
    final bitMatrix = _applyRotation(originalMatrix, rotation);
    final barcodeCoordinates = _detect(multiple, bitMatrix);
    if (barcodeCoordinates.isNotEmpty) {
      return PDF417DetectorResult(bitMatrix, barcodeCoordinates, rotation);
    }
  }
  return PDF417DetectorResult(originalMatrix, [], 0);
}