1

对于霍夫圆变换,当我检测到圆时,如何获得圆的半径和中心点的值?我正在做一个虹膜识别系统。

CvSeq* circles = cvHoughCircles(grayscaleImg,
                     storage,
                     CV_HOUGH_GRADIENT,
                     2,
                     grayscaleImg->height/4,
                     200,
                 100 );

for (i = 0; i < circles->total; i++) 
{
     float* p = (float*)cvGetSeqElem( circles, i );
     cvCircle( capturedImg, cvPoint(cvRound(p[0]),cvRound(p[1])), 
        3, CV_RGB(0,255,0), -1, 8, 0 );
     cvCircle( capturedImg, cvPoint(cvRound(p[0]),cvRound(p[1])), 
         cvRound(p[2]), CV_RGB(0,0,255), 3, 8, 0 );
}
4

1 回答 1

2

中心点:cvPoint(cvRound(p[0]),cvRound(p[1]))

半径 :cvRound(p[2])

于 2012-10-06T17:42:31.427 回答