# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'demo.ui' # # Created by: PyQt5 UI code generator 5.15.9 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. import queue from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtCore import QTimer, Qt from PyQt5.QtGui import QImage, QPixmap from matplotlib import pyplot as plt from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FC import numpy as np class Ui_MainWindow(object): def mousePressEvent(self, event): if event.button() == Qt.LeftButton: self.m_drag = True self.m_DragPosition = event.globalPos() - self.window.pos() event.accept() def mouseMoveEvent(self, QMouseEvent): if Qt.LeftButton and self.m_drag: self.window.move(QMouseEvent.globalPos() - self.m_DragPosition) QMouseEvent.accept() def mouseReleaseEvent(self, QMouseEvent): self.m_drag = False def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1920, 1080) MainWindow.setMinimumSize(QtCore.QSize(1920, 1080)) MainWindow.setMaximumSize(QtCore.QSize(1920, 1080)) # 设置窗体无边框 MainWindow.setWindowFlags(Qt.Window | Qt.FramelessWindowHint) MainWindow.setAttribute(Qt.WA_TranslucentBackground) self.window = MainWindow MainWindow.setMouseTracking(True) MainWindow.mousePressEvent = self.mousePressEvent MainWindow.mouseMoveEvent = self.mouseMoveEvent MainWindow.mouseReleaseEvent = self.mouseReleaseEvent font = QtGui.QFont() font.setFamily("Microsoft YaHei") font.setPointSize(16) font.setBold(True) font.setItalic(False) font.setWeight(75) MainWindow.setFont(font) MainWindow.setStyleSheet("color:rgb(255,255,255); \n" "font: 16pt \"Microsoft YaHei\";\n" "font-weight:600;\n" "background:rgb(13, 29, 66)\n" "") self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.top = QtWidgets.QLabel(self.centralwidget) self.top.setGeometry(QtCore.QRect(5, 5, 1910, 60)) font = QtGui.QFont() font.setFamily("Microsoft YaHei") font.setPointSize(18) font.setBold(True) font.setItalic(False) font.setWeight(75) self.top.setFont(font) self.top.setStyleSheet("background:rgb(13, 29, 66);\n" "padding-right:20;font-size:18pt;\n" "border:2px solid grey;\n" "border-radius: 5px;") self.top.setFrameShape(QtWidgets.QFrame.Panel) self.top.setScaledContents(False) self.top.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.top.setWordWrap(False) self.top.setObjectName("top") self.bvp = QtWidgets.QLabel(self.centralwidget) self.bvp.setGeometry(QtCore.QRect(5, 809, 510, 261)) self.bvp.setStyleSheet("background:rgba(13, 29, 66, 0);\n" "border:2px solid grey;\n" "border-radius: 5px;") self.bvp.setFrameShape(QtWidgets.QFrame.Panel) self.bvp.setMidLineWidth(0) self.bvp.setText("") self.bvp.setObjectName("bvp") self.emotion = QtWidgets.QLabel(self.centralwidget) self.emotion.setGeometry(QtCore.QRect(1405, 70, 510, 200)) self.emotion.setStyleSheet("background:rgb(13, 29, 66);\n" "border:2px solid grey;\n" "border-radius: 5px;") self.emotion.setFrameShape(QtWidgets.QFrame.Box) self.emotion.setMidLineWidth(0) self.emotion.setText("") self.emotion.setObjectName("emotion") self.skin = QtWidgets.QLabel(self.centralwidget) self.skin.setGeometry(QtCore.QRect(1405, 280, 510, 230)) self.skin.setStyleSheet("background:rgb(13, 29, 66);\n" "border:2px solid grey;\n" "border-radius: 5px;") self.skin.setFrameShape(QtWidgets.QFrame.Panel) self.skin.setMidLineWidth(0) self.skin.setText("") self.skin.setObjectName("skin") self.resp = QtWidgets.QLabel(self.centralwidget) self.resp.setGeometry(QtCore.QRect(1405, 709, 510, 361)) self.resp.setStyleSheet("background:rgba(13, 29, 66 ,0);\n" "border:2px solid grey;\n" "border-radius: 5px;") self.resp.setFrameShape(QtWidgets.QFrame.Panel) self.resp.setMidLineWidth(0) self.resp.setText("") self.resp.setObjectName("resp") self.rr = QtWidgets.QLabel(self.centralwidget) self.rr.setGeometry(QtCore.QRect(1405, 520, 510, 181)) self.rr.setStyleSheet("background:rgb(13, 29, 66);\n" "border:2px solid grey;\n" "border-radius: 5px;") self.rr.setFrameShape(QtWidgets.QFrame.Panel) self.rr.setFrameShadow(QtWidgets.QFrame.Plain) self.rr.setLineWidth(1) self.rr.setMidLineWidth(0) self.rr.setText("") self.rr.setObjectName("rr") self.age_region = QtWidgets.QLabel(self.centralwidget) self.age_region.setGeometry(QtCore.QRect(5, 70, 510, 200)) self.age_region.setStyleSheet("background:rgb(13, 29, 66);\n" "border:2px solid grey;\n" "border-radius: 5px;") self.age_region.setFrameShape(QtWidgets.QFrame.Panel) self.age_region.setMidLineWidth(0) self.age_region.setText("") self.age_region.setObjectName("age_region") self.hr = QtWidgets.QLabel(self.centralwidget) self.hr.setGeometry(QtCore.QRect(5, 500, 510, 301)) self.hr.setStyleSheet("background:rgb(13, 29, 66);\n" "border:2px solid grey;\n" "border-radius: 5px;") self.hr.setFrameShape(QtWidgets.QFrame.Panel) self.hr.setMidLineWidth(0) self.hr.setText("") self.hr.setObjectName("hr") self.bp = QtWidgets.QLabel(self.centralwidget) self.bp.setGeometry(QtCore.QRect(5, 280, 510, 211)) self.bp.setStyleSheet("background:rgb(13, 29, 66);\n" "border:2px solid grey;\n" "border-radius: 5px;") self.bp.setFrameShape(QtWidgets.QFrame.Panel) self.bp.setMidLineWidth(0) self.bp.setText("") self.bp.setObjectName("bp") self.image = QtWidgets.QLabel(self.centralwidget) self.image.setGeometry(QtCore.QRect(520, 70, 881, 1001)) self.image.setStyleSheet("background:rgb(13, 29, 66);\n" "border:2px solid grey;\n" "border-radius: 5px;margin:0;padding:0;") self.image.setFrameShape(QtWidgets.QFrame.Panel) self.image.setText("") # self.image.setPixmap(QtGui.QPixmap("../../au/featDemo/1.png")) self.image.setObjectName("image") self.title = QtWidgets.QLabel(self.centralwidget) self.title.setGeometry(QtCore.QRect(750, 5, 421, 60)) font = QtGui.QFont() font.setFamily("Microsoft YaHei") font.setPointSize(28) font.setBold(True) font.setItalic(False) font.setWeight(75) self.title.setFont(font) self.title.setStyleSheet("font-size:28pt;\n" "background:none;") self.title.setAlignment(QtCore.Qt.AlignCenter) self.title.setObjectName("title") self.sex_title = QtWidgets.QLabel(self.centralwidget) self.sex_title.setGeometry(QtCore.QRect(50, 90, 71, 41)) self.sex_title.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:18pt;") self.sex_title.setAlignment(QtCore.Qt.AlignCenter) self.sex_title.setObjectName("sex_title") self.sex_value = QtWidgets.QLabel(self.centralwidget) self.sex_value.setGeometry(QtCore.QRect(50, 160, 71, 71)) self.sex_value.setStyleSheet("background:rgb(13, 29, 66);\n" "") self.sex_value.setText("") self.sex_value.setPixmap(QtGui.QPixmap("images/female.png")) self.sex_value.setScaledContents(True) self.sex_value.setAlignment(QtCore.Qt.AlignCenter) self.sex_value.setObjectName("sex_value") self.adult = QtWidgets.QLabel(self.centralwidget) self.adult.setGeometry(QtCore.QRect(310, 170, 51, 51)) self.adult.setStyleSheet("background:rgb(13, 29, 66);\n" "") self.adult.setText("") self.adult.setPixmap(QtGui.QPixmap("images/adult.svg")) self.adult.setScaledContents(True) self.adult.setAlignment(QtCore.Qt.AlignCenter) self.adult.setObjectName("adult") self.age_title = QtWidgets.QLabel(self.centralwidget) self.age_title.setGeometry(QtCore.QRect(300, 90, 71, 41)) self.age_title.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:18pt;") self.age_title.setAlignment(QtCore.Qt.AlignCenter) self.age_title.setObjectName("age_title") self.age_value = QtWidgets.QProgressBar(self.centralwidget) self.age_value.setGeometry(QtCore.QRect(190, 229, 291, 5)) self.age_value.setStyleSheet(".QProgressBar{\n" "background:rgb(255, 255, 255);\n" "border-radius:2%;\n" "border:1px solid grey;}\n" ".QProgressBar::chunk {\n" " background-color:rgb(13, 29, 66)\n" "}\n" "") self.age_value.setMaximum(70) self.age_value.setProperty("value", 42) self.age_value.setTextVisible(False) self.age_value.setOrientation(QtCore.Qt.Horizontal) self.age_value.setObjectName("age_value") self.baby = QtWidgets.QLabel(self.centralwidget) self.baby.setGeometry(QtCore.QRect(170, 170, 51, 51)) self.baby.setStyleSheet("background:rgb(13, 29, 66);\n" "") self.baby.setText("") self.baby.setPixmap(QtGui.QPixmap("images/baby.svg")) self.baby.setScaledContents(True) self.baby.setAlignment(QtCore.Qt.AlignCenter) self.baby.setObjectName("baby") self.old = QtWidgets.QLabel(self.centralwidget) self.old.setGeometry(QtCore.QRect(450, 170, 51, 51)) self.old.setStyleSheet("background:rgb(13, 29, 66);\n" "") self.old.setText("") self.old.setPixmap(QtGui.QPixmap("images/old.png")) self.old.setScaledContents(True) self.old.setAlignment(QtCore.Qt.AlignCenter) self.old.setObjectName("old") self.logo = QtWidgets.QLabel(self.centralwidget) self.logo.setGeometry(QtCore.QRect(1310, 80, 81, 61)) self.logo.setStyleSheet("background:none;") self.logo.setText("") self.logo.setPixmap(QtGui.QPixmap("../../../../../公共安全.png")) self.logo.setScaledContents(True) self.logo.setAlignment(QtCore.Qt.AlignCenter) self.logo.setObjectName("logo") self.sbp_title = QtWidgets.QLabel(self.centralwidget) self.sbp_title.setGeometry(QtCore.QRect(105, 300, 71, 41)) self.sbp_title.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:18pt;") self.sbp_title.setAlignment(QtCore.Qt.AlignCenter) self.sbp_title.setObjectName("sbp_title") self.dbp_title = QtWidgets.QLabel(self.centralwidget) self.dbp_title.setGeometry(QtCore.QRect(340, 300, 71, 41)) self.dbp_title.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:18pt;") self.dbp_title.setAlignment(QtCore.Qt.AlignCenter) self.dbp_title.setObjectName("dbp_title") self.sbp_type = QtWidgets.QLabel(self.centralwidget) self.sbp_type.setGeometry(QtCore.QRect(70, 420, 141, 41)) self.sbp_type.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:24pt;") self.sbp_type.setAlignment(QtCore.Qt.AlignCenter) self.sbp_type.setObjectName("sbp_type") self.sbp_value = QtWidgets.QLabel(self.centralwidget) self.sbp_value.setGeometry(QtCore.QRect(70, 360, 141, 51)) self.sbp_value.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:40pt;") self.sbp_value.setAlignment(QtCore.Qt.AlignCenter) self.sbp_value.setObjectName("sbp_value") self.dbp_value = QtWidgets.QLabel(self.centralwidget) self.dbp_value.setGeometry(QtCore.QRect(305, 360, 141, 51)) self.dbp_value.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:40pt;") self.dbp_value.setAlignment(QtCore.Qt.AlignCenter) self.dbp_value.setObjectName("dbp_value") self.dbp_type = QtWidgets.QLabel(self.centralwidget) self.dbp_type.setGeometry(QtCore.QRect(305, 420, 141, 41)) self.dbp_type.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:24pt;") self.dbp_type.setAlignment(QtCore.Qt.AlignCenter) self.dbp_type.setObjectName("dbp_type") self.hr_title = QtWidgets.QLabel(self.centralwidget) self.hr_title.setGeometry(QtCore.QRect(100, 520, 71, 41)) self.hr_title.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:18pt;") self.hr_title.setAlignment(QtCore.Qt.AlignCenter) self.hr_title.setObjectName("hr_title") self.hr_value = QtWidgets.QLabel(self.centralwidget) self.hr_value.setGeometry(QtCore.QRect(65, 560, 141, 51)) self.hr_value.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:40pt;") self.hr_value.setAlignment(QtCore.Qt.AlignCenter) self.hr_value.setObjectName("hr_value") self.hr_type = QtWidgets.QLabel(self.centralwidget) self.hr_type.setGeometry(QtCore.QRect(65, 610, 141, 41)) self.hr_type.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:24pt;") self.hr_type.setAlignment(QtCore.Qt.AlignCenter) self.hr_type.setObjectName("hr_type") self.cvrr_title = QtWidgets.QLabel(self.centralwidget) self.cvrr_title.setGeometry(QtCore.QRect(330, 520, 91, 41)) self.cvrr_title.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:18pt;") self.cvrr_title.setAlignment(QtCore.Qt.AlignCenter) self.cvrr_title.setObjectName("cvrr_title") self.cvrr_value = QtWidgets.QLabel(self.centralwidget) self.cvrr_value.setGeometry(QtCore.QRect(305, 560, 141, 51)) self.cvrr_value.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:40pt;") self.cvrr_value.setAlignment(QtCore.Qt.AlignCenter) self.cvrr_value.setObjectName("cvrr_value") self.rmssd_title = QtWidgets.QLabel(self.centralwidget) self.rmssd_title.setGeometry(QtCore.QRect(330, 680, 91, 41)) self.rmssd_title.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:18pt;") self.rmssd_title.setAlignment(QtCore.Qt.AlignCenter) self.rmssd_title.setObjectName("rmssd_title") self.sdnn_title = QtWidgets.QLabel(self.centralwidget) self.sdnn_title.setGeometry(QtCore.QRect(90, 680, 91, 41)) self.sdnn_title.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:18pt;") self.sdnn_title.setAlignment(QtCore.Qt.AlignCenter) self.sdnn_title.setObjectName("sdnn_title") self.sdnn_value = QtWidgets.QLabel(self.centralwidget) self.sdnn_value.setGeometry(QtCore.QRect(65, 720, 141, 51)) self.sdnn_value.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:40pt;") self.sdnn_value.setAlignment(QtCore.Qt.AlignCenter) self.sdnn_value.setObjectName("sdnn_value") self.rmssd_value = QtWidgets.QLabel(self.centralwidget) self.rmssd_value.setGeometry(QtCore.QRect(305, 720, 141, 51)) self.rmssd_value.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:40pt;") self.rmssd_value.setAlignment(QtCore.Qt.AlignCenter) self.rmssd_value.setObjectName("rmssd_value") self.emotion_icon = QtWidgets.QLabel(self.centralwidget) self.emotion_icon.setGeometry(QtCore.QRect(1500, 150, 71, 71)) self.emotion_icon.setStyleSheet("background:rgb(13, 29, 66);\n" "") self.emotion_icon.setText("") self.emotion_icon.setPixmap(QtGui.QPixmap("images/happy.png")) self.emotion_icon.setScaledContents(True) self.emotion_icon.setAlignment(QtCore.Qt.AlignCenter) self.emotion_icon.setObjectName("emotion_icon") self.emotion_value = QtWidgets.QLabel(self.centralwidget) self.emotion_value.setGeometry(QtCore.QRect(1610, 150, 231, 71)) font = QtGui.QFont() font.setFamily("Microsoft YaHei") font.setPointSize(36) font.setBold(True) font.setItalic(False) font.setWeight(75) self.emotion_value.setFont(font) self.emotion_value.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:36pt;") self.emotion_value.setAlignment(QtCore.Qt.AlignCenter) self.emotion_value.setObjectName("emotion_value") self.emotion_title = QtWidgets.QLabel(self.centralwidget) self.emotion_title.setGeometry(QtCore.QRect(1610, 90, 100, 40)) self.emotion_title.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:18pt;") self.emotion_title.setAlignment(QtCore.Qt.AlignCenter) self.emotion_title.setObjectName("emotion_title") self.skin_title = QtWidgets.QLabel(self.centralwidget) self.skin_title.setGeometry(QtCore.QRect(1610, 300, 100, 40)) self.skin_title.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:18pt;") self.skin_title.setAlignment(QtCore.Qt.AlignCenter) self.skin_title.setObjectName("skin_title") self.skin_ctype_value = QtWidgets.QLabel(self.centralwidget) self.skin_ctype_value.setGeometry(QtCore.QRect(1555, 350, 211, 71)) font = QtGui.QFont() font.setFamily("Microsoft YaHei") font.setPointSize(36) font.setBold(True) font.setItalic(False) font.setWeight(75) self.skin_ctype_value.setFont(font) self.skin_ctype_value.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:36pt;") self.skin_ctype_value.setAlignment(QtCore.Qt.AlignCenter) self.skin_ctype_value.setObjectName("skin_ctype_value") self.skin_diseance_value = QtWidgets.QLabel(self.centralwidget) self.skin_diseance_value.setGeometry(QtCore.QRect(1415, 420, 491, 71)) font = QtGui.QFont() font.setFamily("Microsoft YaHei") font.setPointSize(28) font.setBold(True) font.setItalic(False) font.setWeight(75) self.skin_diseance_value.setFont(font) self.skin_diseance_value.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:28pt;") self.skin_diseance_value.setAlignment(QtCore.Qt.AlignCenter) self.skin_diseance_value.setObjectName("skin_diseance_value") self.rr_title = QtWidgets.QLabel(self.centralwidget) self.rr_title.setGeometry(QtCore.QRect(1495, 540, 111, 41)) self.rr_title.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:18pt;") self.rr_title.setAlignment(QtCore.Qt.AlignCenter) self.rr_title.setObjectName("rr_title") self.rr_type = QtWidgets.QLabel(self.centralwidget) self.rr_type.setGeometry(QtCore.QRect(1480, 630, 141, 41)) self.rr_type.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:24pt;") self.rr_type.setAlignment(QtCore.Qt.AlignCenter) self.rr_type.setObjectName("rr_type") self.rr_value = QtWidgets.QLabel(self.centralwidget) self.rr_value.setGeometry(QtCore.QRect(1480, 580, 141, 51)) self.rr_value.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:40pt;") self.rr_value.setAlignment(QtCore.Qt.AlignCenter) self.rr_value.setObjectName("rr_value") self.spo2_value = QtWidgets.QLabel(self.centralwidget) self.spo2_value.setGeometry(QtCore.QRect(1695, 580, 141, 51)) self.spo2_value.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:40pt;") self.spo2_value.setAlignment(QtCore.Qt.AlignCenter) self.spo2_value.setObjectName("spo2_value") self.spo2_type = QtWidgets.QLabel(self.centralwidget) self.spo2_type.setGeometry(QtCore.QRect(1695, 630, 141, 41)) self.spo2_type.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:24pt;") self.spo2_type.setAlignment(QtCore.Qt.AlignCenter) self.spo2_type.setObjectName("spo2_type") self.spo2_title = QtWidgets.QLabel(self.centralwidget) self.spo2_title.setGeometry(QtCore.QRect(1710, 540, 111, 41)) self.spo2_title.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:18pt;") self.spo2_title.setAlignment(QtCore.Qt.AlignCenter) self.spo2_title.setObjectName("spo2_title") self.rPPG_title = QtWidgets.QLabel(self.centralwidget) self.rPPG_title.setGeometry(QtCore.QRect(190, 820, 151, 41)) self.rPPG_title.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:18pt;") self.rPPG_title.setAlignment(QtCore.Qt.AlignCenter) self.rPPG_title.setObjectName("rPPG_title") self.resp_title = QtWidgets.QLabel(self.centralwidget) self.resp_title.setGeometry(QtCore.QRect(1620, 720, 100, 40)) self.resp_title.setStyleSheet("background:rgb(13, 29, 66);\n" "font-size:18pt;") self.resp_title.setAlignment(QtCore.Qt.AlignCenter) self.resp_title.setObjectName("resp_title") self.horizontalLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.horizontalLayoutWidget.setGeometry(QtCore.QRect(-50, 870, 601, 191)) self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget") self.rppg_view = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget) self.rppg_view.setContentsMargins(0, 0, 0, 0) self.rppg_view.setObjectName("rppg_view") self.horizontalLayoutWidget_2 = QtWidgets.QWidget(self.centralwidget) self.horizontalLayoutWidget_2.setGeometry(QtCore.QRect(1350, 770, 611, 291)) self.horizontalLayoutWidget_2.setObjectName("horizontalLayoutWidget_2") self.resp_view = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_2) self.resp_view.setContentsMargins(0, 0, 0, 0) self.resp_view.setObjectName("resp_view") self.top.raise_() self.emotion.raise_() self.skin.raise_() self.rr.raise_() self.age_region.raise_() self.hr.raise_() self.bp.raise_() self.title.raise_() self.sex_title.raise_() self.sex_value.raise_() self.adult.raise_() self.age_title.raise_() self.age_value.raise_() self.baby.raise_() self.old.raise_() self.sbp_title.raise_() self.dbp_title.raise_() self.sbp_type.raise_() self.sbp_value.raise_() self.dbp_value.raise_() self.dbp_type.raise_() self.hr_title.raise_() self.hr_value.raise_() self.hr_type.raise_() self.cvrr_title.raise_() self.cvrr_value.raise_() self.rmssd_title.raise_() self.sdnn_title.raise_() self.sdnn_value.raise_() self.rmssd_value.raise_() self.emotion_icon.raise_() self.emotion_value.raise_() self.emotion_title.raise_() self.skin_title.raise_() self.skin_ctype_value.raise_() self.skin_diseance_value.raise_() self.rr_title.raise_() self.rr_type.raise_() self.rr_value.raise_() self.spo2_value.raise_() self.spo2_type.raise_() self.spo2_title.raise_() self.horizontalLayoutWidget.raise_() self.horizontalLayoutWidget_2.raise_() self.bvp.raise_() self.rPPG_title.raise_() self.resp.raise_() self.resp_title.raise_() self.image.raise_() self.logo.raise_() # 解决无法显示中文 plt.rcParams['font.sans-serif'] = ['SimHei'] # 解决无法显示负号 plt.rcParams['axes.unicode_minus'] = False # 设置画布部分 self.rppg_fig = plt.figure(facecolor='#0d1d42', figsize=(5, 1)) self.rppg_ax = self.rppg_fig.add_subplot(111) self.resp_fig = plt.figure(facecolor='#0d1d42', figsize=(5, 1)) self.resp_ax = self.resp_fig.add_subplot(111) # 隐藏边框 self.resp_ax.set_frame_on(False) self.rppg_ax.set_frame_on(False) self.rppg_canvas = FC(self.rppg_fig) self.resp_canvas = FC(self.resp_fig) self.rppg_view.addWidget(self.rppg_canvas) self.resp_view.addWidget(self.resp_canvas) self.rppg_canvas.raise_() self.resp_canvas.raise_() self.resps = queue.Queue() self.bvps = queue.Queue() self.last_resp = 0 self.last_bvp = 0 self.rr_x = [] self.rr_y = [] self.bvp_x = [] self.bvp_y = [] # # # 设置定时器更新曲线图 self.timer = QTimer(MainWindow) self.timer.timeout.connect(self.update_resp_plot) self.timer.start(100) self.timer1 = QTimer(MainWindow) self.timer1.timeout.connect(self.update_bvp_plot) self.timer1.start(100) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) self.top.setText(_translate("MainWindow", "2024年06月11日 15:11:11 星期二")) self.title.setText(_translate("MainWindow", "体检仪")) self.sex_title.setText(_translate("MainWindow", "性别")) self.age_title.setText(_translate("MainWindow", "年龄")) self.sbp_title.setText(_translate("MainWindow", "收缩压")) self.dbp_title.setText(_translate("MainWindow", "舒张压")) self.sbp_type.setText(_translate("MainWindow", "mmHg")) self.sbp_value.setText(_translate("MainWindow", "140")) self.dbp_value.setText(_translate("MainWindow", "80")) self.dbp_type.setText(_translate("MainWindow", "mmHg")) self.hr_title.setText(_translate("MainWindow", "心率")) self.hr_value.setText(_translate("MainWindow", "60")) self.hr_type.setText(_translate("MainWindow", "bpm")) self.cvrr_title.setText(_translate("MainWindow", "CV R-R")) self.cvrr_value.setText(_translate("MainWindow", "1.1")) self.rmssd_title.setText(_translate("MainWindow", "RMSSD")) self.sdnn_title.setText(_translate("MainWindow", "SDNN")) self.sdnn_value.setText(_translate("MainWindow", "6.6")) self.rmssd_value.setText(_translate("MainWindow", "8.3")) self.emotion_value.setText(_translate("MainWindow", "HAPPY")) self.emotion_title.setText(_translate("MainWindow", "表情")) self.skin_title.setText(_translate("MainWindow", "皮肤属性")) self.skin_ctype_value.setText(_translate("MainWindow", "油性皮肤")) self.skin_diseance_value.setText(_translate("MainWindow", "健康")) self.rr_title.setText(_translate("MainWindow", "呼吸频率")) self.rr_type.setText(_translate("MainWindow", "bpm")) self.rr_value.setText(_translate("MainWindow", "20")) self.spo2_value.setText(_translate("MainWindow", "20")) self.spo2_type.setText(_translate("MainWindow", "%")) self.spo2_title.setText(_translate("MainWindow", "血氧")) self.rPPG_title.setText(_translate("MainWindow", "BVP波动")) self.resp_title.setText(_translate("MainWindow", "呼吸波动")) def update_image(self, image): height, width = image.shape[:2] target_width = width * self.image.height() / height pixmap = QImage(image, width, height, QImage.Format_RGB888) pixmap = QPixmap.fromImage(pixmap).scaled(target_width, self.image.height()) self.image.setAlignment(Qt.AlignCenter) self.image.setPixmap(pixmap) def update_resp_plot(self): if not self.resps.empty(): resp = self.resps.get() # 更新线的数据 self.rr_y.append(resp) else: self.rr_y.append(0) if len(self.rr_x) == 0: self.rr_x.append(1) else: self.rr_x.append(self.rr_x[-1] + 1) if len(self.rr_x) > 300: self.rr_x.pop(0) self.rr_y.pop(0) # 生成时间序列 t = np.linspace(self.rr_x[0] / 30, self.rr_x[-1] / 30, len(self.rr_y)) self.resp_ax.clear() self.resp_ax.set_ylim(max(-1, min(self.rr_y) - 0.5), max(2, max(self.rr_y) + 0.5)) self.resp_ax.plot(t, self.rr_y, color='#33FFFF') self.resp_ax.axis('off') self.resp_canvas.draw() def update_bvp_plot(self): if not self.bvps.empty(): bvp = self.bvps.get() # 更新线的数据 self.bvp_y.append(bvp) else: self.bvp_y.append(0) if len(self.bvp_x) == 0: self.bvp_x.append(1) else: self.bvp_x.append(self.bvp_x[-1] + 1) if len(self.bvp_x) > 300: self.bvp_x.pop(0) self.bvp_y.pop(0) # 生成时间序列 t = np.linspace(self.bvp_x[0] / 30, self.bvp_x[-1] / 30, len(self.bvp_y)) self.rppg_ax.clear() self.rppg_ax.set_ylim(min(-4, min(self.bvp_y) - 0.5), max(4, max(self.bvp_y) + 0.5)) self.rppg_ax.plot(t, self.bvp_y, color='#FFFF00') self.rppg_ax.axis('off') self.rppg_canvas.draw()