This project provides a simple, yet classic, implementation of real-time face detection using the Haar Cascade classifier from the OpenCV (Open Source Computer Vision Library).
The Haar Cascade algorithm is a machine learning-based approach where a cascade function is trained from a large number of positive (images with faces) and negative (images without faces) images. This technique is highly effective for fast, robust, and real-time object detection.
- Face Detection: Accurately identifies human faces in a static image.
- Bounding Box Visualization: Draws a rectangle around each detected face.
- Lightweight Implementation: Relies primarily on the optimized OpenCV library.
- Jupyter Notebook Interface: Easy-to-follow, interactive execution via
prj.ipynb.
| Technology | Purpose | Icon |
|---|---|---|
| Python | Primary programming language | 🐍 |
OpenCV (cv2) |
Core computer vision and Haar Cascade engine | 🤖 |
| Matplotlib | Visualization of the final output image | 🖼️ |
| Jupyter Notebook | Interactive environment for running the code | 📓 |
This repository contains the necessary files to execute the face detection program.
| File Name | Description | Icon |
|---|---|---|
prj.ipynb |
The main Jupyter Notebook containing all the detection code. | [code: prj.ipynb] |
haarcascade_frontalface_default.xml |
The pre-trained Haar Cascade classifier XML file for frontal face detection. This is essential for the OpenCV process. | [code: haarcascade_frontalface_default.xml] |
image.jpg |
A sample image used by the notebook for demonstration purposes. | [code: image.jpg] |
.gitignore |
Standard file for ignoring temporary/unwanted files. | [code: .gitignore] |
To run this project, you need Python and the core libraries installed.
Ensure you have Python 3.x installed on your system.
Install the required libraries using pip. It is highly recommended to use a virtual environment.
# Create a virtual environment (optional but recommended)
python -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`
# Install required libraries
pip install opencv-python matplotlib jupyter