15 lines
307 B
Python
Executable File
15 lines
307 B
Python
Executable File
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.") |