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

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:

主站蜘蛛池模板: 漳浦县| 兴海县| 莆田市| 图们市| 麦盖提县| 桦南县| 彭水| 德兴市| 镇巴县| 正镶白旗| 滨州市| 手游| 莲花县| 阳西县| 班玛县| 顺平县| 讷河市| 梓潼县| 江川县| 安远县| 南通市| 繁昌县| 宁阳县| 海原县| 曲靖市| 靖宇县| 富裕县| 天台县| 东丰县| 峨山| 罗定市| 曲阜市| 逊克县| 东光县| 莎车县| 砀山县| 阿瓦提县| 定日县| 浦城县| 兰坪| 定州市|