我有一个扫描纸张的工作系统,然后让zbarimg识别这些纸张上的qrcode (虽然我不知道qrcode出现在哪个区域)。突然间,qrcode识别变得更加糟糕,最终完全停止了工作。
物理扫描仪从扫描的纸张生成PDF。我使用鬼怪脚本将其转换为图片:
gs -sDEVICE=png16m -sCompression=lzw -r600x600 -dNOPAUSE -sOutputFile='scantest.png' scantest.pdf
其结果是:
当您尝试用智能手机读取qrcode时,它将立即被识别。但当我运行zbarimg时:
zbarimg scantest.png
Zbarimg什么都认不出来
在6,6秒内从1幅图像中扫描出0种条形码符号
我尝试应用这个解决方案:https://stackoverflow.com/a/40609947/4654597
但没有任何运气,实际上它完全摧毁了qrcode:
我还试着应用一个像这篇文章中建议的那样的光模糊过滤器:Decode QR-Code in scanned PDF。
我使用ImageMagick来完成这个任务:convert scantest.png -blur 1x1 scantest_after_blur.png
我也尝试了1x2,1x3,1x4,1x6,1x8,但是没有任何帮助。
我怎么能让zbarimg再工作一次?
发布于 2021-10-27 12:37:58
以下是最后起作用的原因:
convert input.png +repage -threshold 50% -morphology open square:1 output.png
zbarimg output.png
最重要的可能是应用形态学。我从下面的文章中得到了整个ImageMagick命令:QR code detection with ZBar from console fails for valid QR codes (ZBarCam from camera detects them fine)
https://stackoverflow.com/questions/69689869
复制相似问题