{"id":19671417,"url":"https://github.com/lasithaamarasinghe/face-recognition","last_synced_at":"2026-04-16T05:04:16.384Z","repository":{"id":244804770,"uuid":"814766586","full_name":"LasithaAmarasinghe/Face-Recognition","owner":"LasithaAmarasinghe","description":"This project demonstrates a basic face recognition system using Python, OpenCV, and the face_recognition library.","archived":false,"fork":false,"pushed_at":"2025-02-07T01:51:17.000Z","size":5937,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-07T02:31:09.225Z","etag":null,"topics":["cmake","computer-vision","dlib","face-recognition","numpy","opencv","python","visualstudiocode"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LasithaAmarasinghe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE.txt","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":"2024-06-13T16:56:24.000Z","updated_at":"2025-02-07T01:51:20.000Z","dependencies_parsed_at":"2024-11-11T17:08:48.049Z","dependency_job_id":"58155c60-44dc-4e9c-96d5-902d44c93d85","html_url":"https://github.com/LasithaAmarasinghe/Face-Recognition","commit_stats":null,"previous_names":["lasithaamarasinghe/face-recognition"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LasithaAmarasinghe%2FFace-Recognition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LasithaAmarasinghe%2FFace-Recognition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LasithaAmarasinghe%2FFace-Recognition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LasithaAmarasinghe%2FFace-Recognition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LasithaAmarasinghe","download_url":"https://codeload.github.com/LasithaAmarasinghe/Face-Recognition/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240980888,"owners_count":19888344,"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":["cmake","computer-vision","dlib","face-recognition","numpy","opencv","python","visualstudiocode"],"created_at":"2024-11-11T17:08:44.653Z","updated_at":"2026-04-16T05:04:16.354Z","avatar_url":"https://github.com/LasithaAmarasinghe.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Face-Recognition\n\n## Overview\n\n- This project demonstrates a basic face recognition system using **[Python](https://www.python.org/)**, **[OpenCV](https://opencv.org/)**, and the **[face_recognition](https://pypi.org/project/face-recognition/)** library.\n- The system can encode known faces from images in a directory, recognize faces in an input image, and label the recognized faces.\n- This repository contains all the codes and resources of this project.\n\n## Steps\n\n- Encoding faces from images stored in a directory.\n- Recognizing and label faces in an input image.\n- Displaying the input image with labeled faces.\n\n## Code\n\nYou can find the code for this project here.\n* [face_rec.py](https://github.com/LasithaAmarasinghe/Face-Recognition/blob/main/face_rec.py).\n\n## Technologies/Tools\n\n* Python 3.10.12\n* OpenCV `pip install opencv-python`\n* Python packages\n    * numpy `pip install numpy`\n    * cmake `pip install cmake`\n    * dlib `pip install dlib`\n    * face_recognition `pip install face_recognition`\n \n![Python](https://img.shields.io/badge/python-3670A0?logo=python\u0026logoColor=FFFF00)\n![OpenCV](https://img.shields.io/badge/opencv-%23white.svg?logo=opencv\u0026logoColor=white)\n![NumPy](https://img.shields.io/badge/numpy-%23013243.svg?logo=numpy\u0026logoColor=white)\n![cmake](https://img.shields.io/badge/cmake_-red)\n![dlib](https://img.shields.io/badge/dlib_-purple)\n![face_recognition](https://img.shields.io/badge/face_recognition_-brown)\n   \n* C++ compiler - install [Visual Studio](https://visualstudio.microsoft.com/downloads/)\n\n## Installation\n \n  1. **Clone the repository:**\n \n     ```bash\n     git clone https://github.com/LasithaAmarasinghe/Face-Recognition.git\n     cd Face-Recognition\n     ```\n \n  2. **Create and activate a virtual environment (optional but recommended):**\n\n     ```bash\n     python -m venv venv\n     source venv/bin/activate   # On Windows use `venv\\Scripts\\activate`\n     ```\n \n  3. **Install the required packages:**\n \n     ```bash\n     pip install -r requirements.txt\n     ```\n \n## Usage\n \n  1. **Prepare the Faces Directory:**\n \n     - Create a directory named `faces` in the root of your project.\n     - Add images of known faces to the `faces` directory. Ensure the images are named with the format `name.jpg` or `name.png` \n       where `name` is the label you want to assign to the face.\n \n  2. **Run the Face Recognition Script:**\n\n     - Place the image you want to test in the root of your project directory and name it `test.jpg`.\n     - Run the script:\n \n       ```bash\n       python face_rec.py\n       ```\n \n  3. **Interact with the Display:**\n \n     - The script will display the `test.jpg` image with labeled faces.\n     - Press 'q' to close the display window.\n \n## Code Explanation\n\n  - **`get_encoded_faces()`:** This function scans the `faces` directory, encodes each face, and stores the encodings in a dictionary.\n  - **`unknown_image_encoded(img)`:** This function encodes an unknown face from a given image file.\n  - **`classify_face(im)`:** This function reads an image, detects faces in it, compares them to the known face encodings, labels the faces, \n    and displays the image with labeled faces.\n\n## Results\n\n![image](https://github.com/LasithaAmarasinghe/Face-Recognition/assets/106037441/5c986ce6-ca57-4888-b27a-1d0b3568e116)\n\n\n## License\n \n * This project is licensed under the MIT License. See the [LICENSE](MIT-LICENSE.txt) file for details.\n \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flasithaamarasinghe%2Fface-recognition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flasithaamarasinghe%2Fface-recognition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flasithaamarasinghe%2Fface-recognition/lists"}