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

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.

主站蜘蛛池模板: 陇西县| 镇宁| 六枝特区| 巴彦淖尔市| 海淀区| 五家渠市| 南陵县| 中阳县| 若尔盖县| 汤阴县| 凌源市| 行唐县| 巫山县| 高州市| 阿克| 黄龙县| 济阳县| 舞阳县| 裕民县| 广丰县| 新巴尔虎右旗| 连平县| 日照市| 城市| 金塔县| 东至县| 阿合奇县| 竹北市| 临湘市| 工布江达县| 梨树县| 岱山县| 拉孜县| 兴文县| 东光县| 沅陵县| 南丹县| 嵊泗县| 阿坝| 苍南县| 奉节县|