mirror of
https://github.com/zxing/zxing.git
synced 2024-11-10 13:04:05 -08:00
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:
parent
313fc8e90e
commit
17b9952822
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue