2026-10-26 10:56:56 +08:00
|
|
|
#pragma once
|
|
|
|
|
// ════════════════════════════════════════════════════════════════════════════
|
|
|
|
|
// VisionGuidePanel.h ─ VisionGuide 分步操作面板 (v3 支持 CameraSide)
|
|
|
|
|
// ════════════════════════════════════════════════════════════════════════════
|
|
|
|
|
#include <QObject>
|
|
|
|
|
#include <QImage>
|
|
|
|
|
#include <QRect>
|
|
|
|
|
#include "VisionGuideMatcher.h"
|
|
|
|
|
|
|
|
|
|
namespace Ui { class MainWindowClass; }
|
|
|
|
|
|
|
|
|
|
class VisionGuidePanel : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
VisionGuidePanel(Ui::MainWindowClass& u, VisionGuideMatcher* m, QObject* parent = nullptr);
|
|
|
|
|
|
|
|
|
|
void setFrame(const QImage& img) { m_frame = img; updateStepButtons(); }
|
|
|
|
|
void setFrame(const QImage& img, CameraSide side) { m_frame = img; m_side = side; updateStepButtons(); }
|
|
|
|
|
void setROI(const QRect& r) { m_roi = r; }
|
|
|
|
|
void setCameraSide(CameraSide s) { m_side = s; updateStepButtons(); }
|
|
|
|
|
void updateStepButtons();
|
|
|
|
|
// 将“位姿估计”页当前参数立即同步到共享匹配器,供“开始测量”使用。
|
|
|
|
|
void applyCurrentParameters();
|
2026-10-27 22:14:53 +08:00
|
|
|
bool isBusy() const { return m_busy; }
|
|
|
|
|
void setResourceBlocked(bool blocked) { m_resourceBlocked=blocked; }
|
2026-10-26 10:56:56 +08:00
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void logMessage(const QString& msg);
|
|
|
|
|
void resultImage(const QString& name, const QImage& img);
|
|
|
|
|
void poseReady(const VisionPoseResult& pose);
|
2026-10-27 22:14:53 +08:00
|
|
|
void busyChanged(bool busy);
|
2026-10-26 10:56:56 +08:00
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void onStepSeg();
|
|
|
|
|
void onStepPose();
|
|
|
|
|
void onStepDebug();
|
|
|
|
|
void onVisionGuideLog(const QString& msg);
|
|
|
|
|
void onProgress(int pct, const QString& stage);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void syncParams();
|
|
|
|
|
cv::Mat toGray(const QImage& img) const;
|
|
|
|
|
|
|
|
|
|
Ui::MainWindowClass& ui;
|
|
|
|
|
VisionGuideMatcher* m_hal;
|
|
|
|
|
QImage m_frame;
|
|
|
|
|
QRect m_roi;
|
|
|
|
|
VisionPoseResult m_pose;
|
|
|
|
|
CameraSide m_side = CAM_LEFT; // 分步操作默认使用左相机
|
2026-10-27 22:14:53 +08:00
|
|
|
bool m_busy=false, m_resourceBlocked=false;
|
2026-10-26 10:56:56 +08:00
|
|
|
};
|