有三个值可选:LINE_8
(默认)、LINE_4
、LINE_AA
速度:LINE_8>LINE_AA
美观:LINE_AA>LINE_8
import cv2
import numpy as np
lineType = cv2.LINE_8
# lineType = cv2.LINE_4
# lineType = cv2.LINE_AA
img = np.zeros((420, 1000, 4), np.uint8)
cv2.putText(
img=img,
text='XerCis',
org=(0, 300),
fontFace=cv2.FONT_HERSHEY_SIMPLEX,
fontScale=10,
color=(0, 255, 0),
thickness=2,
lineType=lineType)
cv2.imshow('LINE_8', img)
cv2.waitKey(0)
cv2.destroyAllWindows()