0

此代码每帧返回很多面孔。我想每帧只获得一张脸,有什么代码或方法可以实现吗?

我的代码是:

CvSeq * detectRect_face; 
detectRect_face = cvHaarDetectObjects(frame, pCascade_face, storage,1.15, 3, 0,cvSize(100,100));

for(int i=0;i<(detectRect_face ? detectRect_face->total:0); i++ )
    {
        CvRect* r = (CvRect*)cvGetSeqElem(detectRect_face, i); 
        CvPoint pt1 = { r->x, r->y }; 
        CvPoint pt2 = { r->x + r->width, r->y + r->height }; 
        cvRectangle(frame, pt1, pt2, CV_RGB(255,0,0), 1,8, 0); 

    }
4

0 回答 0