書名: Mastering OpenCV 4 with Python作者名: Alberto Fernández Villán本章字?jǐn)?shù): 90字更新時(shí)間: 2021-07-02 12:07:20
Drawing lines
The first function we are going to see is cv2.line(). The signature is as follows:
img = line(img, pt1, pt2, color, thickness=1, lineType=8, shift=0)
This function draws a line on the img image connecting pt1 and pt2:
cv2.line(image, (0, 0), (400, 400), colors['green'], 3)
cv2.line(image, (0, 400), (400, 0), colors['blue'], 10)
cv2.line(image, (200, 0), (200, 400), colors['red'], 3)
cv2.line(image, (0, 200), (400, 200), colors['yellow'], 10)
After coding these lines, we call the show_with_matplotlib(image, 'cv2.line()') function. The result is shown in the next screenshot:

推薦閱讀
- 大學(xué)計(jì)算機(jī)基礎(chǔ)(第二版)
- JavaScript高效圖形編程
- Power Up Your PowToon Studio Project
- C# 從入門到項(xiàng)目實(shí)踐(超值版)
- Git高手之路
- Bootstrap Essentials
- Python機(jī)器學(xué)習(xí)基礎(chǔ)教程
- 基于ARM Cortex-M4F內(nèi)核的MSP432 MCU開發(fā)實(shí)踐
- Orleans:構(gòu)建高性能分布式Actor服務(wù)
- RubyMotion iOS Develoment Essentials
- 算法設(shè)計(jì)與分析:基于C++編程語言的描述
- Arduino機(jī)器人系統(tǒng)設(shè)計(jì)及開發(fā)
- Modernizing Legacy Applications in PHP
- JavaScript設(shè)計(jì)模式與開發(fā)實(shí)踐
- JSP大學(xué)實(shí)用教程