类com.google.zxing.multi.MultipleBarcodeReader源码实例Demo

下面列出了怎么用com.google.zxing.multi.MultipleBarcodeReader的API类实例代码及写法,或者点击链接到github查看源代码。


/**
 * 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();
}
 
 类所在包
 类方法
 同包方法