-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReadQRcode.py
More file actions
24 lines (24 loc) · 820 Bytes
/
ReadQRcode.py
File metadata and controls
24 lines (24 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
def Read():
import cv2
from termcolor2 import c
print(c("""
______ _
| ___ \\ | |
| |_/ / ___ __ _ __| |
| / / _ \\ / _` | / _` |
| |\\ \\ | __/| (_| || (_| |
\\_| \\_| \\___| \\__,_| \\__,_|
""").blue.blink)
print(c("\n\n|Enter The Files Name/Path:").yellow)
filename = input(c(" -->").red)
image = cv2.imread(filename)
detector = cv2.QRCodeDetector()
try:
data, vertices_array, binary_qrcode = detector.detectAndDecode(image)
if vertices_array is not None:
print(c("Data is:").magenta)
print(c(data).green)
else:
print(c("\\\\Something Went Wrong!").red)
except:
print(c("\\\\Something Went Wrong!").red)