我正在尝试使用zxing库(GenericMultipleBarcodeReader)读取2D数据矩阵条形码。我在单个图像上有多个条形码。
问题在于,zing阅读器的效率非常低,它只能从图像1.png识别出1个条形码,并且无法从图像2.png(其中包含48个条形码)中识别任何条形码。是否有任何方法可以获得100%的效率或任何其他库可以实现100%的效果?
我的读取条形码的代码如下:
问题在于,zing阅读器的效率非常低,它只能从图像1.png识别出1个条形码,并且无法从图像2.png(其中包含48个条形码)中识别任何条形码。是否有任何方法可以获得100%的效率或任何其他库可以实现100%的效果?
我的读取条形码的代码如下:
public static void main(String[] args) throws Exception {
BufferedImage image = ImageIO.read(new File("1.png"));
if (image != null) {
LuminanceSource source = new BufferedImageLuminanceSource(image);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
DataMatrixReader dataMatrixReader = new DataMatrixReader();
Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>();
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
GenericMultipleBarcodeReader reader = new GenericMultipleBarcodeReader(
dataMatrixReader);
Result[] results = reader.decodeMultiple(bitmap, hints);
for (Result result : results) {
System.out.println(result.toString());
}
}
}
我使用的图片如下:
请帮忙解决这个问题。
谢谢