Skip to content

Commit 9445223

Browse files
committed
绘写文字
1 parent 9750cf4 commit 9445223

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

ch06-绘图函数/Drawing_UTF-8_strings.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,19 @@
2020
# ft.loadFontData(fontFileName='/usr/share/fonts/truetype/freefont/FreeSans.ttf',id=0)#不支持中文
2121
# ft.loadFontData(fontFileName='/usr/share/fonts-droid/truetype/DroidSansFallback.ttf',id=0)#树莓派,搞定
2222

23-
#sudo apt-get install ttf-wqy-zenhei #安装字体
24-
ft.loadFontData(fontFileName='/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc', id=0) # 文泉驿的开源中文字体
23+
# sudo apt-get install ttf-wqy-zenhei #安装字体
24+
# ft.loadFontData(fontFileName='/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc', id=0) # 文泉驿的开源中文字体
2525

26+
# macOS 直接加载当前文件夹的ttc字体文件
27+
ft.loadFontData(fontFileName='wqy-zenhei.ttc', id=0)
2628

2729
ft.putText(img=img,
2830
# text='Quick Fox',
2931
text='你好中文',
30-
org=(15, 70),
31-
fontHeight=60,
32-
color=(255, 255, 255),
33-
thickness=-1,
32+
org=(15, 70), # text 左上角 坐标
33+
fontHeight=60, # 字体高度
34+
color=(255, 255, 255), # 字体为白色
35+
thickness=-1, # 厚度
3436
line_type=cv2.LINE_AA,
3537
bottomLeftOrigin=True)
3638

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy