Reputation: 1
Currently, I am implementing the zxing(3.5.3) jar to read barcode from the images. In some of the cases, I am getting NotFoundException and in some cases ChecksumException. Here is my code.
try {
BufferedImage image = ImageIO.read(file);
LuminanceSource ls = new BufferedImageLuminanceSource(image);
BinaryBitmap bmp = new BinaryBitmap(new HybridBinarizer(ls));
PDF417Reader reader = new PDF417Reader();
Map<DecodeHintType, Object> tmpHintsMap = new EnumMap<DecodeHintType, Object>(
DecodeHintType.class);
tmpHintsMap.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
tmpHintsMap.put(DecodeHintType.POSSIBLE_FORMATS,
EnumSet.allOf(BarcodeFormat.class));
tmpHintsMap.put(DecodeHintType.PURE_BARCODE, Boolean.TRUE);
com.google.zxing.Result results = reader.decode(bmp, tmpHintsMap);
System.out.println(results.getText());
}catch (Exception e) {
System.err.println("Error: " + e.getMessage());
}
Need to know, is there any other configurations which can help to resolve it?
Upvotes: 0
Views: 49