添加摄像头IP+3D显示添加一个是否显示线条备注的形参

This commit is contained in:
2026-03-04 20:39:29 +08:00
parent 7ea779acc8
commit e7e6693798
2 changed files with 10 additions and 5 deletions

View File

@ -6,6 +6,7 @@
# @File : 3D.py # @File : 3D.py
# @Desc : 界面上的线条3D显示 # @Desc : 界面上的线条3D显示
''' '''
from re import T
import sys import sys
from PySide6.QtWidgets import QApplication, QWidget, QVBoxLayout from PySide6.QtWidgets import QApplication, QWidget, QVBoxLayout
@ -85,9 +86,10 @@ class Target3DWidget(QWidget):
("f", 100, 2.75, 1, 'purple') ("f", 100, 2.75, 1, 'purple')
] ]
def __init__(self, index: int = 0, parent=None): def __init__(self, anno: bool, index: int = 0, parent=None):
super().__init__(parent) super().__init__(parent)
self._index = index self._index = index
self._anno = anno
self.setWindowFlags(Qt.Window | Qt.FramelessWindowHint) # 无边框窗口 self.setWindowFlags(Qt.Window | Qt.FramelessWindowHint) # 无边框窗口
self.setAttribute(Qt.WA_TranslucentBackground) # 设置背景为透明 self.setAttribute(Qt.WA_TranslucentBackground) # 设置背景为透明
@ -109,6 +111,7 @@ class Target3DWidget(QWidget):
# 绘制3D形状 # 绘制3D形状
self.draw_target_shape() self.draw_target_shape()
# 添加标注 # 添加标注
if self._anno:
self.add_annotations() self.add_annotations()
# ========== 核心修改X/Y/Z轴统一为1cm单位 ========== # ========== 核心修改X/Y/Z轴统一为1cm单位 ==========
@ -165,7 +168,7 @@ def show(x: int, y: int, w: int, h: int, index: int):
raise ValueError("index must be 0 or 1") raise ValueError("index must be 0 or 1")
app = QApplication(sys.argv) app = QApplication(sys.argv)
window = Target3DWidget(index) window = Target3DWidget(anno=True, index=index)
window.setGeometry(x, y, w, h) window.setGeometry(x, y, w, h)
window.show() window.show()
sys.exit(app.exec()) sys.exit(app.exec())
@ -173,5 +176,5 @@ def show(x: int, y: int, w: int, h: int, index: int):
# ----------测试接口---------- # ----------测试接口----------
if __name__ == '__main__': if __name__ == '__main__':
show(100, 100, 700, 700, 0) # 显示A视图窗口 # show(100, 100, 700, 700, 0) # 显示A视图窗口
# show(100, 100, 700, 700, 1) # 显示B视图窗口 show(100, 100, 700, 700, 1) # 显示B视图窗口

View File

@ -21,6 +21,8 @@ sudo chmod 666 /dev/ttyACM0
笔记本192.168.5.105 笔记本192.168.5.105
网络继电器192.168.5.18 网络继电器192.168.5.18
RK1106192.168.5.100 RK1106192.168.5.100
相机1192.168.5.10
相机2192.168.5.11
# 网络继电器传感器: # 网络继电器传感器:
1、传感器1DI5 1、传感器1DI5