Menu

QR code with python

jt
2009-12-29
2013-02-02
  • jt

    jt - 2009-12-29

    Hi,

    I just built zbar 0.10 from sources on Ubuntu 9.10 (python 2.6). All test cases in the included test_zbar.py pass.

    The CLI works perfectly: `zbarimg -raw -q myimage` extracts the data from the QR code.

    However when I try it from python (import the built module installed in my site-packages dir) then no symbol is found.
    What exact config should I feed to the ImageScanner object? I tried `scanner.set_config(zbar.Symbol.QRCODE, zbar.Config.ENABLE, 0)`
    Is there something else to do?

    Thanks.

     
  • spadix

    spadix - 2009-12-30

    >     scanner.set_config(zbar.Symbol.QRCODE, zbar.Config.ENABLE, 0)

    this would disable the QR decoder.  you want the enable set to 1 (or just leave at the default):

        scanner.set_config(zbar.Symbol.QRCODE, zbar.Config.ENABLE, 1)

    if it's still not working, make sure your image data is in the correct format - the ImageScanner only supports 8bpp grayscale (Y800)

     
  • jt

    jt - 2009-12-30

    Thanks, that was the 1.
    I misinterpreted the doc in zbar.h , I'll read more carefully next time.

    So to speed scanning up a bit, I can just do a

        scanner.set_config(0, zbar.Config.ENABLE, 0)
        scanner.set_config(zbar.Symbol.QRCODE, zbar.Config.ENABLE, 1)

    .

     
  • spadix

    spadix - 2010-01-03

    > that was the 1

    great! glad you got it working

    > So to speed scanning up a bit, I can just do a

    yes, this should speed things up some and maximize the reliability (it will not be possible to get bad decodes from unwanted symbologies)

     

Log in to post a comment.