forked from Yashwant-07/AttendanceManagementSystem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAttendanceProject.py
49 lines (46 loc) · 1.71 KB
/
AttendanceProject.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
44
45
46
47
48
49
import cv2
import os
from Encoding import findEncodings
from Webcam_Recognition import webcamRecognition
path = 'D:/AMS/AttendanceManagementSystemusingFaceRecognition-master/Images'
images = []
classNames = []
classRollno = []
myList = os.listdir(path)
for cl in myList:
curImg = cv2.imread(f'{path}/{cl}')
images.append(curImg)
nameLine = os.path.splitext(cl)[0]
nameEntry = nameLine.split(",")
classNames.append(nameEntry[0])
classRollno.append(nameEntry[1])
print('Encoding in progress...')
print("Staring The Webcam...")
encodeListKnown = findEncodings(images)
print('Encoding Complete!')
webcamRecognition(encodeListKnown, classNames, classRollno)
while True:
check = False
print("Type Attendance to Take Attendance ")
print("Type CheckStudent to Check the Student is Present or Not")
TakeAttendanceOrCheckStudent = str(input()).lower()
if TakeAttendanceOrCheckStudent == "checkstudent":
StudentName = str(input("Enter Student Name for Checking..")).upper()
for i in classNames:
if i == StudentName:
check = True
if check == True:
print(f"Yes {StudentName} is Present In class Right Now")
else:
print(f"No {StudentName} is Not Present In class Right Now")
elif TakeAttendanceOrCheckStudent == "attendance":
print('Encoding in progress...')
print("Staring The Webcam...")
encodeListKnown = findEncodings(images)
print('Encoding Complete!')
webcamRecognition(encodeListKnown, classNames, classRollno)
elif TakeAttendanceOrCheckStudent == "exit":
print("Closing.....")
exit()
else:
continue