Created
March 3, 2017 11:32
-
-
Save jrobinson-uk/97ee91e86c38dae0056eeb507231d883 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zbar | |
import picamera | |
import io | |
width = 640 | |
height = 480 | |
raw_data = io.BytesIO() | |
scanner = zbar.ImageScanner() | |
scanner.parse_config('enable') | |
with picamera.PiCamera() as camera: | |
camera.resolution = (width, height) | |
camera.raw_format = 'yuv' | |
while True: | |
camera.capture(raw_data, 'raw') | |
raw_data.seek(0) | |
image = zbar.Image(width, height, 'Y800', | |
raw_data.getvalue()[0:width*height]) | |
scanner.scan(image) | |
for symbol in image: | |
print 'decoded', symbol.type, 'symbol', '"%s"' % symbol.data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment