{"id":28426279,"url":"https://github.com/ajitashwath/face-detection-using-opencv","last_synced_at":"2026-04-17T02:32:28.286Z","repository":{"id":262162754,"uuid":"886402751","full_name":"ajitashwath/face-detection-using-opencv","owner":"ajitashwath","description":"This project utilizes OpenCV to detect faces in still images.","archived":false,"fork":false,"pushed_at":"2024-11-30T20:14:35.000Z","size":237,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-19T01:53:03.332Z","etag":null,"topics":["jupyter-notebook","opencv-python","python3"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/ajitashwath.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":"2024-11-10T22:31:09.000Z","updated_at":"2025-07-10T05:57:03.000Z","dependencies_parsed_at":"2024-11-30T21:20:02.548Z","dependency_job_id":"f36ef110-ab18-4b4f-983c-5edc7320745b","html_url":"https://github.com/ajitashwath/face-detection-using-opencv","commit_stats":null,"previous_names":["ajitashwathr10/face-detection-using-opencv","ajitashwath/face-detection-using-opencv"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ajitashwath/face-detection-using-opencv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajitashwath%2Fface-detection-using-opencv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajitashwath%2Fface-detection-using-opencv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajitashwath%2Fface-detection-using-opencv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajitashwath%2Fface-detection-using-opencv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ajitashwath","download_url":"https://codeload.github.com/ajitashwath/face-detection-using-opencv/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajitashwath%2Fface-detection-using-opencv/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31912398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"online","status_checked_at":"2026-04-17T02:00:06.879Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["jupyter-notebook","opencv-python","python3"],"created_at":"2025-06-05T11:09:28.831Z","updated_at":"2026-04-17T02:32:28.236Z","avatar_url":"https://github.com/ajitashwath.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Face Detection Using OpenCV\n\n[![GitHub stars](https://img.shields.io/github/stars/ajitashwathr10/face-detection-using-opencv?style=social)](https://github.com/ajitashwathr10/face-detection-using-opencv/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/ajitashwathr10/face-detection-using-opencv?style=social)](https://github.com/ajitashwathr10/face-detection-using-opencv/network)\n[![Issues](https://img.shields.io/github/issues/ajitashwathr10/face-detection-using-opencv)](https://github.com/ajitashwathr10/face-detection-using-opencv/issues)\n[![MIT License](https://img.shields.io/github/license/ajitashwathr10/face-detection-using-opencv)](LICENSE)\n\nThis repository contains a simple implementation of face detection using OpenCV and Python. The project uses Haar Cascades for detecting faces with the help of a picture.\n\n## Requirements\nTo run this project, you need to have the following libraries installed:\n- Python 3.12\n- OpenCV\n- NumPy\n\nYou can install the required libraries using `pip`:\n\n```bash\npip install opencv-python numpy\n```\n## Project Structure\n```bash\nFace-Detection-Using-OpenCV/\n│\n├── Face_Detection.ipynb         # Main script for face detection\n├── face_detection.xml           # Directory containing Haar Cascade XML files\n├── face_detected.png    \n├── README.md                # Project documentation\n└── female.png        \n```\n## Working\n1. Load the Haar Cascade XML file (pre-trained model).\n2. Load an image where faces need to be detected.\n3. Convert the image to grayscale (as the classifier works better on grayscale images).\n4. Detect faces in the image using the `cv2.CascadeClassifier` method.\n5. Draw bounding boxes around the detected faces.\n6. Save or display the image with the detected faces.\n\n## Code Explanation\nIn the `face_detection.py` file, the following steps are performed:\n1. Loading the Classifier:\n   The Haar Cascade XML file is loaded using cv2.CascadeClassifier:\n   ```bash\n   face_cascade = cv2.CascadeClassifier('haarcascades/haarcascade_frontalface_default.xml')\n   ```\n2. Capturing Video:\n   OpenCV captures video using the cv2.VideoCapture(0) method, where 0 refers to the default webcam.\n   ```bash\n   cap = cv2.VideoCapture(0)\n   ```\n3. Face Detection:\n   The image is first converted to grayscale using:\n   ```bash\n   gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)\n   ```\n   Then, faces are detected with:\n   ```bash\n   faces = face_cascade.detectMultiScale(gray, scaleFactor=1.1, minNeighbors=5, minSize=(30, 30))\n   ```\n4. Drawing Bounding Boxes:\n   Detected faces are highlighted with bounding boxes using:\n   ```bash\n   for (x, y, w, h) in faces:\n    cv2.rectangle(frame, (x, y), (x + w, y + h), (255, 0, 0), 2)\n   ```\n5. Displaying or Saving the Image:\n   The result is shown or saved with the bounding boxes drawn around face:\n   ```bash\n   cv2.imshow('Face Detection', image)\n   cv2.imwrite('output_image.jpg', image)\n   cv2.waitKey(0)\n   cv2.destroyAllWindows()\n   ```\n## Usage\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/ajitashwathr10/Face-Detection-Using-OpenCV.git\n   cd Face-Detection-Using-OpenCV\n   ```\n2. Place an image file in the project directory (or update the file path in the code).\n3. Run the main script:\n   ```bash\n   python face_detection.py\n   ```\n4. The image will be processed, and the detected faces will be highlighted with bounding boxes. The resulting image will either be displayed or saved as `output_image.jpg`.\n\n## Acknowledgements\n- This project uses the `Haar Cascade Classifier` provided by OpenCV.\n- Thanks to the OpenCV community for their valuable contributions.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajitashwath%2Fface-detection-using-opencv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajitashwath%2Fface-detection-using-opencv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajitashwath%2Fface-detection-using-opencv/lists"}