2020年7月23日

python 解决cv2绘制中文乱码问题

摘要: 因为使用cv2.putText() 只能显示英文字符,中文会出现乱码问题, 因此使用PIL在图片上绘制添加中文,可以指定字体文件。 大体思路: OpenCV图片格式转换成PIL的图片格式; 使用PIL绘制文字; PIL图片格式转换成OpenCV的图片格式; 具体实现: # coding=utf-8 阅读全文

posted @ 2020-07-23 22:48 Hi,王松柏 阅读(3075) 评论(0) 推荐(0) 编辑

Python从json中提取数据

摘要: #json string: s = json.loads('{"name":"test", "type":{"name":"seq", "parameter":["1", "2"]}}') print s print s.keys() print s["name"] print s["type"][ 阅读全文

posted @ 2020-07-23 22:47 Hi,王松柏 阅读(5610) 评论(0) 推荐(0) 编辑

python视频帧转BASE64编码

摘要: 直接上代码: #coding: utf-8#python3import cv2import base64from PIL import Imagefrom io import BytesIO def frame2base64(frame): img = Image.fromarray(frame) 阅读全文

posted @ 2020-07-23 22:46 Hi,王松柏 阅读(1500) 评论(0) 推荐(0) 编辑

python使用Opencv实时读取摄像头进行处理之后传到前端

摘要: 参考链接: 读取多个(海康\大华)网络摄像头的视频流 (使用opencv-python),解决实时读取延迟问题:https://zhuanlan.zhihu.com/p/38136322 websockets: https://github.com/aaugustin/websockets 流程: 阅读全文

posted @ 2020-07-23 17:22 Hi,王松柏 阅读(2038) 评论(0) 推荐(0) 编辑

导航