Welcome to Jetson AGX Orin repository
当製品の日本語版マニュアル資料は、こちらからご取得ください。
14.Add ellipses
Add ellipses
1. Implementation principle
Use the cv2.ellipse() function to draw an ellipse on the image.
2. Implementation effect
cd ~/opencv
xxxxxxxxxxpython3 14.image_draw_ellipse.py
Note: Select the image and press q to exit the program!

3. Implementation code
ximport cv2def draw_ellipse(input_path, output_path, center, axes, angle, start_angle, end_angle, color, thickness):image = cv2.imread(input_path)if image is None:print("Error: Unable to open image file.")returncv2.ellipse(image, center, axes, angle, start_angle, end_angle, color, thickness)if cv2.imwrite(output_path, image):print(f"Image saved to {output_path}")cv2.imshow('Image Preview', cv2.imread(output_path))cv2.waitKey(0)cv2.destroyAllWindows()else:print("Error: Unable to save image file.")draw_ellipse('/home/jetson/opencv/images/yahboom_logo.png', \'/home/jetson/opencv/images/yahboom_logo_ellipse.png', \(400, 85), (375, 75), 0, 0, 360, (0, 255, 0), 2)