UmairMirza commited on
Commit
4bd3008
1 Parent(s): a81583b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -21
app.py CHANGED
@@ -43,27 +43,24 @@ def Attandance(text,video,image):
43
  if framecount>totalframescount:
44
  break
45
  elif framecount%100==0:
46
- pass
47
- else:
48
- framecount=framecount+1
49
- continue
50
- ret, frame = cap.read()
51
- #faces = cv2.resize(frame, (0, 0), None, 0.25, 0.25)
52
- faces = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
53
-
54
- facesCurrentFrame = face_recognition.face_locations(faces)
55
- encodesCurrentFrame = face_recognition.face_encodings(faces, facesCurrentFrame)
56
-
57
- for encodeFace, faceLoc in zip(encodesCurrentFrame, facesCurrentFrame):
58
- matches = face_recognition.compare_faces(encodeListKnown, encodeFace)
59
- faceDis = face_recognition.face_distance(encodeListKnown, encodeFace)
60
- # print(faceDis)
61
- matchIndex = np.argmin(faceDis)
62
-
63
- if matches[matchIndex]:
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: