Mun*_*Ali 6 python opencv numpy freetype freetype2
我正在使用此代码链接,但它显示模块对象的错误没有属性 我试图 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)
| 归档时间: |
|
| 查看次数: |
4202 次 |
| 最近记录: |