cv2.putText()函数

这个函数是opencv里面向图像上添加文本内容的函数

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

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

其中字体可以选择

 

  Python: cv.FONT_HERSHEY_SIMPLEX

  normal size sans-serif font

 

  Python: cv.FONT_HERSHEY_PLAIN

  small size sans-serif font

 

  Python: cv.FONT_HERSHEY_DUPLEX

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

 

  Python: cv.FONT_HERSHEY_COMPLEX

  normal size serif font

 

  Python: cv.FONT_HERSHEY_TRIPLEX

  normal size serif font (more complex than FONT_HERSHEY_COMPLEX)

 

  Python: cv.FONT_HERSHEY_COMPLEX_SMALL

  smaller version of FONT_HERSHEY_COMPLEX

 

  Python: cv.FONT_HERSHEY_SCRIPT_SIMPLEX

  hand-writing style font

 

  Python: cv.FONT_HERSHEY_SCRIPT_COMPLEX

  more complex variant of FONT_HERSHEY_SCRIPT_SIMPLEX

 

  Python: cv.FONT_ITALIC

  flag for italic font

转载于:https://www.cnblogs.com/yqs-0705/p/10173095.html

你可能感兴趣的:(cv2.putText()函数)