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: https://zxing.googlecode.com/svn/trunk@1500 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2010-07-31 15:07:16 +00:00
parent 0cfc8f2ab5
commit 6b5616e7dd

View file

@ -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;
}
}