您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

10 行
358B

  1. import cv2
  2. from PIL import ImageFont
  3. label = ' 0.95'
  4. # fontScale=fontScale, thickness=tf
  5. text_width, text_height = cv2.getTextSize(label, 0, fontScale=1, thickness=1)[0]
  6. print(text_height)
  7. font = ImageFont.truetype("/home/th/tuo_heng/dev/AIlib2/conf/platech.ttf", 22, encoding='utf-8')
  8. x, y, width, height = font.getbbox("植被")
  9. print(x, y, width, height)