Without any doubt, all of us can write the research program using C++ based on face detection. To make that process ease our research experts have offered this article. Let’s start this article with the creation of program.
Start and Create C++ Program
Initially, we have to use the visual studio to create the standard C++ programs through the below mentioned steps.
- We have to create a new project from File –> New Project and add the new file to the project and add C++ code
- Following that, we have to compile and run the program using visual studio
Face Detection Program Using C++
For instance, we have heighted the sample code based on C++ for the process which are highlighted below,
- To include required header files from OpenCV directory
#include “/usr/local/include/opencv2/objdetect.hpp”
#include “/usr/local/include/opencv2/highgui.hpp”
#include “/usr/local/include/opencv2/imgproc.hpp”
#include <iostream>
using namespace std;
using namespace cv;
- To colour conversion and re-size the images
cvtColor( img, gray, COLOR_BGR2GRAY );
ouble fx = 1 / scale;
resize( gray, smallImg, Size(), fx, fx, INTER_LINEAR );
equalizeHist( smallImg, smallImg );
- To detect faces of different sizes using cascade classifier
cascade.detectMultiScale( smallImg, faces, 1.1, 2, 0|CASCADE_SCALE_IMAGE, Size(30, 30) );
Most significantly, our research experts are upgrading themselves by in depth knowledge through the topic. Join us to get delightful work in your face detection research.