0

Installed Zbar with sudo apt-get install python-zbar.

I'm trying to decode barcode using example povided with library:

!/usr/bin/python
from sys import argv
import zbar

# create a Processor
proc = zbar.Processor()

# configure the Processor
proc.parse_config('enable')

# initialize the Processor
device = '/dev/video0'
if len(argv) > 1:
    device = argv[1]
proc.init(device)

# enable the preview window
proc.visible = True

# read at least one barcode (or until window closed)
proc.process_one()

# hide the preview window
proc.visible = False

# extract results
for symbol in proc.results:
    # do something useful with results
    print 'decoded', symbol.type, 'symbol', '"%s"' % symbol.data

trying to scan textbook Trying to scan can

Also tested with QrCodes, but I don't really need them.

So it detects barcodes, but doesn't decodes them.

  • I'd suggest trying the tool called "zbarcam" and validate that it can decode the bar codes. I believe that this is a stand-alone tool that uses the zbar libraries to do the decoding. If that works and decodes your bar codes then we will have eliminated any cameras, bad bar codes or other sources of error. Since it comes pre-cooked and ready to run, it should be a case of find it, read about it, download it, run it ... and so shouldn't introduce any other permutations. If it doesn't read the barcodes, then there is something else wrong. – Kolban May 12 '16 at 20:19
1

zbarcam --prescale=480x320 helped. Old Raspberry Pi B can't handle such CPU load caused by big video frame output.

  • 1
    How did a shell command help in a question featuring Python code? – Dmitry Grigoryev Jan 18 '17 at 8:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.