【问题标题】:zbar cannot decode barcodezbar无法解码条码
【发布时间】:2015-12-20 09:00:43
【问题描述】:

我有两张相同条形码的图像。当我使用 zbar 库(或 qrtools 包装器)解码 QR 码的图像时,ImageScanner.scanner 为其中一些返回 0。例如,我无法弄清楚为什么无法解码第一个二维码:

而第二个可以解码:

以下是我用于解码的代码。 结果第一个图像的值为 0,第二个图像的值为 1。

            import zbar
            from PIL import Image

            scanner = zbar.ImageScanner()
            # configure the reader
            scanner.parse_config('enable')
            # obtain image data
            pil = Image.open(filename).convert('L')
            width, height = pil.size
            raw = pil.tostring()
            # wrap image data
            image = zbar.Image(width, height, 'Y800', raw)
            # scan the image for barcodes
            result = scanner.scan(image) #Value is 0, -1, 1

关于如何使 zbar 解码器适用于第一张图像的任何反馈?

【问题讨论】:

    标签: decode qr-code zbar


    【解决方案1】:

    问题在于阴影移除。一旦图像被二值化并移除阴影,zbar 就能够对其进行解码

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-05
      • 2014-04-18
      相关资源
      最近更新 更多