com.google.zxing.multi.MultipleBarcodeReader Java Examples
The following examples show how to use
com.google.zxing.multi.MultipleBarcodeReader.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BarcodeTextExtractor.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * Decode all barcodes in the image */ private String multiple(BufferedImage img) throws NotFoundException, ChecksumException, FormatException { long begin = System.currentTimeMillis(); LuminanceSource source = new BufferedImageLuminanceSource(img); BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source)); com.google.zxing.Reader reader = new MultiFormatReader(); MultipleBarcodeReader bcReader = new GenericMultipleBarcodeReader(reader); Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>(); hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE); StringBuilder sb = new StringBuilder(); for (Result result : bcReader.decodeMultiple(bitmap, hints)) { sb.append(result.getText()).append(" "); } SystemProfiling.log(null, System.currentTimeMillis() - begin); log.trace("multiple.Time: {}", System.currentTimeMillis() - begin); return sb.toString(); }