100353878
0
01-14-2019
LROM
HR
Code :
public Result[] getBarcodeResults(BufferedImage image, BarcodeFormat
) {
// bf = BarcodeFormat.CODE_39 passed as argument
LuminanceSource source = new BufferedImageLuminanceSource(image);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
List<BarcodeFormat> formatList = new ArrayList<BarcodeFormat>();
formatList.add(bf);
Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>();
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
hints.put(DecodeHintType.POSSIBLE_FORMATS, formatList);
Result[] results = null;
try {
MultiFormatReader multiFormatReader = new MultiFormatReader();
GenericMultipleBarcodeReader reader = new GenericMultipleBarcodeReader(multiFormatReader);
results = reader.decodeMultiple(bitmap, hints);
}
catch (NotFoundException exception) {
}
return results;
}
Any help appreciated
thanks
Shajan