我想在PDF417(Zebra Crossing)中启用ZXing条形码阅读功能。我从github repo进行了拉动,并根据wiki构建了库。正在构建PDF417子模块的ant构建输出seems to indicate。我尝试使用these images根据wiki测试所有内容,但我收到“未找到条形码”错误。
kscottz@kscottz-laptop:~/barcode/zxing$ java -cp javase/javase.jar:core/core.jar com.google.zxing.client.j2se.CommandLineRunner Sample_PDF417.png
file:/home/kscottz/barcode/zxing/Sample_PDF417.png: No barcode found
kscottz@kscottz-laptop:~/barcode/zxing$ java -cp javase/javase.jar:core/core.jar com.google.zxing.client.j2se.CommandLineRunner bc.png
file:/home/kscottz/barcode/zxing/bc.png: No barcode found
kscottz@kscottz-laptop:~/barcode/zxing$ java -cp javase/javase.jar:core/core.jar com.google.zxing.client.j2se.CommandLineRunner sanitycheck.jpg
file:/home/kscottz/barcode/zxing/sanitycheck.jpg (format: QR_CODE, type: TEXT):
Raw result:
<-- SNIP -->
是什么给出的?我错过了启用PDF417的标志吗?人们会在哪里设置这些配置选项?我经常是Python / C / C ++开发人员,所以我可能会遗漏一些非常基本的东西。
答案 0 :(得分:1)
尝试--try_harder
,否则它处于适合移动设备的模式,而不是使用更多的CPU来扫描图像。 --pure_barcode
可能也会起作用,因为这些是合成图像。
总的来说。但这些似乎并没有解码。我无法访问第一张图片,即使在在线解码器(您可以随时用作支票)中也找不到第二张图片:http://zxing.elasticbeanstalk.com/w/decode.jspx
我不知道为什么,因为我认为它是有效的。您可以通过调试器来查看确切的错误。
答案 1 :(得分:0)
所以我在测试条形码上运行了ZXing测试脚本并且它们确实通过了,所以我假设它已启用。看来,当zxing说alpha时,他们的确意味着alpha。 =(
答案 2 :(得分:0)
基本上,使用ZXING库仅检测PDF417条形码,您需要传递提示,要求ZXING仅查找PDF417类型。
尝试以下,
hints.put(DecodeHintType.POSSIBLE_FORMATS, EnumSet.of(BarcodeFormat.PDF_417));
查看以下示例,
LuminanceSource source = new BufferedImageLuminanceSource(bufferedImage);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
Map<DecodeHintType, Object> hints = new EnumMap<>(DecodeHintType.class);
hints.put(DecodeHintType.POSSIBLE_FORMATS, EnumSet.of(BarcodeFormat.PDF_417));
//hints.put(DecodeHintType.POSSIBLE_FORMATS, EnumSet.allOf(BarcodeFormat.class));
hints.put(DecodeHintType.CHARACTER_SET, "utf-8");
hints.put(DecodeHintType.TRY_HARDER, true);
Result result = new MultiFormatReader().decode(bitmap, hints);