OpenCV Draw Circle

OpenCV Draw Circle

This tutorial will discuss drawing circles on images using the circle() function of OpenCV in Python.

Use the circle() Function of OpenCV to Draw Circles on Images in Python

We can use the circle() function of OpenCV to draw circles on images with our desired location, radius, color, thickness, and line type.

The first argument of the circle() function is the image we want to draw the circle. The second argument is the center point of the circle, and its value should be a point containing the x and y-axis values of a pixel that we want to use as the center of the circle.

The location starts from the top-left corner of an image. The third argument is the circle’s radius, and its value can be any integer. The fourth argument is the circle’s color, and it should be a BGR triplet value like (0,0,255) for red color.

The arguments mentioned above are mandatory, and if one of them is missing, there will be an error.

For example, let’s read an image using the imread() function of OpenCV and then use the circle() function to draw the circle on the image and show it using the imshow() function of OpenCV. See the code below.

import cv2

img = cv2.imread("cat.jpg")
imgWC =,(110,110),100,(0,0,255))

cv2.imshow('Image With Circle',imgWC)


circle on image

There are three other optional arguments that we can change. The optional argument has a default value that will be used.

Suppose we don’t define a value for the optional arguments. The first optional argument is the thickness of the circle, which we can set to any integer.

The second optional argument is the line type or style, set to cv2.LINE_8 by default. The third optional argument is the shift value we want to use as fractional bits in the center and radius value coordinated.

For example, let’s change the optional arguments like thickness to 10 and line type to cv2.LINE_AA. See the code below.

import cv2

img = cv2.imread("cat.jpg")
imgWC =,(110,110),100,(0,0,255),10,cv2.LINE_AA)

cv2.imshow('Image With Circle',imgWC)


optional argumets of circle

If we set the circle thickness to a negative value, it will fill the circle area with color.

There are also other functions available for different shapes like a rectangle() to draw a rectangle on an image, line() to draw a line, ellipse() to draw ellipse, and putText() to put text on images.

Author: Ammar Ali
Ammar Ali avatar Ammar Ali avatar

Hello! I am Ammar Ali, a programmer here to learn from experience, people, and docs, and create interesting and useful programming content. I mostly create content about Python, Matlab, and Microcontrollers like Arduino and PIC.

LinkedIn Facebook

Related Article - Python OpenCV

  • Image Masking in OpenCV
  • Use OpenCV Library to Draw a Circle
  • Utilize Bitwise_AND on an Image Using OpenCV
  • OpenCV Package Configuration
  • OpenCV ArUco Markers
  • SIFT Using OpenCV in Python