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

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.

主站蜘蛛池模板: 凉山| 中西区| 卢龙县| 青阳县| 温泉县| 松滋市| 巴塘县| 涡阳县| 湛江市| 武乡县| 自贡市| 汶上县| 康平县| 博客| 文昌市| 淮南市| 安新县| 班戈县| 怀集县| 香格里拉县| 芮城县| 民乐县| 白城市| 库尔勒市| 玉林市| 麻江县| 武邑县| 房产| 武冈市| 龙南县| 郧西县| 甘德县| 白河县| 正阳县| 中阳县| 阜康市| 安西县| 迁安市| 六枝特区| 桓台县| 栾城县|