-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcam.py
43 lines (35 loc) · 1.13 KB
/
cam.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
32
33
34
35
36
37
38
39
40
41
42
43
import cv2
import qrDetect
class Cam:
def __init__(self,camPort):
self.camPort=camPort
def openCam(self):
cap = cv2.VideoCapture(self.camPort)
if cap.isOpened():
print("Kamera açıldı")
while True:
ret, frame = cap.read()
if not ret:
print("Görüntü alınamadı")
break
else:
print("Görüntü Alınıyor")
try:
qrFind=qrDetect.QrDetect(frame)
qrFind.qr()
except:
print("Qr Verisi Alınamıyor")
cv2.imshow("Cam", frame)
if cv2.waitKey(1) == ord('q'):
qrdata = qrFind.qr()
print("Alınan Qr verisi",qrdata)
break
else:
print("Kamera açılmadı!!!")
cap.release()
return qrdata
camera=Cam(0)
camera.openCam()
qrVerisi=camera.openCam()
print("Alınan Qr verisi son", qrVerisi)
cv2.destroyAllWindows()