Created
January 14, 2020 14:42
-
-
Save threedaymonk/31855c3aaae6c35ad25401b0183e1259 to your computer and use it in GitHub Desktop.
Python barcode reader example
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
#!/usr/bin/python3 | |
from imutils.video import VideoStream | |
from pyzbar.pyzbar import decode | |
from pprint import pprint | |
import cv2 | |
import time | |
vs = VideoStream(src=0).start() | |
time.sleep(1.0) | |
cv2.startWindowThread() | |
cv2.namedWindow("Frame") | |
while True: | |
frame = vs.read() | |
decoded = decode(frame) | |
for barcode in decoded: | |
print(barcode.data) | |
cv2.imshow("Frame", frame) | |
if frame is None: | |
break | |
vs.release() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment