38 #include <visp3/core/vpConfig.h> 40 #if (VISP_HAVE_OPENCV_VERSION >= 0x020200) 44 #include <visp3/core/vpImageConvert.h> 45 #include <visp3/detection/vpDetectorFace.h> 47 bool vpSortLargestFace(cv::Rect rect1, cv::Rect rect2) {
return (rect1.area() > rect2.area()); }
105 bool detected =
false;
111 #if (VISP_HAVE_OPENCV_VERSION >= 0x030000) 114 m_face_cascade.detectMultiScale(frame_gray,
m_faces, 1.1, 2, 0 | CV_HAAR_SCALE_IMAGE, cv::Size(30, 30));
122 for (
size_t i = 0; i <
m_faces.size(); i++) {
123 std::ostringstream message;
124 message <<
"Face " << i;
129 std::vector<vpImagePoint> polygon;
132 double w =
m_faces[i].size().width;
133 double h =
m_faces[i].size().height;
146 #elif !defined(VISP_BUILD_SHARED_LIBS) 149 void dummy_vpDetectorFace(){};
cv::CascadeClassifier m_face_cascade
Haar cascade classifier file name.
void setCascadeClassifierFile(const std::string &filename)
static void convert(const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
error that can be emited by ViSP classes.
size_t m_nb_objects
Number of detected objects.
cv::Mat m_frame_gray
OpenCV image used as input for the face detection.
bool detect(const vpImage< unsigned char > &I)
std::vector< cv::Rect > m_faces
Bounding box of each detected face.
std::vector< std::vector< vpImagePoint > > m_polygon
For each object, defines the polygon that contains the object.
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
std::vector< std::string > m_message
Message attached to each object.