- 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.
推薦閱讀
- Flask Web全棧開發實戰
- Advanced Splunk
- Kali Linux Web Penetration Testing Cookbook
- Java從入門到精通(第4版)
- Python Deep Learning
- Getting Started with CreateJS
- 數據結構(Python語言描述)(第2版)
- Java EE 7 Development with NetBeans 8
- C程序設計案例教程
- AIRIOT物聯網平臺開發框架應用與實戰
- 移動互聯網軟件開發實驗指導
- HTML+CSS+JavaScript網頁設計從入門到精通 (清華社"視頻大講堂"大系·網絡開發視頻大講堂)
- 軟件測試分析與實踐
- PHP+MySQL Web應用開發教程
- JavaScript語法簡明手冊