I have seen this code that draws an outline circle and its center point to the ball detected.
// draws all detected circle and their center points.
for (int i = 0; i < circles->total; i++)
// round the floats to an int
float* p = (float*)cvGetSeqElem(circles, i);
cv::Point center(cvRound(p), cvRound(p));
int radius = cvRound(p);
c = cvGet2D(img, center.x, center.y);//colour of circle
// draw the circle center
cvCircle(img, center, 3, CV_RGB(0,255,0), -1, 8, 0 );
// draw the circle outline
cvCircle(img, center, radius+1, CV_RGB(0,0,255), 2, 8, 0 );
printf("x: %d y: %d r: %d\n",center.x,center.y, radius);
I want to print the number of balls detected. How can i do that?
1 Year Ago
Related Article:C/C++ Matrix Algorithm
is a solved C++ discussion thread by Vectorizm that has 14 replies, was last updated 10 months ago and has been tagged with the keywords: c, c++, matrix, algorithm.