1、python opencv的putText只能画英文上去

2、借鉴这个https://blog.csdn.net/dcrmg/article/details/79108491 使用pil

首先,你需要下载一个tff包,http://www.downcc.com/font/248408.html这个是在网上搜索的微软雅黑的文字包,随便你放在哪里,只有能读到就好了。接下来就按照下面的代码:

img_PIL = Image.fromarray(cv2.cvtColor(image_show, cv2.COLOR_BGR2RGB))
font = ImageFont.truetype('/unsullied/sharefs/zhouxingyu/isilon-home/CarPlate/test_scripts/chepai/msyh.ttf', 30)
fillColor = (255,0,0)
position = (30,300)
draw = ImageDraw.Draw(img_PIL)
draw.text(position, plate_num, font=font, fill=fillColor)

img_OpenCV = cv2.cvtColor(np.asarray(img_PIL),cv2.COLOR_RGB2BGR)

cv2.imshow('plate img',img_OpenCV)

注意pil和opencv的互相转换


 

相关文章:

  • 2021-12-06
  • 2022-12-23
  • 2022-02-20
  • 2021-12-31
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
猜你喜欢
  • 2021-12-02
  • 2022-02-20
  • 2021-07-02
  • 2021-12-01
  • 2022-12-23
  • 2021-09-25
  • 2022-12-23
相关资源
相似解决方案