Search⌘ K

Adding Shapes

Explore how to draw basic shapes such as circles, rectangles, and lines on images using OpenCV in C++. Learn the parameters and functions required to highlight image regions and customize shapes for better image editing.

What if 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’ll take a very long time to add those borders to a large number of images. But we have a better idea: we’ll use OpenCV to draw the required shapes on those images.

In this lesson, we’ll draw different shapes in the code widgets below.

Drawing a circle

To draw a circle, we’ll use the circle() function of the OpenCV library. We’ll have five parameters inside this function.

...