C++ port: add changes to HybridBinarizer

This closes Issue 490.

git-svn-id: https://zxing.googlecode.com/svn/trunk@1507 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
flyashi 2010-08-04 14:09:09 +00:00
parent 313fc8e90e
commit 17b9952822

View file

@ -129,7 +129,12 @@ int* HybridBinarizer::calculateBlackPoints(unsigned char* luminances, int subWid
// 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;
}
}