15 lines
307 B
Python
15 lines
307 B
Python
|
import cv2
|
||
|
|
||
|
# Read the image containing a QR code
|
||
|
img = cv2.imread("image.png")
|
||
|
|
||
|
# Create a QR code detector
|
||
|
qr_decoder = cv2.QRCodeDetector()
|
||
|
|
||
|
# Detect and decode the QR code
|
||
|
data, bbox, _ = qr_decoder.detectAndDecode(img)
|
||
|
|
||
|
if data:
|
||
|
print("Decoded data:", data)
|
||
|
else:
|
||
|
print("QR code not detected.")
|