Consider transformation matrix when extracting PDF images
Open, NormalPublic

Description

  • SAS barcodes seem to be flipped (which is enough to break PDF417 decoding)
  • EW produces some very distorted aztec codes

GfxState::ctm has the transformation, applying that to the extracted image should fix that.

vkrause created this task.May 24 2018, 6:50 PM
vkrause triaged this task as Normal priority.
  • a/src/extractorengine.cpp

+++ b/src/extractorengine.cpp
@@ -145,7 +145,11 @@ QString BarcodeJsApi::decodePdf417(const QVariant &img) const

      tf.rotate(-90);
     image = image.transformed(tf);
}
  • return BarcodeDecoder::decodePdf417(image);

+ QString value = BarcodeDecoder::decodePdf417(image);
+ if (!value.isEmpty()) {
+ return value;
+ }
+ return BarcodeDecoder::decodePdf417(image.mirrored(false,true));

}
return {};

}

Yep. This gives me results. but.

Implemented, but it only fixes the EW case. SAS actually displays the codes flipped in the PDF, so this needs to be fixed on the barcode decoder level. Adding a new ticket for that.

vkrause moved this task from Actionable to Done on the KDE Itinerary board.Jun 25 2018, 4:56 PM