圆月山庄资源网 Design By www.vgjia.com

如下所示:

cv2.putText(img, str(i), (123,456)), font, 2, (0,255,0), 3)

各参数依次是:图片,添加的文字,左上角坐标,字体,字体大小,颜色,字体粗细

其中字体可以选择

FONT_HERSHEY_SIMPLEX
Python: cv.FONT_HERSHEY_SIMPLEX
normal size sans-serif font

FONT_HERSHEY_PLAIN
Python: cv.FONT_HERSHEY_PLAIN
small size sans-serif font

FONT_HERSHEY_DUPLEX
Python: cv.FONT_HERSHEY_DUPLEX
normal size sans-serif font (more complex than FONT_HERSHEY_SIMPLEX)

FONT_HERSHEY_COMPLEX
Python: cv.FONT_HERSHEY_COMPLEX
normal size serif font

FONT_HERSHEY_TRIPLEX
Python: cv.FONT_HERSHEY_TRIPLEX
normal size serif font (more complex than FONT_HERSHEY_COMPLEX)

FONT_HERSHEY_COMPLEX_SMALL
Python: cv.FONT_HERSHEY_COMPLEX_SMALL
smaller version of FONT_HERSHEY_COMPLEX

FONT_HERSHEY_SCRIPT_SIMPLEX
Python: cv.FONT_HERSHEY_SCRIPT_SIMPLEX
hand-writing style font

FONT_HERSHEY_SCRIPT_COMPLEX
Python: cv.FONT_HERSHEY_SCRIPT_COMPLEX
more complex variant of FONT_HERSHEY_SCRIPT_SIMPLEX

FONT_ITALIC
Python: cv.FONT_ITALIC
flag for italic font

字体大小,数值越大,字体越大

字体粗细,越大越粗,数值表示线占有直径像素个数

void cv::putText(
 InputOutputArray img,
 const String & text,
 Point org,
 int  fontFace,
 double fontScale,
 Scalar color,
 int  thickness = 1,
 int  lineType = LINE_8,
 bool bottomLeftOrigin = false 
)  
Python:
img =cv.putText(img, text, org, fontFace,fontScale, color[, thickness[, lineType[, bottomLeftOrigin]]])

以上这篇对python opencv 添加文字 cv2.putText 的各参数介绍就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。

标签:
python,opencv,cv2.putText

圆月山庄资源网 Design By www.vgjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
圆月山庄资源网 Design By www.vgjia.com