python opencv在图片右上角显示文字

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()

猜你喜欢

转载自blog.csdn.net/qq_16792139/article/details/131299824