python电化学cv曲线怎么画_opencv-python-学习笔记二(利用opencv绘图)

常见参数:

color:颜色(255,255,0),BGR表示

thickness:线宽px,-1代表填充

linetype:圆边界类型。cv.LINE_4,cv.LINE_8,cv.LINE_AA,AA代表抗锯齿线

shift:图形缩小倍数

线

常见函数:

cv.arrowedLine() 箭头线

cv.arrowedLine(img, pt1, pt2, color[, thickness[, line_type[, shift[, tipLength]]]])

pt1:箭头起点(x,y)

pt2:箭头终点(x,y)

tipLength:

importnumpy as npimportcv2 as cv#Create a black image

img = np.zeros((512, 512, 3), np.uint8)cv.arrowedLine(img, (0, 0), (255, 255), (255, 255, 255))#cv.WINDOW_AUTOSIZE cv.WINDOW_NORMAL

cv.namedWindow('circle', cv.WINDOW_NORMAL)#显示图像

cv.imshow('circle', img)

cv.waitKey(0)

cv.destroyAllWindows()

1733520-20190706171630160-273199042.png

cv.line() 直线

cv.line(img, pt1, pt2, color[, thickness[, lineType[, shift]]])

pt1:起点(x,y)

pt2:终点(x,y)

importnumpy as npimportcv2 as cv#Create a black image

img = np.zeros((512, 512, 3), np.uint8)cv.line(img, (255, 255), (274, 274), (240, 240, 240), 10)#cv.WINDOW_AUTOSIZE cv.WINDOW_NORMAL

cv.namedWindow('circle', cv.WINDOW_NORMAL)#显示图像

cv.imshow('circle', img)

cv.waitKey(0)

cv.destroyAllWindows()

1733520-20190706171442605-1932723817.png

常见函数:

cv.circle() 圆

cv.circle(img, center, radius, color[, thickness[, lineType[, shift]]])

img:

center:圆心(x,y)

radius:半径 int

importnumpy as npimportcv2 as cv#Create a black image

img = np.zeros((512, 512, 3), np.uint8)

cv.circle(img, (447, 63), 63, (255, 255, 255), -1)#cv.WINDOW_AUTOSIZE cv.WINDOW_NORMAL

cv.namedWindow('circle', cv.WINDOW_NORMAL)#显示图像

cv.imshow('circle', img)

cv.waitKey(0)

cv.destroyAllWindows()

1733520-20190706132416969-648646751.png

矩形

常见函数

cv.rectangle

cv.rectangle(img, pt1, pt2, color[, thickness[, lineType[, shift]]])

pt1:对角,左上点

pt2:对角,右下点

importnumpy as npimportcv2 as cv#Create a black image

img = np.zeros((512, 512, 3), np.uint8)

cv.rectangle(img, ((10, 10), (40, 40)), (255, 255, 255))#cv.WINDOW_AUTOSIZE cv.WINDOW_NORMAL

cv.namedWindow('circle')#显示图像

cv.imshow('circle', img)

cv.waitKey(0)

cv.destroyAllWindows()

1733520-20190706174406257-1136027604.png

其它

常见函数

cv.drawMarker() 在指定点出标记

cv.drawMarker(img, position, color[, markerType[, markerSize[, thickness[, line_type]]]])

position:点位置 (x,y)

markerType:标记类型

importnumpy as npimportcv2 as cv#Create a black image

img = np.zeros((512, 512, 3), np.uint8)

cv.drawMarker(img, (260, 260), (255, 255, 255)#cv.WINDOW_AUTOSIZE cv.WINDOW_NORMAL

cv.namedWindow('circle')#显示图像

cv.imshow('circle', img)

cv.waitKey(0)

cv.destroyAllWindows()

1733520-20190706171712527-1692575418.png

cv.putText() 绘制文本字符串

cv.putText(img, text, org, fontFace, fontScale, color[, thickness[, lineType[, bottomLeftOrigin]]])

org:位置

text:字符串内容

fontFace:

cv.FONT_HERSHEY_SIMPLEX

normal size sans-serif font

cv.FONT_HERSHEY_PLAIN

small size sans-serif font

cv.FONT_HERSHEY_DUPLEX

normal size sans-serif font (more complex than FONT_HERSHEY_SIMPLEX)

cv.FONT_HERSHEY_COMPLEX

normal size serif font

cv.FONT_HERSHEY_TRIPLEX

normal size serif font (more complex than FONT_HERSHEY_COMPLEX)

cv.FONT_HERSHEY_COMPLEX_SMALL

smaller version of FONT_HERSHEY_COMPLEX

cv.FONT_HERSHEY_SCRIPT_SIMPLEX

hand-writing style font

cv.FONT_HERSHEY_SCRIPT_COMPLEX

more complex variant of FONT_HERSHEY_SCRIPT_SIMPLEX

cv.FONT_ITALIC

flag for italic font

fontScale:字体缩放倍数

bottomLeftOrigin:true:。false:反转。

importnumpy as npimportcv2 as cv#Create a black image

img = np.zeros((512, 512, 3), np.uint8)#cv.circle(img, (447, 63), 63, (255, 255, 255), -1)#cv.arrowedLine(img, (0, 0), (255, 255), (255, 255, 255))#cv.drawMarker(img, (260, 260), (255, 255, 255) )#cv.line(img, (255, 255), (274, 274), (240, 240, 240), 10)

cv.putText( img, "opencv", (200, 200), cv.FONT_HERSHEY_PLAIN, 1, (255, 255, 255))#cv.WINDOW_AUTOSIZE cv.WINDOW_NORMAL

cv.namedWindow('circle')#显示图像

cv.imshow('circle', img)

cv.waitKey(0)

cv.destroyAllWindows()

1733520-20190706173309483-1826492411.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值