上图先
import sys import cv2 import logging import mediapipe as mp import numpy as np from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel, QVBoxLayout, QHBoxLayout, QWidget, QTextEdit, QPushButton from PyQt5.QtGui import QImage, QPixmap, QFont from PyQt5.QtCore import QTimer, Qt class GestureUI(QMainWindow): def __init__(self): super().__init__() # 新增:骨架检测功能开关状态 self.skeleton_detection_enabled = True # 新增:显示模式(0: 原图+骨架, 1: 只显示骨架黑色背景) self.display_mode = 0 self.setWindowTitle("Gesture Recognition 2026 - 骨架显示模式") # 修改主窗口标题 # 设置主窗口背景颜色为黑色 self.setStyleSheet("background-color: black;") # 创建一个用于显示原图的标签,并添加圆角边框和背景样式 self.image_label = QLabel() self.image_label.setStyleSheet(""" border: 2px solid cyan; border-radius: 10px; background-color: #1e1e1e; """) # 添加圆角边框和深色背景 # 新增:右上角状态标签 - 骨架检测状态 self.skeleton_status_label = QLabel("骨架检测: 开启", self.image_label) self.skeleton_status_label.setStyleSheet(""" color: cyan; font-size: 14px; background-color: rgba(0,0,0,180); padding: 4px 8px; border-radius: 4px; font-weight: bold; """) self.skeleton_status_label.setAttribute(Qt.WA_TransparentForMouseEvents) # 新增:右上角状态标签 - 显示模式状态 self.display_mode_label = QLabel("显示模式: 原图+骨架", self.image_label) self.display_mode_label.setStyleSheet(""" color: magenta; font-size: 14px; background-color: rgba(0,0,0,180); padding: 4px 8px; border-radius: 4px; font-weight: bold; """) self.display_mode_label.setAttribute(Qt.WA_TransparentForMouseEvents) # 创