forked from wasmerio/Python-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
32 lines (29 loc) · 878 Bytes
/
Copy pathmain.py
File metadata and controls
32 lines (29 loc) · 878 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
from pyzbar.pyzbar import decode
import cv2
from PIL import Image
import csv
cam = cv2.VideoCapture(0)
students = []
RollNumbers = []
with open(r"path of csv","r") as file :
reader = csv.reader(file)
for row in reader :
students.append(row[1])
RollNumbers.append(row[0])
while True :
_,frame = cam.read()
decodedframe = decode(frame)
try :
for qrcode in decodedframe :
name = decodedframe[0].data.decode()
if name in students :
RollNumbers.remove(RollNumbers[students.index(name)])
students.remove(name)
except:
print("Error")
cv2.imshow("Attendace System",frame)
k = cv2.waitKey(100) & 0xff
if k==27:
break # press escape to close the loop
print(f"Absent Students Name : {students}.")
print(f"Absent Students Roll No : {RollNumbers}")