可视化目标检测结果时:使用如下命令编辑文字字体时报错:OSError: cannot open resource
问题:Ubuntu 系统下,在图像上显示文字时,如下命令报错:
font = ImageFont.truetype('arial.ttf', 24)
提示错误为:
OSError: cannot open resource
解决方案:
Step 1:Ubuntu系统任意目录下打开终端;
Step 2:输入命令:
sudo apt install ttf-mscorefonts-installer
Step 3:使用如下命令,使字体生效;
sudo fc-cache
Step 4:匹配字体,查看是否安装成功。
fc-match Arial