Skip to content

Commit

Permalink
Update face_attendance.py
Browse files Browse the repository at this point in the history
  • Loading branch information
flemton committed Sep 28, 2021
1 parent 6c4a30e commit b29d7b8
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions face_attendance.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
cur = attend.cursor()

#For adding name and time to attendance
def register(matches):
cur.execute("INSERT INTO Attended VALUES (?, ?, ?, ?)", matches)
def register(matches, time):

cur.execute("INSERT INTO Attended VALUES (?, ?)", (matches, time))
attend.commit()

#For add face seperately if not staff. Good for seeing people who visit or number of people who visit
##under development
##def match_error(no_match):
##cur.execute("INSERT INTO Error VALUES (?, ?)", no_match)

Expand All @@ -29,6 +31,8 @@ def register(matches):
nick_image = face_recognition.load_image_file("nick.jpg")
nick_face_encoding = face_recognition.face_encodings(nick_image)[0]



#creating arrays of faces and names
known_face_encodings = [
newton_face_encoding,
Expand Down Expand Up @@ -71,7 +75,9 @@ def register(matches):
first_match_index = matches.index(True)
name = known_face_names[first_match_index]
face_names.append(name)
register(name)
#Timestamping
time = datetime.datetime.now()
register(name, time)

process_this_frame = not process_this_frame

Expand Down Expand Up @@ -104,4 +110,4 @@ def register(matches):


#Closing database connection
##attend.close()
##attend.close()

0 comments on commit b29d7b8

Please sign in to comment.