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

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.

主站蜘蛛池模板: 翼城县| 旬阳县| 昌邑市| 米易县| 丹寨县| 池州市| 浮山县| 宜州市| 衡山县| 宣城市| 德昌县| 安乡县| 惠来县| 顺义区| 安康市| 四子王旗| 庆安县| 阿勒泰市| 崇义县| 武威市| 沛县| 四川省| 突泉县| 宝丰县| 安阳县| 石首市| 上林县| 东兴市| 自治县| 丰顺县| 河池市| 延长县| 华坪县| 浠水县| 青田县| 广宗县| 华池县| 渝中区| 洮南市| 元氏县| 泸西县|