模型包括眼睛耳朵鼻子嘴巴眼镜等模型,可以直接用opencv10调用,使用极其方便
CvMemStorage* storage1 = 0;
storage1 = cvCreateMemStorage(0) ;
CvHaarClassifierCascade* cascade_e = 0;
const char* cascade_name2 = "haarcascade_eye.xml";
cascade_e = (CvHaarClassifierCascade*)cvLoad( cascade_name2, 0, 0, 0 );
assert(cascade_e != NULL);
//storage = cvCreateMemStorage(0) ;
CvSeq *eyes = cvHaarDetectObjects(
img,
cascade_e,
storage1,
1.1,
3,
0,
cvSize(4, 5)
);
int i;
for( i = 0; i < (eyes ? eyes->total : 0); i++ )
{
CvRect *eye = (CvRect*)cvGetSeqElem(eyes, i);
cvRectangle(
img,
cvPoint(eye->x, eye->y),
cvPoint(eye->x + eye->width, eye->y + eye->height),
CV_RGB(255, 0, 0),
1, 8, 0);
}
//cvResetImageROI(img);