我已将其字体大小从visual_utils.py
中draw_bounding_box_on_image()内的默认大小24增加到30font = ImageFont.truetype('arial.ttf',30)
但字体大小仍未改变。
答案 0 :(得分:5)
i found the issue.
On Mac we need to give the full path.
ImageFont.truetype('/Library/Fonts/Arial.ttf', 30)
另外,我们可以将.ttf文件放在当前文件夹中并使用
ImageFont.truetype('./Arial.ttf', 30)
答案 1 :(得分:0)
对于 ubuntu 操作系统,我做了以下操作
import matplotlib.font_manager as fm
...
try:
font = ImageFont.truetype(fm.findfont(fm.FontProperties(family='DejaVu Sans')), 50)
except IOError:
font = ImageFont.load_default()
它奏效了:) 附注。我想它适用于任何操作系统。