I think I look better than you, because it works here (under OS X). Are you really uploaded xml files? Do you use the default xml files (haarcascade_frontalface_alt.xml and haarcascade_eye_tree_eyeglasses.xml)?
I am sure that you have a null pointer. Try setting a breakpoint when calling cascade.detectMultiScale()
and check the values ββof cascade
, smallImg
, smallImg.data
and faces
.
Edit: filling faces
vector
Here's the detectMultiScale
code:
void HaarClassifierCascade::detectMultiScale( const Mat& image, Vector<Rect>& objects, double scaleFactor, int minNeighbors, int flags, Size minSize ) { MemStorage storage(cvCreateMemStorage(0)); CvMat _image = image; CvSeq* _objects = cvHaarDetectObjects( &_image, cascade, storage, scaleFactor, minNeighbors, flags, minSize ); Seq<Rect>(_objects).copyTo(objects); }
This does not apply to the faces
vector to the last line after detection is complete. If you are adventurous, you can drop a few printf
statements here to find out if cvHaarDetectObjects
and whether it returns a null pointer.
source share