Search code examples
matlabimage-processingcomputer-visionimage-segmentationhough-transform

how to detect circles in an image using hough transform withough imfindcircle function?


I need to find circles in an image using MATLAB (circles) but without the built-in functions like imfindingcircle() or any other functions similar to that. I want to implement the Hough algorithm for circle detection and in the end I need to find a way to show the results.

Any help will be appreciated.


Solution

  • So you just want to implement the Hough Transform? This is not that difficult...

    1. Define your Hough Space (for circles, you need a 3D Hough Space for the parameters (x_c,y_c,r), the center point of the circle and its radius)
    2. Apply Edge Detection to your source image
    3. Loop over all Edge points with a gradient magnitude larger than a certain threshold
    4. Find all solutions to the circular Hough Transform equation and add them as votes to your Hough Space
    5. Find the maximum or maxima in the Hough Space. These are the parameters describing your circles.