Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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)

AltStyle によって変換されたページ (->オリジナル) /