# _*_ encoding: utf-8 _*_

__author__ = 'Vincent'
__date__ = '2019/3/16 16:41'

import cv2
import numpy as np
newImageInfo = (500, 500, 3)
dst = np.zeros(newImageInfo, np.uint8)
# 绘制线段 1. dst(图片数据) 2.起始点 3.终止点 4.颜色
# cv2.line(dst, (100, 100), (400, 400), (0, 0, 255))
# cv2.line(dst, (400, 100), (100, 400), (0, 255, 255), 20)#最后的参数表明线段的宽度
# cv2.line(dst, (100, 300), (400, 300), (0, 255, 0), 10, cv2.LINE_AA)#最后的参数表明线段的类型

# 绘制三角形
# cv2.line(dst, (250, 100), (100, 400), (255,0,255),15)
# cv2.line(dst, (250, 100), (400, 400), (255,0,255),15)
# cv2.line(dst, (100, 400), (400, 400), (255,0,255),15)


# 绘制矩形 dst  2.左上角  3.右下角 4.颜色 5.fill = -1(表示填充) >0(表示线条的宽度)
# cv2.rectangle(dst, (50, 100), (200, 300),(255, 0, 0),-1)

# 绘制圆形
# cv2.circle(dst, (250, 250), (100), (255, 30, 70), -1)

# 绘制圆弧 dst 2.中心  3.长短轴 4.旋转角度 5.起始角度 6.结束角度 7. 颜色 8.颜色的宽度
# cv2.ellipse(dst, (250, 250), (150, 100), 90, 0, 180, (0, 250,240), 5)

# 绘制任意多边形
points = np.array([[150, 50], [140, 140], [200, 170], [250, 250], [150, 50]], np.int32)
points = points.reshape((-1, 1, 2)) # 维度转换
cv2.polylines(dst, [points], True, (0, 255, 255))
cv2.imshow('dst', dst)
cv2.waitKey(0)
