Python-OpenCV的putText()函数:在图片上添加文字
函数原型
cv2.putText(src, text, place, Font, Font_Size, Font_Color, Font_Overstriking)
参数
| 参数 |
意义 |
| src |
输入图像 |
| text |
添加的文字 |
| place |
左下角坐标 |
| Font |
字体类型 |
| Font_Size |
文字大小 |
| Font_Color |
字体颜色 |
| Font_Overstriking |
字体粗细 |
示例
import cv2
import numpy as np
img = cv2.imread('home/Arya.jpeg')
cv2.imshow('Original image',img)
text = 'Game of Throne-Arya'
ret = cv2.putText(img, text, (10, 100), cv2.FONT_HERSHEY_SCRIPT_COMPLEX, 1.5, (100, 200, 200), 2)
cv2.imshow('ret',ret)
cv2.waitKey(0)
cv2.destroyAllWindows()
输出结果
