Ask Your Question

Revision history [back]

video_capture = cv2.VideoCapture(0)
count = 0

while True:

  print('oi')
  ret, frame = video_capture.read()
  small_frame = cv2.resize(frame, (0,0), fx=0.25, fy=0.25)

  rgb_small_frame = small_frame [:,:,::-1]

  face_locations = face_recognition.face_locations(rgb_small_frame)
  face_encodings = face_recognition.face_encodings(rgb_small_frame, face_locations)

  face_labels = []
  for face_location, face_encoding in zip(face_locations, face_encodings):
    metadata = lookup_known_face(face_encoding, know_face_encodings, know_face_metadata)
    if metadata is not None:
      video_capture.release()
      cv2.destroyAllWindows()
      cv2.waitKey(10)
      return Response(metadata)

    else:
      return Response(False)
  cv2.imshow('Video', frame)
  key = cv2.waitKey(1)


  if count == 5:

    video_capture.release()
    cv2.waitKey(0)
    cv2.destroyAllWindows()
    cv2.waitKey(1)
    return Response(False)

Had the same issue and cant solve it out, this is a signup script which works propoerly at the first time that i call it from my interface, but at a second time it just doesn't work at all. Any ideas @supra56