mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Fixed the result points for 1D decoding so that we once again get a green line in the Android client across the successful row.
git-svn-id: https://zxing.googlecode.com/svn/trunk@335 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
0e2defcf66
commit
f299f413e0
|
@ -102,12 +102,10 @@ public abstract class AbstractUPCEANReader extends AbstractOneDReader implements
|
||||||
return decodeRow(rowNumber, row, findStartGuardPattern(row));
|
return decodeRow(rowNumber, row, findStartGuardPattern(row));
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Result decodeRow(int rowNumber, BitArray row, int[] startGuardRange) throws ReaderException {
|
public final Result decodeRow(int rowNumber, BitArray row, int[] startGuardRange)
|
||||||
|
throws ReaderException {
|
||||||
StringBuffer result = new StringBuffer();
|
StringBuffer result = new StringBuffer();
|
||||||
|
|
||||||
int endStart = decodeMiddle(row, startGuardRange, result);
|
int endStart = decodeMiddle(row, startGuardRange, result);
|
||||||
|
|
||||||
int[] endRange = decodeEnd(row, endStart);
|
int[] endRange = decodeEnd(row, endStart);
|
||||||
|
|
||||||
// Check for whitespace after the pattern
|
// Check for whitespace after the pattern
|
||||||
|
@ -121,12 +119,13 @@ public abstract class AbstractUPCEANReader extends AbstractOneDReader implements
|
||||||
throw new ReaderException("Checksum failed");
|
throw new ReaderException("Checksum failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Result(
|
float left = (float) (startGuardRange[1] + startGuardRange[0]) / 2.0f;
|
||||||
resultString,
|
float right = (float) (endRange[1] + endRange[0]) / 2.0f;
|
||||||
|
return new Result(resultString,
|
||||||
null, // no natural byte representation for these barcodes
|
null, // no natural byte representation for these barcodes
|
||||||
new ResultPoint[]{
|
new ResultPoint[]{
|
||||||
new GenericResultPoint((float) (startGuardRange[1] - startGuardRange[0]) / 2.0f, (float) rowNumber),
|
new GenericResultPoint(left, (float) rowNumber),
|
||||||
new GenericResultPoint((float) (endRange[1] - endRange[0]) / 2.0f, (float) rowNumber)},
|
new GenericResultPoint(right, (float) rowNumber)},
|
||||||
getBarcodeFormat());
|
getBarcodeFormat());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,10 +240,8 @@ public abstract class AbstractUPCEANReader extends AbstractOneDReader implements
|
||||||
* @return horizontal offset of first pixel beyond the decoded digit
|
* @return horizontal offset of first pixel beyond the decoded digit
|
||||||
* @throws ReaderException if digit cannot be decoded
|
* @throws ReaderException if digit cannot be decoded
|
||||||
*/
|
*/
|
||||||
static int decodeDigit(BitArray row,
|
static int decodeDigit(BitArray row, int[] counters, int rowOffset, int[][] patterns)
|
||||||
int[] counters,
|
throws ReaderException {
|
||||||
int rowOffset,
|
|
||||||
int[][] patterns) throws ReaderException {
|
|
||||||
recordPattern(row, rowOffset, counters);
|
recordPattern(row, rowOffset, counters);
|
||||||
float bestVariance = MAX_VARIANCE; // worst variance we'll accept
|
float bestVariance = MAX_VARIANCE; // worst variance we'll accept
|
||||||
int bestMatch = -1;
|
int bestMatch = -1;
|
||||||
|
|
Loading…
Reference in a new issue