You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
655 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import sys
import cv2
import numpy as np
import matplotlib.pyplot as plt
def putText(img_path, text, org, fontFace, fontScale, color, thickness=None, lineType=None):
img = cv2.imread(img_path, 1) # 读取图片
cv2.putText(img, text, org, fontFace, fontScale, color, thickness, lineType)
cv2.imwrite('./output/putText.jpg', img)
'''
输入:img_path, text, org, fontFace, fontScale, color, thickness, lineType
输出在传入的img上添加一行文字
'''
if __name__ == '__main__':
putText(sys.argv[1], sys.argv[2], eval(sys.argv[3]), eval(sys.argv[4]), eval(sys.argv[5]), eval(sys.argv[6]), eval(sys.argv[7]), eval(sys.argv[8]))