38 #include <visp/vpConfig.h>
40 #if (VISP_HAVE_OPENCV_VERSION >= 0x020200)
44 #include <visp/vpDetectorFace.h>
45 #include <visp/vpImageConvert.h>
47 bool vpSortLargestFace(cv::Rect rect1, cv::Rect rect2)
49 return (rect1.area() > rect2.area());
56 m_faces(), m_face_cascade(), m_frame_gray()
87 bool detected =
false;
93 #if (VISP_HAVE_OPENCV_VERSION >= 0x030000)
104 for(
size_t i = 0; i <
m_faces.size(); i++ ) {
105 std::ostringstream message;
106 message <<
"Face " << i;
111 std::vector<vpImagePoint> polygon;
114 double w =
m_faces[i].size().width;
115 double h =
m_faces[i].size().height;
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::string > m_message
Message attached to each object.
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
std::vector< std::vector< vpImagePoint > > m_polygon
For each object, defines the polygon that contains the object.