-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathqrcode_reader.py
More file actions
39 lines (34 loc) · 917 Bytes
/
qrcode_reader.py
File metadata and controls
39 lines (34 loc) · 917 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import cv2
import numpy
import pyzbar.pyzbar as pyzbar
import pyqrcode
# QR code Generator
# ........................................................
# qr = pyqrcode.create('shantam sultania')
#
# qr.png('qr.png',11)
# just un comment them
# ..........................................................
# # reader in an image only
#
# img =cv2.imread('qr.png')
# cv2.imshow('qrcode',img)
# cv2.waitKey(0)
#
# # decoder
#
# decode = pyzbar.decode(img)
# for i in decode:
# print(i.data)
#..........................................................
# for live that is in a Video
cam = cv2.VideoCapture(0)
while True:
check,frame = cam.read()
decode = pyzbar.decode(frame)
for i in decode:
cv2.putText(frame,str(i.data),(50,50),cv2.FONT_ITALIC,1,(0,255,0),3)
cv2.imshow('qr code reader',frame)
key = cv2.waitKey(1)
if key == 27:
break