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

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:

主站蜘蛛池模板: 陆川县| 浪卡子县| 宣武区| 雷山县| 旬阳县| 廉江市| 邵东县| 湘潭县| 雅江县| 灵武市| 延寿县| 呼和浩特市| 会同县| 京山县| 武冈市| 江安县| 南康市| 探索| 西林县| 江华| 佛山市| 寻甸| 许昌县| 新晃| 锦州市| 古蔺县| 青龙| 汝阳县| 攀枝花市| 北辰区| 南乐县| 景洪市| 手游| 西充县| 富宁县| 凉山| 永嘉县| 湖南省| 昭平县| 屯昌县| 台南市|