Python opencv displays text in the upper right corner of the picture

import cv2
# 读取图片

image = cv2.imread('example.jpg')
# 在图片右上角添加文字

cv2.putText(image, 'Hello, World!', (image.shape[1] - 50, image.shape[0] - 30), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2)

# 显示图片

cv2.imshow('Image with Text', image)

cv2.waitKey(0)

cv2.destroyAllWindows()

Guess you like

Origin blog.csdn.net/qq_16792139/article/details/131299824