2 Star 4 Fork 1

shiyewei/摄像头识别手部姿态实现打地鼠游戏

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
preFunction.py 650 Bytes
一键复制 编辑 原始数据 按行查看 历史
shiyewei 提交于 2021-09-03 05:56 . 上传文件
import cv2
import numpy as np
from PyQt5.QtGui import *
import math
def cvimg_to_qtimg(cvimg):
cvimg = cvimg.astype(np.uint8)
height, width, channels = cvimg.shape[:3]
cvimg = cv2.cvtColor(cvimg, cv2.COLOR_BGR2RGB)
cvimg = QImage(cvimg.data, width, height, width * channels, QImage.Format_RGB888)
return cvimg
def resize_picture(img,width,height):
w = np.array(img).shape[1]
h = np.array(img).shape[0]
if w / width >= h / height:
ratio = w / width
else:
ratio = h / height
new_width = int(w / ratio)
new_height = int(h / ratio)
return new_width,new_height
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/shiyewei/number_2.git
git@gitee.com:shiyewei/number_2.git
shiyewei
number_2
摄像头识别手部姿态实现打地鼠游戏
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385