python3 opencv 输出中文
英文:
-
import cv2
-
img = cv2.imread('caijian.jpg')
-
font = cv2.FONT_HERSHEY_SIMPLEX
-
-
imgzi = cv2.putText(img, '000', (50, 300), font, 1.2, (255, 255, 255), 2)
中文:
import time
import torch.utils.data.distributed
from PIL import Image, ImageDraw, ImageFont
from distributed.protocol import serialize, deserialize
import cv2
import torch
import numpy as np
if __name__ == '__main__':
font = ImageFont.truetype("simhei.ttf", 22, encoding="utf-8")
for i in range(1000):
person_state = '站立'
img=cv2.imread('d:/bgs.jpg')
start=time.time()
cv2_im = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
pil_im = Image.fromarray(cv2_im)
draw = ImageDraw.Draw(pil_im)
print('tim
文章来源: blog.csdn.net,作者:网奇,版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/jacke121/article/details/84388299
- 点赞
- 收藏
- 关注作者
评论(0)