Calmcode - qr code: decode qr

Decode QR

1 2 3 4

Install OpenCV

To read QR codes we'll need another dependency: opencv.

%pip install opencv-python==4.4.0.44

Decode QRCode in Python

Given this dependency you can retreive the code from a QR code from an image via;

import cv2
import matplotlib.pylab as plt

# read the QRCODE image
img = cv2.imread("qrcode.png")

detector = cv2.QRCodeDetector()
data, bbox, straight_qrcode = detector.detectAndDecode(img)