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[0]), cvRound(p[1]));
int radius = cvRound(p[2]);
cvScalar c;
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 );
//display coordinates
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?
2
Contributors
2
Replies
8 Hours
Discussion Span
1 Year Ago
Last Updated
3
Views
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.