代码语言:javascript复制
info = 'Hello World'
cv2.putText(original_image, text=info, org=(10, 25), fontFace=cv2.FONT_HERSHEY_SIMPLEX, fontScale=1,color=(255, 0, 0), thickness=2) # putText各参数依次是:图片,添加的文字,左上角坐标,字体,字体大小,颜色黑,字体粗细
cv2.putText(original_image, text=info, org=(10, 30*2), fontFace=cv2.FONT_HERSHEY_PLAIN, fontScale=1,color=(255, 0, 0), thickness=2) # putText各参数依次是:图片,添加的文字,左上角坐标,字体,字体大小,颜色黑,字体粗细
cv2.putText(original_image, text=info, org=(10, 30*3), fontFace=cv2.FONT_HERSHEY_COMPLEX, fontScale=1,color=(255, 0, 0), thickness=2) # putText各参数依次是:图片,添加的文字,左上角坐标,字体,字体大小,颜色黑,字体粗细
cv2.putText(original_image, text=info, org=(10, 30*4), fontFace=cv2.FONT_HERSHEY_TRIPLEX, fontScale=1,color=(255, 0, 0), thickness=2) # putText各参数依次是:图片,添加的文字,左上角坐标,字体,字体大小,颜色黑,字体粗细
cv2.putText(original_image, text=info, org=(10, 30*5), fontFace=cv2.FONT_HERSHEY_COMPLEX_SMALL, fontScale=1,color=(255, 0, 0), thickness=2) # putText各参数依次是:图片,添加的文字,左上角坐标,字体,字体大小,颜色黑,字体粗细
cv2.putText(original_image, text=info, org=(10, 30*6), fontFace=cv2.FONT_HERSHEY_SCRIPT_SIMPLEX, fontScale=1,color=(255, 0, 0), thickness=2) # putText各参数依次是:图片,添加的文字,左上角坐标,字体,字体大小,颜色黑,字体粗细
cv2.putText(original_image, text=info, org=(10, 30*7), fontFace=cv2.FONT_HERSHEY_SCRIPT_COMPLEX, fontScale=1,color=(255, 0, 0), thickness=2) # putText各参数依次是:图片,添加的文字,左上角坐标,字体,字体大小,颜色黑,字体粗细
cv2.putText(original_image, text=info, org=(10, 30*8), fontFace=cv2.FONT_ITALIC, fontScale=1,color=(255, 0, 0), thickness=2) # putText各参数依次是:图片,添加的文字,左上角坐标,字体,字体大小,颜色黑,字体粗细