代码拉取完成,页面将自动刷新
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'untitledfbmUHk.ui'
##
## Created by: Qt User Interface Compiler version 5.14.1
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
import sys
from PIL.ImageWin import Window
from PyQt5.QtCore import QRect, QMetaObject, QCoreApplication, Qt, pyqtSlot, QUrl
from PyQt5.QtGui import QPixmap, QFont
from PyQt5.QtMultimedia import QMediaPlayer, QMediaContent
from PyQt5.QtMultimediaWidgets import QVideoWidget
from PyQt5.QtWidgets import QLabel, QPushButton, QApplication, QFileDialog, QWidget
import ui.resource_rc
import _thread
from ImageAI import my_detection_video
import datetime
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'untitledTOIrHz.ui'
##
## Created by: Qt User Interface Compiler version 5.14.1
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
# self.setWindowFlags(Qt.FramelessWindowHint)
def play_origin_vedio(player,index):
# print("开始播放左边的视频",index)
player.play()
class Ui_Dialog(object):
def setupUi(self, Dialog):
if Dialog.objectName():
Dialog.setObjectName(u"Dialog")
Dialog.setWindowModality(Qt.NonModal)
Dialog.setEnabled(True)
Dialog.resize(1600, 700)
self.setWindowFlags(Qt.FramelessWindowHint)
self.top_label = QLabel(Dialog)
self.top_label.setObjectName(u"top_label")
self.top_label.setGeometry(QRect(0, 0, 1600, 41))
self.top_label.setAutoFillBackground(False)
self.top_label.setStyleSheet(u"background-color:rgb(0, 161, 214)")
self.botton_label = QLabel(Dialog)
self.botton_label.setObjectName(u"botton_label")
self.botton_label.setGeometry(QRect(0, 640, 1600, 61))
self.botton_label.setAutoFillBackground(False)
self.botton_label.setStyleSheet(u"background-color:rgb(0, 161, 214)")
self.icon = QLabel(Dialog)
self.icon.setObjectName(u"icon")
self.icon.setGeometry(QRect(10, 10, 21, 21))
self.icon.setPixmap(QPixmap(u":/cup.png"))
self.icon.setScaledContents(True)
self.title = QLabel(Dialog)
self.title.setObjectName(u"title")
self.title.setGeometry(QRect(50, 10, 121, 16))
font = QFont()
font.setFamily(u"\u5fae\u8f6f\u96c5\u9ed1")
font.setPointSize(16)
self.title.setFont(font)
self.title.setStyleSheet(u"color:rgb(255, 255, 255)")
self.left = QLabel(Dialog)
self.left.setObjectName(u"left")
self.left.setGeometry(QRect(20, 650, 41, 41))
self.left.setPixmap(QPixmap(u":/left.png"))
self.left.setScaledContents(True)
self.pause = QLabel(Dialog)
self.pause.setObjectName(u"pause")
self.pause.setGeometry(QRect(110, 650, 41, 41))
self.pause.setPixmap(QPixmap(u":/pause.png"))
self.pause.setScaledContents(True)
self.halt = QLabel(Dialog)
self.halt.setObjectName(u"halt")
self.halt.setGeometry(QRect(190, 650, 41, 41))
self.halt.setPixmap(QPixmap(u":/halt.png"))
self.halt.setScaledContents(True)
self.right = QLabel(Dialog)
self.right.setObjectName(u"right")
self.right.setGeometry(QRect(270, 650, 41, 41))
self.right.setPixmap(QPixmap(u":/right.png"))
self.right.setScaledContents(True)
self.sound = QLabel(Dialog)
self.sound.setObjectName(u"sound")
self.sound.setGeometry(QRect(1380, 660, 21, 21))
self.sound.setPixmap(QPixmap(u":/sound.png"))
self.sound.setScaledContents(True)
self.more = QLabel(Dialog)
self.more.setObjectName(u"more")
self.more.setGeometry(QRect(1560, 660, 21, 21))
self.more.setPixmap(QPixmap(u":/more.png"))
self.more.setScaledContents(True)
self.start_time = QLabel(Dialog)
self.start_time.setObjectName(u"start_time")
self.start_time.setGeometry(QRect(400, 660, 61, 21))
font1 = QFont()
font1.setFamily(u"\u5fae\u8f6f\u96c5\u9ed1")
font1.setPointSize(10)
self.start_time.setFont(font1)
self.start_time.setStyleSheet(u"color:rgb(255, 255, 255)")
self.end_time = QLabel(Dialog)
self.end_time.setObjectName(u"end_time")
self.end_time.setGeometry(QRect(1120, 660, 61, 21))
self.end_time.setFont(font1)
self.end_time.setStyleSheet(u"color:rgb(255, 255, 255)")
self.video_process = QLabel(Dialog)
self.video_process.setObjectName(u"video_process")
self.video_process.setGeometry(QRect(570, 670, 400, 10))
self.video_process.setAutoFillBackground(False)
self.video_process.setStyleSheet(u"")
self.video_process.setPixmap(QPixmap(u":/process1.png"))
self.video_process.setScaledContents(True)
self.sound_process = QLabel(Dialog)
self.sound_process.setObjectName(u"sound_process")
self.sound_process.setGeometry(QRect(1410, 665, 101, 10))
self.sound_process.setStyleSheet(u"background-color:rgba(0, 0, 0, 0);")
self.sound_process.setPixmap(QPixmap(u":/process1.png"))
self.sound_process.setScaledContents(True)
self.select_video = QPushButton(Dialog)
self.select_video.setObjectName(u"select_video")
self.select_video.setGeometry(QRect(1530, 660, 21, 21))
self.select_video.setStyleSheet(u"background-color: rgba(0, 0, 0, 0);\n"
"border-image: url(:/plus.png);")
self.minimize = QPushButton(Dialog)
self.minimize.setObjectName(u"minimize")
self.minimize.setGeometry(QRect(1500, 10, 21, 21))
self.minimize.setAutoFillBackground(False)
self.minimize.setStyleSheet(u"background-color: rgba(0, 0, 0, 0);\n"
"border-image: url(:/minimize.png);border")
self.maxmize = QPushButton(Dialog)
self.maxmize.setObjectName(u"maxmize")
self.maxmize.setGeometry(QRect(1530, 10, 21, 21))
self.maxmize.setAutoFillBackground(False)
self.maxmize.setStyleSheet(u"background-color: rgba(0, 0, 0, 0);\n"
"border-image: url(:/maxmize.png);border")
self.close = QPushButton(Dialog)
self.close.setObjectName(u"close")
self.close.setGeometry(QRect(1560, 10, 21, 21))
self.close.setAutoFillBackground(False)
self.close.setStyleSheet(u"background-color: rgba(0, 0, 0, 0);\n"
"border-image: url(:/close.png);border")
self.player = QVideoWidget(Dialog)
self.player.setObjectName(u"player")
self.player.setGeometry(QRect(0, 40, 801, 601))
self.player.setStyleSheet(u"")
self.bakcground = QLabel(Dialog)
self.bakcground.setObjectName(u"bakcground")
self.bakcground.setGeometry(QRect(0, 40, 1600, 601))
self.bakcground.setStyleSheet(u"background-color: rgb(0, 0, 0);")
self.after_player = QVideoWidget(Dialog)
self.after_player.setObjectName(u"after_player")
self.after_player.setGeometry(QRect(800, 40, 801, 601))
self.after_player.setStyleSheet(u"")
self.title_2 = QLabel(Dialog)
self.title_2.setObjectName(u"title_2")
self.title_2.setGeometry(QRect(1200, 660, 121, 16))
self.title_2.setFont(font)
self.title_2.setStyleSheet(u"color:rgb(255, 0, 0)")
self.top_label.raise_()
self.botton_label.raise_()
self.icon.raise_()
self.title.raise_()
self.left.raise_()
self.pause.raise_()
self.halt.raise_()
self.right.raise_()
self.sound.raise_()
self.more.raise_()
self.start_time.raise_()
self.end_time.raise_()
self.video_process.raise_()
self.sound_process.raise_()
self.select_video.raise_()
self.minimize.raise_()
self.maxmize.raise_()
self.close.raise_()
# self.bakcground.raise_()
self.player.raise_()
self.after_player.raise_()
self.title_2.raise_()
self.retranslateUi(Dialog)
self.connectEvents(Dialog)
QMetaObject.connectSlotsByName(Dialog)
# setupUi
def retranslateUi(self, Dialog):
self.top_label.setText("")
self.botton_label.setText("")
self.icon.setText("")
self.title.setText(QCoreApplication.translate("Dialog", u"LIBILIBI", None))
self.left.setText("")
self.pause.setText("")
self.halt.setText("")
self.right.setText("")
self.sound.setText("")
self.more.setText("")
self.start_time.setText(QCoreApplication.translate("Dialog", u"02:16", None))
self.end_time.setText(QCoreApplication.translate("Dialog", u"04:35", None))
self.video_process.setText("")
self.sound_process.setText("")
self.select_video.setText("")
self.minimize.setText("")
self.maxmize.setText("")
self.close.setText("")
self.bakcground.setText("")
self.title_2.setText("")
# retranslateUi
# retranslateUi
def connectEvents(self, Dialog):
self.close.clicked.connect(QCoreApplication.quit)
self.minimize.clicked.connect(self.on_pushButton_min_clicked)
self.select_video.clicked.connect(self.on_pushButton_select_vidoo_clicked)
@pyqtSlot()
def on_pushButton_min_clicked(self):
self.showMinimized()
@pyqtSlot()
def on_pushButton_select_vidoo_clicked(self):
self.title_2.setText("正在处理中……")
self.media_player = QMediaPlayer()
self.media_player.setVideoOutput(self.after_player)
self.file_name = QFileDialog.getOpenFileUrl()[0]
# 去掉file:///前缀,并把单斜杠改成双斜杠
input_filepath = self.file_name.url()[8:].replace('/', '//')
p = my_detection_video.get_video(input_filepath)
p = QUrl.fromLocalFile(p)
# 测试代码
# input_filepath = "D:/dProjects/newtest/face-dectction/video/fall_data2.mp4"
# p=QUrl.fromLocalFile("D:/dProjects/newtest/face-dectction/20201230_detected.avi")
#################
self.media_player.setMedia(QMediaContent(p))
# self.media_player.setMedia(QMediaContent(p))
self.origin_media_player = QMediaPlayer()
self.origin_media_player.setVideoOutput(self.player)
self.origin_media_player.setMedia(QMediaContent(QUrl.fromLocalFile(input_filepath)))
try:
# print("这个没有执行")
_thread.start_new_thread(play_origin_vedio, (self.origin_media_player,1))
except:
print("出错了吗?")
# 处理好的media
self.media_player.play()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。