#ifndef BATCHVERIFYDIALOG_H #define BATCHVERIFYDIALOG_H #include #include #include #include #include #include #include #include #include #include class IChessboardDetector; class IHandEyeCalib; /** * @brief 批量验证数据项 */ struct BatchVerifyItem { QString leftImagePath; // 左目图像路径 QString rightImagePath; // 右目图像路径 double robotX, robotY, robotZ; // 机械臂坐标 double robotRx, robotRy, robotRz; // 机械臂姿态 // 检测结果 bool detected; double camX, camY, camZ; // 相机检测到的坐标 double camRx, camRy, camRz; // 相机检测到的姿态 // 验证结果 double errorX, errorY, errorZ; // 误差 double errorTotal; // 总误差 }; /** * @brief 批量验证对话框 * 用于批量加载图像和机械臂坐标,进行标定验证 */ class BatchVerifyDialog : public QDialog { Q_OBJECT public: explicit BatchVerifyDialog(IChessboardDetector* detector, IHandEyeCalib* calib, QWidget* parent = nullptr); ~BatchVerifyDialog() override; /** * @brief 获取验证数据列表 */ const std::vector& getVerifyItems() const { return m_items; } private slots: /** * @brief 选择数据目录 */ void onSelectDirectory(); /** * @brief 开始批量验证 */ void onStartVerify(); /** * @brief 停止验证 */ void onStopVerify(); /** * @brief 导出结果 */ void onExportResults(); private: /** * @brief 初始化界面 */ void setupUI(); /** * @brief 扫描目录加载数据 */ bool scanDirectory(const QString& dirPath); /** * @brief 加载机械臂坐标文件 */ bool loadRobotCoordinates(const QString& filePath); /** * @brief 检测单个图像对 */ bool detectImagePair(BatchVerifyItem& item); /** * @brief 计算验证误差 */ void calculateError(BatchVerifyItem& item); /** * @brief 更新表格显示 */ void updateTable(); /** * @brief 追加日志 */ void appendLog(const QString& message); // 检测器和标定实例 IChessboardDetector* m_detector; IHandEyeCalib* m_calib; // UI 控件 QLabel* m_lblDirectory; QPushButton* m_btnSelectDir; QPushButton* m_btnStartVerify; QPushButton* m_btnStopVerify; QPushButton* m_btnExport; QProgressBar* m_progressBar; QTableWidget* m_tableResults; QTextEdit* m_logEdit; // 标定板参数 QSpinBox* m_sbPatternWidth; QSpinBox* m_sbPatternHeight; QDoubleSpinBox* m_sbSquareSize; // 相机内参 QDoubleSpinBox* m_sbFx; QDoubleSpinBox* m_sbFy; QDoubleSpinBox* m_sbCx; QDoubleSpinBox* m_sbCy; // 数据 std::vector m_items; QString m_currentDirectory; bool m_isVerifying; }; #endif // BATCHVERIFYDIALOG_H