Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KItinerary
Commits
59c11b4f
Commit
59c11b4f
authored
Dec 19, 2020
by
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
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/barcodedecoder.cpp
View file @
59c11b4f
...
...
@@ -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
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment