[SCM] Multi-format 1D/2D barcode image processing library branch, upstream, updated. 24d4480bc48cf9eabf7b2bd2f528248b0e458809
srowen
srowen at 59b500cc-1b3d-0410-9834-0bbf25fbcc57
Wed Aug 4 01:32:40 UTC 2010
The following commit has been merged in the upstream branch:
commit 54a89db329bd598c2013a82d8c37dc653d98d697
Author: srowen <srowen at 59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Date: Sat Jul 31 15:07:16 2010 +0000
Issue 469 -- tweak to special case of all-black 8x8 region. Parse it as black. Other near-uniform regions remain parsed as all white.
git-svn-id: http://zxing.googlecode.com/svn/trunk@1500 59b500cc-1b3d-0410-9834-0bbf25fbcc57
diff --git a/core/src/com/google/zxing/common/HybridBinarizer.java b/core/src/com/google/zxing/common/HybridBinarizer.java
index e6a6952..e3eb0a2 100644
--- a/core/src/com/google/zxing/common/HybridBinarizer.java
+++ b/core/src/com/google/zxing/common/HybridBinarizer.java
@@ -148,7 +148,13 @@ public final class HybridBinarizer extends GlobalHistogramBinarizer {
// If the contrast is inadequate, use half the minimum, so that this block will be
// treated as part of the white background, but won't drag down neighboring blocks
// too much.
- int average = (max - min > 24) ? (sum >> 6) : (min >> 1);
+ int average;
+ if (max - min > 24) {
+ average = sum >> 6;
+ } else {
+ // When min == max == 0, let average be 1 so all is black
+ average = max == 0 ? 1 : min >> 1;
+ }
blackPoints[y][x] = average;
}
}
--
Multi-format 1D/2D barcode image processing library
More information about the Pkg-google-commits
mailing list