24 #include <fvclassifiers/faces.h> 26 #include <core/exception.h> 27 #include <core/exceptions/software.h> 28 #include <fvutils/color/colorspaces.h> 29 #include <fvutils/color/conversions.h> 30 #include <fvutils/adapters/iplimage.h> 33 #include <opencv/cv.h> 65 unsigned int pixel_width,
unsigned int pixel_height,
67 float haar_scale_factor,
int min_neighbours,
int flags)
70 __haar_scale_factor = haar_scale_factor;
71 __min_neighbours = min_neighbours;
74 __cascade = (CvHaarClassifierCascade *) cvLoad(haarcascade_file);
79 __storage = cvCreateMemStorage(0);
81 cvReleaseHaarClassifierCascade(&__cascade);
89 __image = cvCreateImage(cvSize(pixel_width, pixel_height), IPL_DEPTH_8U, 3);
98 cvReleaseHaarClassifierCascade(&__cascade);
99 cvReleaseMemStorage(&__storage);
101 cvReleaseImage(&__image);
109 std::list< ROI > *rv =
new std::list< ROI >();
115 CvSeq *face_seq = cvHaarDetectObjects(__image, __cascade, __storage,
116 __haar_scale_factor, __min_neighbours, __flags);
118 for (
int i = 0; i < face_seq->total; ++i) {
119 CvAvgComp el = *(CvAvgComp*)cvGetSeqElem(face_seq, i);
120 ROI r(el.rect.x, el.rect.y, el.rect.width, el.rect.height,
_width,
_height);
unsigned int _width
Width in pixels of _src buffer.
unsigned int _height
Height in pixels of _src buffer.
FacesClassifier(const char *haarcascade_file, unsigned int pixel_width, unsigned int pixel_height, IplImage *image=0, float haar_scale_factor=1.1, int min_neighbours=3, int flags=0)
Constructor.
Base class for exceptions in Fawkes.
static void convert_image_bgr(unsigned char *buffer, IplImage *image)
Convert image from buffer into IplImage.
virtual ~FacesClassifier()
Destructor.
Classifier to extract regions of interest.
unsigned int num_hint_points
Minimum estimate of points in ROI that are attributed to the ROI hint.
virtual std::list< ROI > * classify()
Classify image.
unsigned char * _src
Source buffer, encoded as YUV422_PLANAR.