Spaces:
Running
Running
Commit
•
50611a5
1
Parent(s):
a63ab35
Update app.py
Browse files
app.py
CHANGED
@@ -38,29 +38,28 @@ def Attandance(text,video,image):
|
|
38 |
index=1
|
39 |
while True:
|
40 |
try:
|
41 |
-
if framecount
|
42 |
-
|
43 |
-
#faces = cv2.resize(frame, (0, 0), None, 0.25, 0.25)
|
44 |
-
faces = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
45 |
-
|
46 |
-
facesCurrentFrame = face_recognition.face_locations(faces)
|
47 |
-
encodesCurrentFrame = face_recognition.face_encodings(faces, facesCurrentFrame)
|
48 |
-
|
49 |
-
for encodeFace, faceLoc in zip(encodesCurrentFrame, facesCurrentFrame):
|
50 |
-
matches = face_recognition.compare_faces(encodeListKnown, encodeFace)
|
51 |
-
faceDis = face_recognition.face_distance(encodeListKnown, encodeFace)
|
52 |
-
# print(faceDis)
|
53 |
-
matchIndex = np.argmin(faceDis)
|
54 |
-
|
55 |
-
if matches[matchIndex]:
|
56 |
-
name = personNames[matchIndex].upper()
|
57 |
-
if names.count(name) == 0:
|
58 |
-
names.append(name)
|
59 |
-
|
60 |
else:
|
61 |
framecount=framecount+1
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
cv2.waitKey(1)
|
65 |
except:
|
66 |
break
|
|
|
38 |
index=1
|
39 |
while True:
|
40 |
try:
|
41 |
+
if framecount>4:
|
42 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
else:
|
44 |
framecount=framecount+1
|
45 |
+
ret, frame = cap.read()
|
46 |
+
#faces = cv2.resize(frame, (0, 0), None, 0.25, 0.25)
|
47 |
+
faces = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
48 |
+
|
49 |
+
facesCurrentFrame = face_recognition.face_locations(faces)
|
50 |
+
encodesCurrentFrame = face_recognition.face_encodings(faces, facesCurrentFrame)
|
51 |
+
|
52 |
+
for encodeFace, faceLoc in zip(encodesCurrentFrame, facesCurrentFrame):
|
53 |
+
matches = face_recognition.compare_faces(encodeListKnown, encodeFace)
|
54 |
+
faceDis = face_recognition.face_distance(encodeListKnown, encodeFace)
|
55 |
+
# print(faceDis)
|
56 |
+
matchIndex = np.argmin(faceDis)
|
57 |
+
|
58 |
+
if matches[matchIndex]:
|
59 |
+
name = personNames[matchIndex].upper()
|
60 |
+
if names.count(name) == 0:
|
61 |
+
names.append(name)
|
62 |
+
|
63 |
cv2.waitKey(1)
|
64 |
except:
|
65 |
break
|