CvMemStorage* storage;
CvSeq* circles;
storage = cvCreateMemStorage(0);
cvSmooth( img_bin, img_bin, CV_GAUSSIAN, 9, 9, 0 ,0 );
circles = cvHoughCircles( img_bin, storage, CV_HOUGH_GRADIENT,2,img_bin->height/4, 200, 100,1,5);
for(int i = 0; i < circles->total; i++ )
{
float* p = (float*)cvGetSeqElem( circles, i );
cvCircle( img_bin, cvPoint(cvRound(p[0]),cvRound(p[1])), 3, CV_RGB(0,255,0), -1, 8, 0 );
cvCircle( img_bin, cvPoint(cvRound(p[0]),cvRound(p[1])), cvRound(p[2]), CV_RGB(255,234,180), 3, 8, 0 );
}
Partager