1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
From 68c5727ba30bccf93056f8d19ba9cfc55994f2b5 Mon Sep 17 00:00:00 2001
From: axxel <awagger@gmail.com>
Date: Fri, 25 Apr 2025 21:22:10 +0200
Subject: [PATCH] ITF: actually check what the comment already said (both quiet
zone sizes)
This should fix the issue with a cropped left quiet zone reported by
@synedra-mpe here: https://github.com/zxing-cpp/zxing-cpp/issues/869#issuecomment-2830261819
Modified in Debian to delete files from test/samples/ directory.
---
core/src/oned/ODITFReader.cpp | 4 ++--
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/core/src/oned/ODITFReader.cpp b/core/src/oned/ODITFReader.cpp
index 5de056da30..a8c505d2c5 100644
--- a/core/src/oned/ODITFReader.cpp
+++ b/core/src/oned/ODITFReader.cpp
@@ -72,8 +72,8 @@ Barcode ITFReader::decodePattern(int rowNumber, PatternView& next, std::unique_p
|| next[0] < threshold[0] || next[1] > threshold[1] || next[2] > threshold[2])
return {};
- // Check quiet zone size (full quiet zone or cropped on both ends)
- if (!(next[3] > minQuietZone * (threshold.bar + threshold.space) / 3
+ // Check quiet zone size (full quiet zone on both ends or cropped on both ends)
+ if (!(std::min((int)next[3], xStart) > minQuietZone * (threshold.bar + threshold.space) / 3
|| (next.isAtLastBar() && startsAtFirstBar && std::max(xStart, (int)next[3]) < 2 * std::min(xStart, (int)next[3]) + 2)))
return {};
|