This C++ project demonstrates how to use the OpenCV library to perform face detection in an image. It imports the following OpenCV headers:
opencv2/objdetect/objdetect.hpp
opencv2/imgproc/imgproc.hpp
opencv2/highgui/highgui.hpp
The provided C++ code performs the following tasks:
-
It loads a pre-trained Haar Cascade Classifier for face detection.
-
It prompts the user to enter the path to an image file for face detection.
-
The code reads the specified image and performs face detection on it.
-
Detected faces are highlighted with red rectangles in the image.
-
The processed image is saved as "output.jpg."
To run this project, you need the following prerequisites:
-
C++ Compiler: Ensure that you have a C++ compiler (e.g., g++) installed on your system.
-
OpenCV: OpenCV must be installed on your system. You can download and install OpenCV from the official website: OpenCV Downloads.
To run the provided C++ code:
-
Clone this repository to your local machine using Git:
git clone https://github.com/deepak-gurjar07/FaceDetectioninCpp
-
Navigate to the project directory:
cd "FaceDetectioninCpp\Face Recognisation\Face Recognisation"
-
Compile the code using your C++ compiler:
g++ -o main FD.cpp `pkg-config --cflags --libs opencv`
-
Run the compiled executable:
./main
You can modify the code to use your own image path or make any desired improvements to the face detection process.
This project is open source and distributed under the MIT License. You are free to use, modify, and distribute it as per the terms of the license.
Please feel free to reach out if you have any questions or need further assistance with this project.
Happy face detection!