March 2019
Intermediate to advanced
532 pages
13h 2m
English
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 integers)# We set the background to black using np.zeros()image = np.zeros((400, 400, 3), dtype="uint8")
We set the ...