mirror of
https://github.com/zxing/zxing.git
synced 2024-09-20 05:27:32 -07:00
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:
parent
0cfc8f2ab5
commit
6b5616e7dd
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue