# How to Draw Ellipse in OpenCV Python

You can draw an ellipse in OpenCV Python by following the given steps. I highly recommend you get the “Computer Vision: Models, Learning, and Inference Book” to learn Computer Vision.

## Step 1

Import the OpenCV library. If OpenCV is not installed in your system then first install it using This Method.

```import cv2
#cv2 is used for OpenCV library```

## Step 2

Now read the image from the location. In my case “C:\\AiHints” is the location and “AI.jpg” is the name of the image. Change it according to your image location and name.

```image = cv2.imread("C:\\AiHints\\AI.jpg")

## Step 3

Now I will draw an ellipse on the image using the following code. In the code, (70,150) is the center point of the ellipse, and (100,50) is the axes length (major axis, minor axis). 90 is the rotation angle, 0 is starting angle and 180 is ending angle. After that, I will specify a color for the ellipse (0,255,0) that is green color. In the end, -1 is to fill the ellipse with the color. You can change any value according to your requirement.

`image2 = cv2.ellipse(image,(70,150),(100,50),90,0,180,(0,255,0),-1) `

## Step 4

To display the image in a specified window use ”imshow” function.

`cv2.imshow("Green Ellipse on Image",image2)`

## Step 5

“waitKey(0)” will display a window until any key is pressed. “destroyAllWindows()” will destroy all the windows that we created.

```cv2.waitKey(0)
cv2.destroyAllWindows()```
{"ft_lang_label":"__label__en","ft_lang_prob":0.81482995,"math_prob":0.7962056,"size":1423,"snap":"2023-40-2023-50","text_gpt3_token_len":378,"char_repetition_ratio":0.122621566,"word_repetition_ratio":0.0,"special_character_ratio":0.28039354,"punctuation_ratio":0.15974441,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.95507294,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-12-04T09:05:50Z\",\"WARC-Record-ID\":\"<urn:uuid:96fba8df-a194-4da5-bf0e-a62da03b1076>\",\"Content-Length\":\"141970\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:d7cc3478-b522-4c1c-a0da-8d8861eef06f>\",\"WARC-Concurrent-To\":\"<urn:uuid:2dc39733-b18a-4ab4-815c-6656e0c748f1>\",\"WARC-IP-Address\":\"3.210.81.252\",\"WARC-Target-URI\":\"https://aihints.com/how-to-draw-ellipse-in-opencv-python/\",\"WARC-Payload-Digest\":\"sha1:Y44E2NBGAJF3WOJSMEJTAXWYNW7G5BSB\",\"WARC-Block-Digest\":\"sha1:DMPAECOLYJIKONKDMAGWGVTGBZH5DV3F\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-50/CC-MAIN-2023-50_segments_1700679100527.35_warc_CC-MAIN-20231204083733-20231204113733-00488.warc.gz\"}"}