小编Mun*_*Ali的帖子

错误“模块”对象没有属性“freetype”

我正在使用此代码链接,但它显示模块对象的错误没有属性 我试图 pip install freetype 但什么也没发生。任何人都可以请指导我。

import cv2
import numpy as np   
img = np.zeros((100, 300, 3), dtype=np.uint8)

ft = cv2.freetype.createFreeType2()
ft.loadFontData(fontFileName='Ubuntu-R.ttf',
                id=0)
ft.putText(img=img,
           text='Quick Fox',
           org=(15, 70),
           fontHeight=60,
           color=(255,  255, 255),
           thickness=-1,
           line_type=cv2.LINE_AA,
           bottomLeftOrigin=True)

cv2.imwrite('image.png', img)
Run Code Online (Sandbox Code Playgroud)

python opencv numpy freetype freetype2

6
推荐指数
1
解决办法
4202
查看次数

标签 统计

freetype ×1

freetype2 ×1

numpy ×1

opencv ×1

python ×1