Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked 2015-07-31 11:23:01 -0600

Nbb gravatar image

Standard Hough Circle Detection

Hello forum,

Ive been trying to write the code for the standard hough circle detection but have not succeded. The code (very simple) is shown below. Basically i perform canny edge detection and then loop through the output and draw a circle when the pixel is not a zero.

int main(int argc, char** argv)
{

image = imread("image.png",CV_LOAD_IMAGE_GRAYSCALE);
image.copyTo(output);

Canny(output, output, 100, 200, 3);

Mat drawing = Mat::zeros(image.size(), CV_8UC1);

for (int i = 0; i < output.rows; i++)
    for (int j = 0; j < output.cols; j++)
        if (output.at<uchar>(i, j) != 0) circle(drawing, Point(i, j), 4, 10, 1, 8, 0);
}

The problem is, i thought that when 2 circles are drawn overlapping each other, the intersecting pixels would be "brighter". I dont think I should draw each circle on a separate matrix to be added after the double for loop so is there anyway I can write the standard HCT without having too many matrices ?

Haziq