-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqrcode.py
31 lines (26 loc) · 952 Bytes
/
qrcode.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#recognizes qr code and is able to tell link of it too.
import cv2
import pyzbar.pyzbar as pyzbar
from datetime import datetime
a=0
def video_record():
global a
camera = cv2.VideoCapture(1)
try:
while a==0:
ret, frame = camera.read()
barcodes = pyzbar.decode(frame)
for barcode in barcodes:
(x, y, w, h) = barcode.rect
cv2.rectangle(frame, (x, y), (x + w, y + h), (255, 0, 0), 2)
barcodeData = barcode.data.decode('utf-8')
print(barcodeData, type(barcodeData))
barcodeType = barcode.type
text = "{} ( {} )".format(barcodeData, barcodeType)
return barcodeType
a=1
cv2.imshow("Image", frame)
cv2.waitKey(10)
except KeyboardInterrupt:
print('interrupted!')
#video_record()