DetectionResultRowIndicatorColumn.java (zxing-zxing-3.4.1) | : | DetectionResultRowIndicatorColumn.java (zxing-zxing-3.5.0) | ||
---|---|---|---|---|
skipping to change at line 67 | skipping to change at line 67 | |||
//float averageRowHeight = (lastRow - firstRow) / (float) barcodeMetadata.ge tRowCount(); | //float averageRowHeight = (lastRow - firstRow) / (float) barcodeMetadata.ge tRowCount(); | |||
int barcodeRow = -1; | int barcodeRow = -1; | |||
int maxRowHeight = 1; | int maxRowHeight = 1; | |||
int currentRowHeight = 0; | int currentRowHeight = 0; | |||
for (int codewordsRow = firstRow; codewordsRow < lastRow; codewordsRow++) { | for (int codewordsRow = firstRow; codewordsRow < lastRow; codewordsRow++) { | |||
if (codewords[codewordsRow] == null) { | if (codewords[codewordsRow] == null) { | |||
continue; | continue; | |||
} | } | |||
Codeword codeword = codewords[codewordsRow]; | Codeword codeword = codewords[codewordsRow]; | |||
// float expectedRowNumber = (codewordsRow - firstRow) / averageRowHe | ||||
ight; | ||||
// if (Math.abs(codeword.getRowNumber() - expectedRowNumber) > 2) { | ||||
// SimpleLog.log(LEVEL.WARNING, | ||||
// "Removing codeword, rowNumberSkew too high, codeword[" + cod | ||||
ewordsRow + "]: Expected Row: " + | ||||
// expectedRowNumber + ", RealRow: " + codeword.getRowNumbe | ||||
r() + ", value: " + codeword.getValue()); | ||||
// codewords[codewordsRow] = null; | ||||
// } | ||||
int rowDifference = codeword.getRowNumber() - barcodeRow; | int rowDifference = codeword.getRowNumber() - barcodeRow; | |||
// TODO improve handling with case where first row indicator doesn't start with 0 | // TODO improve handling with case where first row indicator doesn't start with 0 | |||
if (rowDifference == 0) { | if (rowDifference == 0) { | |||
currentRowHeight++; | currentRowHeight++; | |||
} else if (rowDifference == 1) { | } else if (rowDifference == 1) { | |||
maxRowHeight = Math.max(maxRowHeight, currentRowHeight); | maxRowHeight = Math.max(maxRowHeight, currentRowHeight); | |||
currentRowHeight = 1; | currentRowHeight = 1; | |||
barcodeRow = codeword.getRowNumber(); | barcodeRow = codeword.getRowNumber(); | |||
skipping to change at line 210 | skipping to change at line 202 | |||
barcodeColumnCount.setValue(rowIndicatorValue + 1); | barcodeColumnCount.setValue(rowIndicatorValue + 1); | |||
break; | break; | |||
} | } | |||
} | } | |||
// Maybe we should check if we have ambiguous values? | // Maybe we should check if we have ambiguous values? | |||
if ((barcodeColumnCount.getValue().length == 0) || | if ((barcodeColumnCount.getValue().length == 0) || | |||
(barcodeRowCountUpperPart.getValue().length == 0) || | (barcodeRowCountUpperPart.getValue().length == 0) || | |||
(barcodeRowCountLowerPart.getValue().length == 0) || | (barcodeRowCountLowerPart.getValue().length == 0) || | |||
(barcodeECLevel.getValue().length == 0) || | (barcodeECLevel.getValue().length == 0) || | |||
barcodeColumnCount.getValue()[0] < 1 || | barcodeColumnCount.getValue()[0] < 1 || | |||
barcodeRowCountUpperPart.getValue()[0] + barcodeRowCountLowerPart.getVal | barcodeRowCountUpperPart.getValue()[0] + barcodeRowCountLowerPart.getVal | |||
ue()[0] < PDF417Common.MIN_ROWS_IN_BARCODE || | ue()[0] < | |||
barcodeRowCountUpperPart.getValue()[0] + barcodeRowCountLowerPart.getVal | PDF417Common.MIN_ROWS_IN_BARCODE || | |||
ue()[0] > PDF417Common.MAX_ROWS_IN_BARCODE) { | barcodeRowCountUpperPart.getValue()[0] + barcodeRowCountLowerPart.getVal | |||
ue()[0] > | ||||
PDF417Common.MAX_ROWS_IN_BARCODE) { | ||||
return null; | return null; | |||
} | } | |||
BarcodeMetadata barcodeMetadata = new BarcodeMetadata(barcodeColumnCount.get Value()[0], | BarcodeMetadata barcodeMetadata = new BarcodeMetadata(barcodeColumnCount.get Value()[0], | |||
barcodeRowCountUpperPart.getValue()[0], barcodeRowCountLowerPart.getValu e()[0], barcodeECLevel.getValue()[0]); | barcodeRowCountUpperPart.getValue()[0], barcodeRowCountLowerPart.getValu e()[0], barcodeECLevel.getValue()[0]); | |||
removeIncorrectCodewords(codewords, barcodeMetadata); | removeIncorrectCodewords(codewords, barcodeMetadata); | |||
return barcodeMetadata; | return barcodeMetadata; | |||
} | } | |||
private void removeIncorrectCodewords(Codeword[] codewords, BarcodeMetadata ba rcodeMetadata) { | private void removeIncorrectCodewords(Codeword[] codewords, BarcodeMetadata ba rcodeMetadata) { | |||
// Remove codewords which do not match the metadata | // Remove codewords which do not match the metadata | |||
End of changes. 2 change blocks. | ||||
15 lines changed or deleted | 6 lines changed or added |