Git Product home page Git Product logo

hough-circle-detection's Introduction

Hough-Circle-Detection

Implementation of Simple Hough Circle Detection Algorithm in Python.
This is based on paper Use of the Hough Transformation To Detect Lines and Curves in Pictures by Richard O. Duda and Peter E. Hart.
This is an extension of the Hough Transform to detect circles using the equation,
        r^2 = ( x - a )^2 + ( y - b )^2         in parameter space rho = ( a, b, r)

Please refer to Hough Line Detection python implementation at the following git repository for more information.

Usage

''' python find_hough_circles.py ./images/ex1.png --r_min 10 --r_max 200 --delta_r 1 --num_thetas 100 --bin_threshold 0.4 --min_edge_threshold 100 --max_edge_threshold 200 '''

Input

The script requires one positional argument and few optional parameters:

  • image_path - Complete path to the image file for circle detection.
  • r_min - Min radius circle to detect. Default is 10.
  • r_max - Max radius circle to detect. Default is 200.
  • delta_r - Delta change in radius from r_min to r_max. Default is 1.
  • num_thetas - Number of steps for theta from 0 to 2PI. Default is 100.
  • bin_threshold - Thresholding value in percentage to shortlist candidate for circle. Default is 0.4 i.e. 40%.
  • min_edge_threshold - Minimum threshold value for edge detection. Default 100.
  • max_edge_threshold - Maximum threshold value for edge detection. Default 200.

Output

The output of the script would be two files:

  • circles.txt - List of circles in format (x,y,r,votes)
  • circle_img.png - Image with the Circles drawn in Green color.

Samples

Sample Input Image Sample Output Image Post-Processed Output Image
Sample Input Image Sample Output Image Post-processed Output Image
Sample Input Image Sample Output Image Post-processed Output Image
Sample Input Image Sample Output Image Post-processed Output Image
Sample Input Image Sample Output Image Post-processed Output Image

hough-circle-detection's People

Contributors

adityaintwala avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

hough-circle-detection's Issues

Detect Center of Circles outside the image

Hi, I just read your code. Is there a way to detect center of circles which are over the border of the image? Also, the size of the accumulator can also be arbitrary? Thanks!

Detect Arcs

Could this easily be extended to optionally support detecting arcs?

There are no such examples around, so this would have educational value.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.