update 更新表格处理,更新添加自由路径,更新了重连机制

This commit is contained in:
FrankCV2048
2024-12-13 23:02:22 +08:00
parent b804b52b1f
commit d231d9fcc8
10 changed files with 104 additions and 20 deletions

View File

@ -1,9 +1,39 @@
from CU.Feeding import Feeding
from Model.Position import Real_Position
from Model.RobotModel import MoveType
import sys
import cv2
from PyQt5.QtGui import QImage, QPixmap
from PySide6.QtWidgets import QApplication, QLabel, QMainWindow
feeding = Feeding(None,None)
p_mid = Real_Position().init_position(20,20,20,30,20,20)
p_end = Real_Position().init_position(30,40,5,30,3,3)
feeding.sendTargPosition(p_mid,MoveType.Cure,5,p_end)
def cv2_to_qimage(cv_img):
"""Convert an OpenCV image to QImage."""
height, width, channel = cv_img.shape
bytes_per_line = 3 * width
q_img = QImage(cv_img.data, width, height, bytes_per_line, QImage.Format_BGR888)
return q_img
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("Display Image with PySide6")
self.resize(800, 600)
# 使用 OpenCV 读取图像
cv_img = cv2.imread("./Image/1.png") # 替换为实际路径
img = cv_img.copy()
# 转换为 QImage img = cv_img.copy()
q_img = cv2_to_qimage(cv_img)
# 创建 QLabel 并设置图像
label = QLabel(self)
label.setPixmap(QPixmap.fromImage(q_img))
label.setScaledContents(True)
label.setGeometry(50, 50, 700, 500) # 调整位置和大小
if __name__ == "__main__":
app = QApplication(sys.argv)
window = MainWindow()
window.show()
sys.exit(app.exec())