Add Shapes
Explore how to draw basic shapes like circles, rectangles, and lines on images using OpenCV functions. Understand the required parameters for each shape and how to display the edited image, enabling you to highlight specific areas within images clearly and efficiently.
We'll cover the following...
Imagine we want to put a certain shape, such as a rectangle, around a specific portion of an image to draw the viewer’s attention. It takes a very long time to add borders to all the images. Instead, we can use OpenCV to draw the required shapes on those images much more easily.
In this lesson, we’ll draw different shapes on the image below. We’ll draw a circle around one of the balls, a rectangle around a button, and a line on the diagonal.
Draw the circle
To draw a circle, we use the cv2.circle() function of the OpenCV library. This function requires five parameters, which are listed below: ...