- 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.
推薦閱讀
- scikit-learn Cookbook
- Python應用輕松入門
- PhpStorm Cookbook
- Jenkins Continuous Integration Cookbook(Second Edition)
- Learning jQuery(Fourth Edition)
- Building Serverless Web Applications
- Python Machine Learning Blueprints:Intuitive data projects you can relate to
- 寫給大家看的Midjourney設計書
- PHP+MySQL動態網站開發從入門到精通(視頻教學版)
- Spark技術內幕:深入解析Spark內核架構設計與實現原理
- 3D Printing Designs:The Sun Puzzle
- Mastering Drupal 8
- Python面向對象編程(第4版)
- Visual C++程序開發范例寶典
- Instant AppFog