# Revision history [back]

@FooBar I got a good result when I used your code, but when I used webcam to track the tennis ball, I got a bad result. There were many wrong circle drew arround this ball but no right circle drew cover this ball. Here is my code : capture >> col; cvtColor(col.clone(),src,CV_BGR2GRAY); equalizeHist(src,src); GaussianBlur( src, src, Size(9, 9), 2, 2 ); if(src.empty()) { cout<< "can't load file from webcam" <<endl; }<="" p="">

        int canny_threshold = 200;

vector<Vec3f> circles;
1, // dp
50, // min_dist_px
canny_threshold, // higher canny
20, // acc threshold

for(int i=0;i<circles.size(); i++)
{
Point center(cvRound(circles[i][0]),cvRound(circles[i][1]));
}

imshow("Window1",col);
char c = waitKey(33);
if(c==27) break;
}


Can you help me about this problem ? I will attach the bad result I got when I run my program at here C:\fakepath\Untitled2.png Have a great day !

@FooBar I got a good result when I used your code, but when I used webcam to track the tennis ball, I got a bad result. There were many wrong circle drew arround this ball but no right circle drew cover this ball. Here is my code : capture >> col; cvtColor(col.clone(),src,CV_BGR2GRAY); equalizeHist(src,src); GaussianBlur( src, src, Size(9, 9), 2, 2 ); if(src.empty()) { cout<< "can't load file from webcam" <<endl; }<="" p="">

        int canny_threshold = 200;

vector<Vec3f> circles;
1, // dp
50, // min_dist_px
canny_threshold, // higher canny
20, // acc threshold

for(int i=0;i<circles.size(); i++)
{
Point center(cvRound(circles[i][0]),cvRound(circles[i][1]));