контроль доступа к пользователям в системах распознавания лиц - PullRequest
0 голосов
/ 04 сентября 2018

У меня есть программа распознавания лиц, которая выполняется каждый раз, когда лицо человека было обнаружено, затем, например, такая операция, как отображение видео на экране, и она работает правильно. Но я хочу их контролировать, то есть могу сказать, что в определенные моменты, когда кого-то узнают, тогда не показывают изображение. Как я могу это сделать, какие параметры следует сохранить в базах данных? это мой код

for (top, right, bottom, left), face_encoding in zip(face_locations,face_encodings):
           # match = face_recognition.compare_faces(known_face_encoding, face_encoding)
           # Matches=np.where(match)[0] #Checking which image is matched
            match = face_recognition.compare_faces(known_face_encoding, face_encoding)
           # match = face_recognition.compare_faces(known_face_encoding, face_encoding)
            face_distance = face_recognition.face_distance(known_face_encoding, face_encoding)
            matches=np.where(match)[0]
            if len(matches)>0:
               name = str(known_person[matches[0]])
               face_names.append(name)


               name_map = dict(zip(known_person,[e+'.jpg' for e in known_person]))
               name2= name_map[str(name)]


               img = cv2.imread(name2)
               img = cv2.resize(img, (1280, 720), interpolation=cv2.INTER_CUBIC)
               cv2.namedWindow("test", cv2.WND_PROP_FULLSCREEN)
               cv2.setWindowProperty("test", cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)
               timestamp2 = datetime.datetime.now()
               tl = timestamp2.strftime("%I : %M : %S%p")
               print(name2)
               cv2.putText(img, "Time: {}".format(tl), (10, 80),cv2.FONT_HERSHEY_COMPLEX, 0.6, (0, 0, 255), 2)



               cv2.imshow('test', img)

               cv2.waitKey(4000)
               cv2.destroyWindow('test')
               if name == last_row:
                  continue
               else:
                  last_row = name






           # else:
            #    face_names.append("Unknown")
   # process_this_frame =  not process_this_frame
               #process_this_frame = process_this_frame+1

    # Display the results
   # for (top, right, bottom, left), name in zip(face_locations, face_names):
        # Scale back up face locations since the frame we detected in was scaled to 1/4 size
            top *= 2
            right *= 2
            bottom *= 2
            left *= 2

        # Draw a box around the face
            cv2.rectangle(frame, (left, top), (right, bottom), (0, 0, 255), 2)

        # Draw a label with a name below the face
            cv2.rectangle(frame, (left, bottom - 35), (right, bottom), (0, 0, 255), -1)
            font = cv2.FONT_HERSHEY_DUPLEX
            cv2.putText(frame, name, (left + 6, bottom - 6), font, 1.0, (255, 255, 255), 1)


    cv2.imshow('Video', frame)
    # Hit 'q' on the keyboard to quit!
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# Release handle to the webcam
video_capture.release()
cv2.destroyAllWindows()
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...