OpenCV:QRCodeDetector
OpenCV 에 내장된 QR 코드 검출기.
Example
import cv2
img = cv2.imread("qrcode_2.jpg")
img = cv2.resize(img, (0, 0), fx=0.3, fy=0.3)
qr = cv2.QRCodeDetector()
data, box, straight_qrcode = qr.detectAndDecode(img)
if data:
print('QR코드 데이터: {}'.format(data))
print('QR코드 위치: {}'.format(box))
lefttop = int(box[0][0][0]), int(box[0][0][1])
rightbottom = int(box[0][2][0]), int(box[0][2][1])
cv2.rectangle(img, lefttop, rightbottom, (0, 0, 255), 5)
cv2.imshow('img', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
else:
print("인식 오류!")
See also
- OpenCV
- QRCode
- BarCode
- libzbar - QR Code scanner engine for QR+Emoji
- zbar-py - zbar package
- pyzbar - Read one-dimensional barcodes and QR codes from Python 2 and 3.
- QReader - Robust and Straight-Forward solution for reading difficult and tricky QR codes within images in Python. Supported by a YOLOv8 QR Segmentation model.