Python OpenCV
About Lesson

In this Python OpenCV lesson we are going to learn about Python OpenCV Circle Detection, so OpenCV 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.

 

 

This is the complete code for this lesson.

 

 

 

We want to use this image for circle detection.

OpenCV Circle Detection
OpenCV Circle Detection

 

 

 

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

 

 

 

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

 

 

 

Run the complete code and this is the result.

Python OpenCV Circle Detection
Python OpenCV Circle Detection