mi-task/test/plugins/qrcode/opencv-test.py
havoc420ubuntu c9686a84e1 feat(utils): add QR code decoding functionality
- Integrate QReader for QR code detection and decoding
- Implement decode_qrcode method in ImageProcessor class
- Uncomment run_task_1 function call in main.py
2025-05-11 16:22:21 +00:00

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.")