Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

CvHaarDetectObjects does not convert the img to grayscale. you've got to do that yourself before, using cvtColor().

and damn, use the C++ api, please!

CascadeClassifier cascade("opencv/data/hairycascades/bald.yml");
if ( cascade.empty())
{
    // could not find it
}

Mat img = imread("my.png");
Mat gray;
cvtColor(img,gray,CV_BGR2GRAY);

vector<Rect> faces;
cascade.detectMultiScale(gray,faces);
// process face-rects.