- Mastering OpenCV 4 with Python
- Alberto Fernández Villán
- 164字
- 2021-07-02 12:07:21
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.
推薦閱讀
- 大學(xué)計算機基礎(chǔ)(第三版)
- Beginning Java Data Structures and Algorithms
- Servlet/JSP深入詳解
- Python金融數(shù)據(jù)分析
- Mastering Android Development with Kotlin
- 深入理解Elasticsearch(原書第3版)
- Android Wear Projects
- Natural Language Processing with Java and LingPipe Cookbook
- C/C++數(shù)據(jù)結(jié)構(gòu)與算法速學(xué)速用大辭典
- C++程序設(shè)計教程(第2版)
- 從程序員角度學(xué)習(xí)數(shù)據(jù)庫技術(shù)(藍(lán)橋杯軟件大賽培訓(xùn)教材-Java方向)
- 官方 Scratch 3.0 編程趣味卡:讓孩子們愛上編程(全彩)
- Oracle Database 12c DBA官方手冊(第8版)
- CISSP in 21 Days(Second Edition)
- 中小企業(yè)網(wǎng)站建設(shè)與管理(靜態(tài)篇)