Open In App

cv2.circle() method

Last Updated : 13 Jun, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

OpenCV-Python is a library of Python bindings designed to solve computer vision problems. cv2.circle() method is used to draw a circle on any image. We use this image:

Example:

Python
import cv2
path = r'C:\Users\user\Desktop\geeks14.png'
src = cv2.imread(path)

cv2.circle(src, center=(100, 100), radius=50, color=(0, 255, 0), thickness=2)

cv2.imshow("Circle Drawn", src)
cv2.waitKey(0)
cv2.destroyAllWindows()

Output

Output

Explanation: cv2.imread() loads the image and cv2.circle() draws a circle centered at (100, 100) with a radius of 50 pixels. The color (0, 255, 0) specifies green in BGR format and thickness=2 draws a 2-pixel wide outline.

Syntax

cv2.circle(img, center, radius, color, thickness=None, lineType=None, shift=None)

Parameters:

Parameter

Description

img

Image on which to draw (NumPy array).

center

Center of the circle (x, y) as a tuple of integers.

radius

Radius of the circle in pixels.

color

Circle color as a BGR (Blue, Green, Red) tuple.

thickness

Circle outline thickness. If -1, the circle is filled.

lineType (Optional)

Circle boundary type. Default is 8-connected line.

shift (Optional)

Number of fractional bits in center coordinates and radius.


Returns: This function modifies the image directly. It does not return anything.

Examples

Example 1: In this example, we draw a filled red circle on the image.

Python
import cv2

path = r'C:\Users\user\Desktop\geeks14.png'
src = cv2.imread(path)

cv2.circle(src, center=(150, 150), radius=40, color=(0, 0, 255), thickness=-1)

cv2.imshow("Filled Red Circle", src)
cv2.waitKey(0)
cv2.destroyAllWindows()

Output

Output
Filled Red Circle

Explanation: cv2.imread() loads the image and cv2.circle() draws a filled red circle centered at (150, 150) with a radius of 40 pixels. The color (0, 0, 255) specifies red in BGR format and thickness = -1 fills the circle.

Example 2: In this example, we draw multiple circles of different colors and sizes on the image.

Python
import cv2

path = r'C:\Users\user\Desktop\geeks14.png'
src = cv2.imread(path)

# Draw multiple circles
cv2.circle(src, center=(50, 50), radius=20, color=(255, 0, 0), thickness=3)  # Blue circle
cv2.circle(src, center=(200, 200), radius=30, color=(0, 255, 0), thickness=5)  # Green circle
cv2.circle(src, center=(300, 100), radius=40, color=(0, 0, 255), thickness=2)  # Red circle

cv2.imshow("Multiple Circles", src)
cv2.waitKey(0)
cv2.destroyAllWindows()

Output

Output
Multiple Circles

Explanation: cv2.imread() loads the image and cv2.circle() draws blue, green and red circles at specified centers with different radii and thicknesses.

Example 3: In this example, we draw a large filled blue circle.

Python
import cv2

path = r'C:\Users\user\Desktop\geeks14.png'
src = cv2.imread(path)

cv2.circle(src, center=(250, 250), radius=60, color=(255, 0, 0), thickness=-1)  # Filled Blue Circle
cv2.circle(src, center=(250, 250), radius=60, color=(0, 255, 255), thickness=8) # Thick yellow outline

cv2.imshow("Thick Filled Circle", src)
cv2.waitKey(0)
cv2.destroyAllWindows()

Output

Output
Thick Filled Circle

Explanation: This draws a large filled blue circle at (250, 250) with radius 60. Then, a thick yellow outline (thickness=8) is drawn over the same circle to highlight it.


Next Article
Article Tags :
Practice Tags :

Similar Reads