cv2.ellipse() method - Python OpenCV

Last Updated : 22 Jan, 2026

cv2.ellipse() method in OpenCV is used to draw an ellipse on an image. It allows you to control the ellipse’s position, size, rotation, color and thickness making it useful for highlighting regions, marking detected objects or creating shapes in image processing tasks.

Note: For this article we will use a sample image "logo.png", to download click here.

Example: This example loads an image and draws a red ellipse with no rotation using minimal parameters.

Python
import cv2

img = cv2.imread("logo.png")

center = (120, 100)
axes = (80, 40)
img = cv2.ellipse(img, center, axes, 0, 0, 360, (0, 0, 255), 3)

cv2.imshow("Ellipse", img)
cv2.waitKey(0)
cv2.destroyAllWindows()

Output

Output
Output

Explanation:

  • cv2.ellipse(img, center, axes, ...): draws the ellipse on the image
  • center: position of the ellipse
  • axes: lengths of major & minor axes
  • 0, 0, 360: no rotation, full ellipse
  • (0, 0, 255): red color (BGR)
  • 3: border thickness

Syntax

cv2.ellipse(image, center, axes, angle, startAngle, endAngle, color, thickness)

Parameters:

  • image: Image on which ellipse is drawn.
  • center: Center of ellipse as (x, y).
  • axes: Tuple (major axis, minor axis) lengths.
  • angle: Rotation of ellipse in degrees.
  • startAngle: Starting angle of arc.
  • endAngle: Ending angle of arc.
  • color: BGR color tuple.
  • thickness: Border thickness (-1 fills the ellipse).

Example 1: This example draws a filled blue ellipse with no rotation.

Python
import cv2

img = cv2.imread("logo.png")

center = (100, 80)
axes = (70, 40)

img = cv2.ellipse(img, center, axes, 0, 0, 360, (255, 0, 0), -1)

cv2.imshow("Ellipse 1", img)
cv2.waitKey(0)
cv2.destroyAllWindows()

Output

Output1
Shows a filled blue ellipse

Explanation:

  • -1: fills the ellipse
  • (255, 0, 0): blue color
  • 0 rotation: straight ellipse

Example 2: This example draws a rotated green ellipse at 45 degrees.

Python
import cv2

img = cv2.imread("logo.png")

center = (150, 120)
axes = (90, 50)

img = cv2.ellipse(img, center, axes, 45, 0, 360, (0, 255, 0), 4)

cv2.imshow("Ellipse 2", img)
cv2.waitKey(0)
cv2.destroyAllWindows()

Output

Output2
Ellipse rotated by 45°

Explanation:

  • 45: rotates ellipse
  • (0, 255, 0): green color
  • 4: thicker border

Example 3: This example draws a partial red arc (not a full ellipse).

Python
import cv2

img = cv2.imread("logo.png")

center = (120, 100)
axes = (100, 60)

img = cv2.ellipse(img, center, axes, 0, 0, 180, (0, 0, 255), 3)

cv2.imshow("Ellipse 3", img)
cv2.waitKey(0)
cv2.destroyAllWindows()

Output

Output3
Shows a semi-ellipse arc

Explanation:

  • 0, 180: draws only half ellipse
  • (0, 0, 255): red arc
  • 3: border thickness
Comment

Explore