In this section, we are going to see how to draw shapes using OpenCV capabilities. Firstly, we will look at how to draw the basic shapes, and then we will focus on more advanced shapes.
Drawing shapes
Basic shapes – lines, rectangles, and circles
In the next example, we are going to see how to draw basic shapes in OpenCV. These basic shapes include lines, rectangles, and circles, which are the most common and simple shapes to draw. The first step is to create an image where the shapes will be drawn. To this end, a 400 400 image with the 3 channels (to properly display a BGR image) and a uint8 type (8-bit unsigned integers) will be created:
# We create the canvas to draw: 400 x 400 pixels, 3 channels, uint8 (8-bit unsigned...