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

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:

主站蜘蛛池模板: 盐边县| 花莲县| 宜兰县| 洞头县| 广南县| 齐河县| 晋江市| 南宫市| 密云县| 玉门市| 灌阳县| 白山市| 永寿县| 永兴县| 邢台县| 建平县| 信阳市| 广宗县| 济阳县| 南溪县| 河间市| 唐河县| 称多县| 睢宁县| 自治县| 高淳县| 灵川县| 贺州市| 筠连县| 孝昌县| 三穗县| 广汉市| 永胜县| 海淀区| 太原市| 中宁县| 林周县| 霍林郭勒市| 淮滨县| 昆山市| 车致|