![]() |
VOOZH | about |
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.
Output
Explanation:
cv2.ellipse(image, center, axes, angle, startAngle, endAngle, color, thickness)
Parameters:
Note: The axes parameter takes semi-axis lengths (radii), not full axis lengths. For example, if the ellipse width is 200 pixels, the semi-major axis value should be 100.
Example 1: This example draws a filled blue ellipse with no rotation.
Output
Explanation:
Example 2: This example draws a rotated green ellipse at 45 degrees.
Output
Explanation:
Example 3: This example draws a partial red arc (not a full ellipse).
Output
Explanation: