Commit f8f49a75 by Saroj Dhiman

Update main.py

1 parent 2d816a7d
Showing with 8 additions and 6 deletions
...@@ -26,22 +26,24 @@ def findEncodings(images): ...@@ -26,22 +26,24 @@ def findEncodings(images):
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
encode = face_recognition.face_encodings(img)[0] encode = face_recognition.face_encodings(img)[0]
encodeList.append(encode) encodeList.append(encode)
return encodeList return encodeList
def markAttendance(name): def markAttendance(name):
with open('Attendance.csv', 'r+') as f: with open('Attendance.csv', 'r') as f:
myDataList = f.readlines() myDataList = f.readlines()
nameList = [] nameList = []
for line in myDataList: for line in myDataList:
entry = line.split(',') entry = line.split(',')
nameList.append(entry[0]) nameList.append(entry[0])
if name not in nameList: with open('Attendance.csv', 'w') as f:
now = datetime.now()
dtString = now.strftime('%H:%M:%S') if name not in nameList:
f.writelines(f'\n{name},{dtString}') now = datetime.now()
dtString = now.strftime('%H:%M:%S')
f.writelines(f'\n{name},{dtString}')
#### FOR CAPTURING SCREEN RATHER THAN WEBCAM #### FOR CAPTURING SCREEN RATHER THAN WEBCAM
# def captureScreen(bbox=(300,300,690+300,530+300)): # def captureScreen(bbox=(300,300,690+300,530+300)):
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!