Python OpenCV Circle Detection With HoughCircles

In this Python OpenCV article iam going to talk about Circle Detection With HoughCircles.

OpenCV also has a function for detecting circles, called HoughCircles. It works in a very
similar fashion to HoughLines, but where minLineLength and maxLineGap were the
parameters to discard or retain lines, HoughCircles has a minimum distance between
circles’ centers, minimum, and maximum radius of the circles. Here’s the obligatory.

 

 

Also you can check Python GUI Development Tutorials in the below link.

1: PyQt5 GUI Development Tutorials

2: TKinter GUI Development Tutorials

3: Pyside2 GUI Development Tutorials 

4: Kivy GUI Development Tutorials

 

 

 

So now this is the complete source code for this artilcle 

 

 

 

 

 

Also you need to have an image in your working directory, iam using this image.

Planet Image
Planet Image

 

 

 

 

OK at the top code first we have loaded our image and have done some conversion to the image.

 

 

 

 

So this is our HoughCircle algorithm for circle detection, it needs some parameters like input image, dp, minDistance, minRadious and maxRadious

 

 

 

OK now this line of code is for drawing two circles, an outer big circle and a inner small circle.

 

 

 

 

And this is for showing of our image.

 

 

 

 

 

So now run the complete code and this will be the result

Python OpenCV Circle Detection With HoughCircles
Python OpenCV Circle Detection With HoughCircles

 

 

 

 

 

Also Watch the complete video for this article 

Share via
Copy link
Powered by Social Snap