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

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:

主站蜘蛛池模板: 淄博市| 蕉岭县| 垦利县| 莱州市| 临清市| 洪湖市| 无为县| 汾西县| 岐山县| 峨眉山市| 阿勒泰市| 毕节市| 竹山县| 赤城县| 犍为县| 江津市| 内乡县| 伊通| 武夷山市| 阿图什市| 东至县| 汉寿县| 玉树县| 津南区| 松原市| 绥德县| 乌海市| 宁津县| 奉节县| 兴业县| 修文县| 余庆县| 中方县| 柳州市| 嘉祥县| 宁海县| 通化市| 龙岩市| 吕梁市| 无极县| 二连浩特市|