- Trending Categories
- Data Structure
- Operating System
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Draw an ellipse on an image using OpenCV
In this program, we will draw an ellipse on an image in using the OpenCV library. We will use the OpenCV function ellipse() for the same.
Step 1: Import cv2. Step 2: Read the image using imread(). Step 3: Set the center coordinates. Step 4: Set the axes length. Step 5: Set the angle. Step 6: Set start and end angle. Step 6: Set the color. Step 7: Set the thickness. Step 8: Draw the ellipse by passing the above parameters in the cv2.ellipse function along with the original image. Step 9: Display the final output.
import cv2 image = cv2.imread('testimage.jpg') center_coordinates = (120, 100) axesLength = (100, 50) angle = 0 startAngle = 0 endAngle = 360 color = (0, 0, 255) thickness = 5 image = cv2.ellipse(image, center_coordinates, axesLength, angle, startAngle, endAngle, color, thickness) cv2.imshow('Ellipse', image)
- Related Articles
- Draw rectangle on an image using OpenCV
- Draw a line on an image using OpenCV
- How to draw an ellipse in OpenCV using Java?
- How to draw an Ellipse in OpenCV using C++?
- How to draw markers on an image using Java OpenCV library?
- How to draw polylines on an image in OpenCV using Python?
- How to fit the ellipse to an object in an image using OpenCV Python?
- How to draw an arrowed line on an image in OpenCV Python?
- Performing an opening operation on an image using OpenCV
- Performing binary thresholding on an image using OpenCV
- Performing truncate thresholding on an image using OpenCV
- Performing zero thresholding on an image using OpenCV
- Upsampling an image using OpenCV
- Downsampling an image using OpenCV
- Histogram equalization on an image in OpenCV using Java.