qr_reader.py

from pyzbar import pyzbar import cv2 def read_qr(image): im_gray = cv2.imread(image, cv2.IMREAD_GRAYSCALE) im_bw = cv2.threshold(im_gray, 128, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU) im_bw = cv2.threshold(im_gray, 127, 255, cv2.THRESH_BINARY)[1] barcodes = pyzbar.decode(im_bw) return barcodes[0].data.decode('utf-8')
Read QR from an Image

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.