沈阳网站推广网络电话免费30分钟
web/
2025/10/4 4:44:55/
文章来源:
沈阳网站推广,网络电话免费30分钟,营销网站外包,前端开发是做网站的吗文章目录 源码下载地址#xff1a; 源码地址在视频简介中 深度学习人体关键点检测#xff0c;姿态识别 界面效果#xff1a;
界面代码#xff1a;
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
f… 文章目录 源码下载地址 源码地址在视频简介中 深度学习人体关键点检测姿态识别 界面效果
界面代码
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from untitled import Ui_Form
import sys
import cv2 as cv
from PyQt5.QtCore import QCoreApplication
import numpy as np
from PyQt5 import QtCore,QtGui
from PIL import Image
from predicts import pp
import time
from PyQt5 import QtWidgets
import cv2
class My(QMainWindow,Ui_Form):def __init__(self):super(My,self).__init__()self.setupUi(self)self.setWindowTitle(人体姿态识别)self.use_palette()self.pushButton.clicked.connect(self.pic)self.pushButton_2.clicked.connect(self.pre)self.pushButton_3.clicked.connect(self.video)self._timer QTimer(self)self._timer.timeout.connect(self.play)def video(self):self._timer.stop()v, videoType QFileDialog.getOpenFileName(self,打开视频,, *.mp4;;*.avi;;All Files (*))if v:returnself.ved cv2.VideoCapture(v)qq self.ved.isOpened()if qq False:msg_box QMessageBox(QMessageBox.Warning, Warning, 请选择视频!)msg_box.exec_()returnself._timer.stop()self._timer.start(1)def play(self):try:r, frame self.ved.read()orialself.cv_qt(frame)self.label.setPixmap(QPixmap.fromImage(orial).scaled(self.label.width(), self.label.height(), QtCore.Qt.KeepAspectRatio))self.out, zt pp(frame)out self.cv_qt(self.out)self.label_2.setPixmap(QPixmap.fromImage(out).scaled(self.label.width(), self.label.height(), QtCore.Qt.KeepAspectRatio))self.label_4.setText(zt)except:self._timer.stop()def pre(self):self._timer.stop()self.out,ztpp(self.img[...,::-1])outself.cv_qt(self.out)self.label_2.setPixmap(QPixmap.fromImage(out).scaled(self.label.width(),self.label.height(),QtCore.Qt.KeepAspectRatio))self.label_4.setText(zt)def pic(self):self._timer.stop()imgName, imgType QFileDialog.getOpenFileName(self,打开图片,, *.png;;*.jpg;;*.jpeg;;*.bmp;;All Files (*))if imgName:return#KeepAspectRatiopng QtGui.QPixmap(imgName).scaled(self.label.width(),self.label.height(),QtCore.Qt.KeepAspectRatio) # 适应设计label时的大小self.label.setPixmap(png)self.imgImage.open(imgName)self.imgnp.array(self.img)[...,:3]def cv_qt(self, src):#src必须为bgr格式图像#src必须为bgr格式图像#src必须为bgr格式图像if len(src.shape)2:srcnp.expand_dims(src,axis-1)srcnp.tile(src,(1,1,3))h, w, d src.shapeelse:h, w, d src.shapebytesperline d * w# self.srccv.cvtColor(self.src,cv.COLOR_BGR2RGB)qt_image QImage(src.data, w, h, bytesperline, QImage.Format_RGB888).rgbSwapped()return qt_image#设置背景图片函数def use_palette(self):self.setWindowTitle(人体姿态识别)window_pale QtGui.QPalette()window_pale.setBrush(self.backgroundRole(),QtGui.QBrush(QtGui.QPixmap(r./back.jpg)))self.setPalette(window_pale)if __name__ __main__:QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)appQApplication(sys.argv)myMy()my.show()sys.exit(app.exec_())
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/86598.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!