Ask Your Question

Revision history [back]

Houghcircles not acting properly

I have an application where I need to look at multiple [almost] concentric circles. I have been having issues using HoughCircles and so, I decided to create a test image with a single circle. My image was created with the following command:

cv::Mat img = cv::Mat::zeros ( 480, 640, CV_8UC1 );
cv::circle ( img, cv::Point(200,200), 175, cv::Scalar(0XFF), 1);

I tried to run HoughCircles on this image as follows:

std::vector<cv::Vec3f> circles;
cv::HoughCircles(img, circles, cv::HOUGH_GRADIENT, 1, 10, 239, 20 );

I get a plethora of circles when there is clearly only one circle in the input image. I have been struggling with this for a while now and will appreciate any help. I should mention that these circles are off-center from where I created the center (200,200), and their radius is all over the place as well.