0

このコードは、フレームごとに多くの顔を返しています。フレームごとに 1 つの顔だけを取得したいのですが、これを実現するコードまたは方法はありますか?

私のコードは次のとおりです。

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