Spaces:
Running
Running
Commit
·
4bd3008
1
Parent(s):
a81583b
Update app.py
Browse files
app.py
CHANGED
@@ -43,27 +43,24 @@ def Attandance(text,video,image):
|
|
43 |
if framecount>totalframescount:
|
44 |
break
|
45 |
elif framecount%100==0:
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
name = personNames[matchIndex].upper()
|
65 |
-
if names.count(name) == 0:
|
66 |
-
names.append(name)
|
67 |
|
68 |
cv2.waitKey(1)
|
69 |
except:
|
|
|
43 |
if framecount>totalframescount:
|
44 |
break
|
45 |
elif framecount%100==0:
|
46 |
+
framecount=framecount+1
|
47 |
+
ret, frame = cap.read()
|
48 |
+
#faces = cv2.resize(frame, (0, 0), None, 0.25, 0.25)
|
49 |
+
faces = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
50 |
+
|
51 |
+
facesCurrentFrame = face_recognition.face_locations(faces)
|
52 |
+
encodesCurrentFrame = face_recognition.face_encodings(faces, facesCurrentFrame)
|
53 |
+
|
54 |
+
for encodeFace, faceLoc in zip(encodesCurrentFrame, facesCurrentFrame):
|
55 |
+
matches = face_recognition.compare_faces(encodeListKnown, encodeFace)
|
56 |
+
faceDis = face_recognition.face_distance(encodeListKnown, encodeFace)
|
57 |
+
# print(faceDis)
|
58 |
+
matchIndex = np.argmin(faceDis)
|
59 |
+
|
60 |
+
if matches[matchIndex]:
|
61 |
+
name = personNames[matchIndex].upper()
|
62 |
+
if names.count(name) == 0:
|
63 |
+
names.append(name)
|
|
|
|
|
|
|
64 |
|
65 |
cv2.waitKey(1)
|
66 |
except:
|