{"id":25236854,"url":"https://github.com/poorya96/facial_recognition","last_synced_at":"2026-04-28T11:04:28.062Z","repository":{"id":276823485,"uuid":"930423862","full_name":"poorya96/facial_recognition","owner":"poorya96","description":"Face Recognition with Raspberry Pi Using a Smartphone Camera","archived":false,"fork":false,"pushed_at":"2025-02-10T16:20:22.000Z","size":143,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-10T17:24:26.676Z","etag":null,"topics":["face-recognition","python","raspberry-pi"],"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/poorya96.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2025-02-10T16:01:21.000Z","updated_at":"2025-02-10T16:20:26.000Z","dependencies_parsed_at":"2025-02-10T17:24:30.745Z","dependency_job_id":"aafe4876-2b9c-47b5-aa17-270ac130d274","html_url":"https://github.com/poorya96/facial_recognition","commit_stats":null,"previous_names":["poorya96/facial_recognition"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poorya96%2Ffacial_recognition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poorya96%2Ffacial_recognition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poorya96%2Ffacial_recognition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poorya96%2Ffacial_recognition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/poorya96","download_url":"https://codeload.github.com/poorya96/facial_recognition/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247378139,"owners_count":20929297,"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-recognition","python","raspberry-pi"],"created_at":"2025-02-11T15:32:12.234Z","updated_at":"2026-04-28T11:04:28.021Z","avatar_url":"https://github.com/poorya96.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Face Recognition with Raspberry Pi Using a Smartphone Camera\n\n## Overview\nThis project implements real-time face recognition on a Raspberry Pi using an IP camera (smartphone camera) as the video source. The system detects faces, matches them with known individuals, and controls a GPIO pin based on authentication status.\n\n## Features\n- Real-time face detection and recognition\n- Uses a smartphone camera as an IP camera\n- Controls a GPIO pin (e.g., LED) for authorized faces\n- Displays FPS (frames per second) for performance monitoring\n\n## Requirements\n- **Hardware:**\n  - Raspberry Pi (Pi 4, Pi 5, etc.)\n  - LED (optional, for GPIO control)\n- **Software \u0026 Libraries:**\n  - Python 3\n  - OpenCV (`cv2`)\n  - `face_recognition` library\n  - `numpy`\n  - `picamera2` (if using Raspberry Pi Camera)\n  - `gpiozero` (for GPIO control)\n  - `pickle` (for storing known face encodings)\n  - An IP camera app on your smartphone (e.g., **DroidCam**, **IP Webcam**)\n\n## Installation\n1. **Install dependencies:**\n   ```bash\n   sudo apt update \u0026\u0026 sudo apt upgrade -y\n   sudo apt install python3-opencv\n   pip install face_recognition numpy gpiozero picamera2\n   ```\n2. **Enable camera module on Raspberry Pi:**\n   ```bash\n   sudo raspi-config\n   ```\n   - Go to **Interface Options** -\u003e Enable **Camera**\n   - Reboot the Raspberry Pi\n\n3. **Set up the IP Camera:**\n   - Install **DroidCam** (Android) or **IP Webcam**\n   - Start streaming and note the camera URL (e.g., `http://192.168.X.X:4747/video`)\n\n## Usage\n1. **Run the script:**\n   ```bash\n   python face_recognition_pi.py\n   ```\n2. If an authorized face is detected, the LED connected to GPIO 14 will turn **ON**, otherwise, it will stay **OFF**.\n3. Press `q` to exit.\n\n## Connecting the LED to GPIO 14\n- Connect the **positive leg** (anode) of the LED to **GPIO 14**.\n- Connect the **negative leg** (cathode) to a **330Ω resistor**, then to **GND**.\n\n## Customization\n- **Change the IP Camera URL:**\n  Update `IP_CAMERA_URL` in the script:\n  ```python\n  IP_CAMERA_URL = \"http://192.168.X.X:4747/video\"\n  ```\n- **Add known faces:**\n  - Collect images of known people.\n  - Use `face_recognition` to encode them and save them in `encodings.pickle`.\n- **Modify authorized users:**\n  Update `authorized_names` in the script:\n  ```python\n  authorized_names = [\"john\", \"mary\"]  # Case-sensitive\n  ```\n\n## Troubleshooting\n- If the video does not appear, ensure the IP camera URL is correct and reachable.\n- If face recognition is slow, reduce the `cv_scaler` value for performance optimization.\n- If GPIO does not respond, check your wiring and run the script with `sudo`.\n\n## License\nThis project is licensed under the MIT License. See the LICENSE file for more details.\n\n## Acknowledgments\n\nThis project is inspired by and builds upon the work of the following contributors:\n\n- **[Adam Geitgey](https://github.com/ageitgey)** - Creator of the `face_recognition` library.  \n- **[Caroline Dunn](https://github.com/carolinedunn)** - Contributions to Raspberry Pi face recognition tutorials.  \n- **[Rainer Lienhart]** - Author of OpenCV's Haar cascade classifier.  \n\nSpecial thanks to these developers for their contributions to the open-source community.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoorya96%2Ffacial_recognition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpoorya96%2Ffacial_recognition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoorya96%2Ffacial_recognition/lists"}