Commit 59c11b4f authored by Volker Krause's avatar Volker Krause
Browse files

Newer ZXing versions deal with rotated and flipped barcodes automatically

parent d9988482
Pipeline #44672 passed with stage
in 10 minutes and 53 seconds
......@@ -261,18 +261,23 @@ void BarcodeDecoder::decodeIfNeeded(const QImage &img, BarcodeDecoder::BarcodeTy
if (aspectRatio > 1.5 && aspectRatio < 6 && (hint & PDF417) && (result.negative & hint & PDF417) != (hint & PDF417)) {
auto normalizedImg = img;
// newer ZXing versions handle rotated/flipped codes themselves correctly
#ifndef ZXING_USE_READBARCODE
if (normalizedImg.width() < normalizedImg.height()) {
QTransform tf;
tf.rotate(-90);
normalizedImg = normalizedImg.transformed(tf);
}
#endif
decodeZxing(normalizedImg, PDF417, result);
#ifndef ZXING_USE_READBARCODE
if (result.positive & PDF417) {
return;
}
// try flipped around the x axis, zxing doesn't detect that, but it's e.g. encountered in SAS passes
result.negative &= ~PDF417;
decodeZxing(normalizedImg.transformed(QTransform{1, 0, 0, -1, 0, 0}), PDF417, result);
#endif
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment