mirror of
https://github.com/zxing/zxing.git
synced 2024-11-09 20:44:03 -08:00
Check fewer lines, and make sure we don't run off the top/bottom of image
git-svn-id: https://zxing.googlecode.com/svn/trunk@175 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
bd4ec5e4d8
commit
51bb41ed24
|
@ -51,12 +51,15 @@ public abstract class AbstractOneDReader implements OneDReader {
|
|||
// rowStep is bigger as the image is taller, but is always at least 1. We've somewhat arbitrarily decided
|
||||
// that moving up and down by about 1/16 of the image is pretty good.
|
||||
int middle = height >> 1;
|
||||
int rowStep = Math.max(1, height >> 5);
|
||||
for (int x = 0; x < 11; x++) {
|
||||
int rowStep = Math.max(1, height >> 4);
|
||||
for (int x = 0; x < 7; x++) {
|
||||
|
||||
int rowStepsAboveOrBelow = (x + 1) >> 1;
|
||||
boolean isAbove = (x & 0x01) == 0; // i.e. is x even?
|
||||
int rowNumber = middle + rowStep * (isAbove ? rowStepsAboveOrBelow : -rowStepsAboveOrBelow);
|
||||
if (rowNumber < 0 || rowNumber >= height) {
|
||||
break;
|
||||
}
|
||||
|
||||
image.estimateBlackPoint(BlackPointEstimationMethod.ROW_SAMPLING, rowNumber);
|
||||
image.getBlackRow(rowNumber, row, 0, width);
|
||||
|
|
Loading…
Reference in a new issue