官术网_书友最值得收藏!

Understanding advanced shapes

In this section, we are going to see how to draw clip lines, arrowed lines, ellipses, and polylines. These shapes are not as straightforward to draw as the shapes we saw in the previous section, but they are simple to understand. The first step is to create an image where the shapes will be drawn. For this, a 300  300 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: 300 x 300 pixels, 3 channels, uint8 (8-bit unsigned integers)
# We set the background to black using np.zeros()
image = np.zeros((300, 300, 3), dtype="uint8")

We set the background to light gray using the colors dictionary:

# If you want another background color, you can do the following:
image[:] = colors['light_gray']

At this point, we can start drawing the new shapes.

主站蜘蛛池模板: 曲靖市| 宜丰县| 奇台县| 仁怀市| 寿宁县| 琼海市| 香河县| 山阴县| 衡山县| 台山市| 新河县| 蒙山县| 鸡东县| 甘洛县| 六枝特区| 霍城县| 承德市| 通州市| 鄂州市| 盈江县| 区。| 峨边| 观塘区| 大同县| 禄丰县| 新化县| 北海市| 如东县| 滦南县| 安康市| 陕西省| 依兰县| 宁河县| 稻城县| 安阳县| 安吉县| 隆德县| 新昌县| 龙里县| 治多县| 肇源县|