📅  最后修改于: 2022-03-11 14:46:05.581000             🧑  作者: Mango
position = (30, 30)
text = "Some text including newline \n characters."
font_scale = 0.75
color = (255, 0, 0)
thickness = 3
font = cv2.FONT_HERSHEY_SIMPLEX
line_type = cv2.LINE_AA
text_size, _ = cv2.getTextSize(text, font, font_scale, thickness)
line_height = text_size[1] + 5
x, y0 = position
for i, line in enumerate(text.split("\n")):
y = y0 + i * line_height
cv2.putText(frame,
line,
(x, y),
font,
font_scale,
color,
thickness,
line_type)