This closes Issue 490.
git-svn-id: http://zxing.googlecode.com/svn/trunk@1507
59b500cc-1b3d-0410-9834-
0bbf25fbcc57
// 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 {
+ average = max == 0 ? 1 : (min >> 1);
+ }
blackPoints[y * subWidth + x] = average;
}
}