"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "core/src/main/java/com/google/zxing/pdf417/detector/Detector.java" between
zxing-zxing-3.4.1.tar.gz and zxing-zxing-3.5.0.tar.gz

About: ZXing ("zebra crossing") is a multi-format 1D/2D barcode image processing library implemented in Java, with ports to other languages. Info: Project is in maintenance mode (no active development).

Detector.java  (zxing-zxing-3.4.1):Detector.java  (zxing-zxing-3.5.0)
skipping to change at line 55 skipping to change at line 55
// B S B S B S B S Bar/Space pattern // B S B S B S B S Bar/Space pattern
// 11111111 0 1 0 1 0 1 000 // 11111111 0 1 0 1 0 1 000
private static final int[] START_PATTERN = {8, 1, 1, 1, 1, 1, 1, 3}; private static final int[] START_PATTERN = {8, 1, 1, 1, 1, 1, 1, 3};
// 1111111 0 1 000 1 0 1 00 1 // 1111111 0 1 000 1 0 1 00 1
private static final int[] STOP_PATTERN = {7, 1, 1, 3, 1, 1, 1, 2, 1}; private static final int[] STOP_PATTERN = {7, 1, 1, 3, 1, 1, 1, 2, 1};
private static final int MAX_PIXEL_DRIFT = 3; private static final int MAX_PIXEL_DRIFT = 3;
private static final int MAX_PATTERN_DRIFT = 5; private static final int MAX_PATTERN_DRIFT = 5;
// if we set the value too low, then we don't detect the correct height of the bar if the start patterns are damaged. // if we set the value too low, then we don't detect the correct height of the bar if the start patterns are damaged.
// if we set the value too high, then we might detect the start pattern from a neighbor barcode. // if we set the value too high, then we might detect the start pattern from a neighbor barcode.
private static final int SKIPPED_ROW_COUNT_MAX = 25; private static final int SKIPPED_ROW_COUNT_MAX = 25;
// A PDF471 barcode should have at least 3 rows, with each row being >= 3 time // A PDF471 barcode should have at least 3 rows, with each row being >= 3 time
s the module width. Therefore it should be at least s the module width.
// 9 pixels tall. To be conservative, we use about half the size to ensure we // Therefore it should be at least 9 pixels tall. To be conservative, we use a
don't miss it. bout half the size to
// ensure we don't miss it.
private static final int ROW_STEP = 5; private static final int ROW_STEP = 5;
private static final int BARCODE_MIN_HEIGHT = 10; private static final int BARCODE_MIN_HEIGHT = 10;
private Detector() { private Detector() {
} }
/** /**
* <p>Detects a PDF417 Code in an image. Only checks 0 and 180 degree rotation s.</p> * <p>Detects a PDF417 Code in an image. Checks 0, 90, 180, and 270 degree rot ations.</p>
* *
* @param image barcode image to decode * @param image barcode image to decode
* @param hints optional hints to detector * @param hints optional hints to detector
* @param multiple if true, then the image is searched for multiple codes. If false, then at most one code will * @param multiple if true, then the image is searched for multiple codes. If false, then at most one code will
* be found and returned * be found and returned
* @return {@link PDF417DetectorResult} encapsulating results of detecting a P DF417 code * @return {@link PDF417DetectorResult} encapsulating results of detecting a P DF417 code
* @throws NotFoundException if no PDF417 Code can be found * @throws NotFoundException if no PDF417 Code can be found
*/ */
public static PDF417DetectorResult detect(BinaryBitmap image, Map<DecodeHintTy pe,?> hints, boolean multiple) public static PDF417DetectorResult detect(BinaryBitmap image, Map<DecodeHintTy pe,?> hints, boolean multiple)
throws NotFoundException { throws NotFoundException {
// TODO detection improvement, tryHarder could try several different luminan ce thresholds/blackpoints or even // TODO detection improvement, tryHarder could try several different luminan ce thresholds/blackpoints or even
// different binarizers // different binarizers
//boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_ HARDER); //boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_ HARDER);
BitMatrix bitMatrix = image.getBlackMatrix(); BitMatrix bitMatrix = image.getBlackMatrix();
List<ResultPoint[]> barcodeCoordinates = detect(multiple, bitMatrix); List<ResultPoint[]> barcodeCoordinates = detect(multiple, bitMatrix);
if (barcodeCoordinates.isEmpty()) { // Try 180, 270, 90 degree rotations, in that order
for (int rotate = 0; barcodeCoordinates.isEmpty() && rotate < 3; rotate++) {
bitMatrix = bitMatrix.clone(); bitMatrix = bitMatrix.clone();
bitMatrix.rotate180(); if (rotate != 1) {
bitMatrix.rotate180();
} else {
bitMatrix.rotate90();
}
barcodeCoordinates = detect(multiple, bitMatrix); barcodeCoordinates = detect(multiple, bitMatrix);
} }
return new PDF417DetectorResult(bitMatrix, barcodeCoordinates); return new PDF417DetectorResult(bitMatrix, barcodeCoordinates);
} }
/** /**
* Detects PDF417 codes in an image. Only checks 0 degree rotation * Detects PDF417 codes in an image. Only checks 0 degree rotation
* @param multiple if true, then the image is searched for multiple codes. If false, then at most one code will * @param multiple if true, then the image is searched for multiple codes. If false, then at most one code will
* be found and returned * be found and returned
* @param bitMatrix bit matrix to detect barcodes in * @param bitMatrix bit matrix to detect barcodes in
 End of changes. 4 change blocks. 
7 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)