{"id":20305981,"url":"https://github.com/dedidot/face-recognition-with-python-opencv","last_synced_at":"2025-03-04T07:22:30.783Z","repository":{"id":144266031,"uuid":"275113279","full_name":"dedidot/face-recognition-with-python-opencv","owner":"dedidot","description":"Face detection with opencv-python and face-recognition.","archived":false,"fork":false,"pushed_at":"2020-06-26T09:16:07.000Z","size":12367,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-14T11:28:54.819Z","etag":null,"topics":["face-detection","face-recognition","opencv-python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dedidot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-26T08:53:48.000Z","updated_at":"2020-12-08T12:15:15.000Z","dependencies_parsed_at":"2023-07-11T17:47:03.611Z","dependency_job_id":null,"html_url":"https://github.com/dedidot/face-recognition-with-python-opencv","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dedidot%2Fface-recognition-with-python-opencv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dedidot%2Fface-recognition-with-python-opencv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dedidot%2Fface-recognition-with-python-opencv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dedidot%2Fface-recognition-with-python-opencv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dedidot","download_url":"https://codeload.github.com/dedidot/face-recognition-with-python-opencv/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241802132,"owners_count":20022581,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["face-detection","face-recognition","opencv-python"],"created_at":"2024-11-14T17:11:07.303Z","updated_at":"2025-03-04T07:22:30.759Z","avatar_url":"https://github.com/dedidot.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Documentation\nThis is a way to check pictures of people with face_recognition.\n\n![Result](https://github.com/dedidot/face-recognition-with-python-opencv/blob/master/Screen%20Shot%202020-06-26%20at%2016.06.44.png)\n\n**Quict Start**\n1. Clone repo, `git clone https://github.com/dedidot/face-recognition-with-python-opencv.git`\n2. install  `requirements.txt`  using  `pip install -r requirements.txt`\n3. Run `python index.py`\n\n**Explanation**\nLoad known faces folder:\n\n```\nfor name in os.listdir(KNOWN_FACES_DIR):\n   if name ==  '.DS_Store':\n      continue\n   for filename in os.listdir(f\"{KNOWN_FACES_DIR}/{name}\"):\n       \timage = face_recognition.load_image_file(f'{KNOWN_FACES_DIR}/{name}/{filename}')\n    \tencoding = face_recognition.face_encodings(image)[0]\n    \tknown_faces.append(encoding)\n    \tknown_names.append(name)\n```\n\nLoad unknown faces and compare with known faces:\n\n```\nfor filename in os.listdir(UNKNOWN_FACES_DIR):\n    print(f'Filename {filename}', end='')\n    image = face_recognition.load_image_file(f'{UNKNOWN_FACES_DIR}/{filename}')\n    \n    locations = face_recognition.face_locations(image, model=MODEL)\n    encodings = face_recognition.face_encodings(image, locations)\n    \n    image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)\n    print(f' found {len(encodings)} face(s) ')\n    \n    for face_encoding, face_location in  zip(encodings, locations):\n    \tresults = face_recognition.compare_faces(known_faces, face_encoding, TOLERANCE)\n\tmatch =  None\n\t\n\tif  True  in results:\n\t    match = known_names[results.index(True)]\n\t    \n\t    print(f' - {match} from {results} ')\n\t    \n\t    top_left = (face_location[3], face_location[0])\n\t    bottom_right = (face_location[1], face_location[2])\n\t    \n\t    color = name_to_color(match)\n\t    cv2.rectangle(image, top_left, bottom_right, color, FRAME_THICKNESS)\n\t    \n\t    top_left = (face_location[3], face_location[2])\n\t    bottom_right = (face_location[1], face_location[2] +  22)\n\t    \n\t    cv2.rectangle(image, top_left, bottom_right, color, cv2.FILLED)\n\t    cv2.putText(image, match, (face_location[3] +  10, face_location[2] +  15), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (200, 200, 200), FONT_THICKNESS)\n```\n\n**Show result:**\n\n    cv2.imshow(filename, image)\n    cv2.waitKey(10000)\n    cv2.destroyWindow(filename)\n\nInspired by: sentdex (Harrison)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdedidot%2Fface-recognition-with-python-opencv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdedidot%2Fface-recognition-with-python-opencv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdedidot%2Fface-recognition-with-python-opencv/lists"}