76 lines
2.7 KiB
C++
76 lines
2.7 KiB
C++
#ifndef IYHOLEDETECTIONSTATUS_H
|
||
#define IYHOLEDETECTIONSTATUS_H
|
||
|
||
#include <string>
|
||
#include <functional>
|
||
#include <vector>
|
||
#include <QImage>
|
||
#include <QMetaType>
|
||
|
||
// 使用 AppCommon 提供的通用接口和类型
|
||
#include "IVisionApplicationStatus.h"
|
||
|
||
/**
|
||
* @brief 孔洞检测详细结果数据
|
||
*/
|
||
struct HoleResultData {
|
||
float centerX = 0.0f, centerY = 0.0f, centerZ = 0.0f; // 孔洞中心
|
||
float normalX = 0.0f, normalY = 0.0f, normalZ = 0.0f; // 法向量
|
||
float radius = 0.0f; // 半径 (mm)
|
||
float depth = 0.0f; // 深度 (mm)
|
||
float eccentricity = 0.0f; // 离心率
|
||
float radiusVariance = 0.0f; // 半径方差
|
||
float angularSpan = 0.0f; // 角度跨度
|
||
float qualityScore = 0.0f; // 质量分数 (0-1)
|
||
|
||
HoleResultData() = default;
|
||
HoleResultData(const HoleResultData&) = default;
|
||
HoleResultData& operator=(const HoleResultData&) = default;
|
||
};
|
||
|
||
// 孔位置结构体(机器人坐标系下的6DOF位姿)
|
||
struct HolePosition : public PositionData<double> {
|
||
// 默认构造函数
|
||
HolePosition() : PositionData<double>() {}
|
||
|
||
// 带参构造函数
|
||
HolePosition(double _x, double _y, double _z, double _roll, double _pitch, double _yaw)
|
||
: PositionData<double>(_x, _y, _z, _roll, _pitch, _yaw) {}
|
||
|
||
// 拷贝构造函数和赋值运算符
|
||
HolePosition(const HolePosition&) = default;
|
||
HolePosition& operator=(const HolePosition&) = default;
|
||
|
||
// 从 PositionData 拷贝构造
|
||
HolePosition(const PositionData<double>& pos)
|
||
: PositionData<double>(pos) {}
|
||
};
|
||
|
||
// 孔洞检测结果结构体
|
||
struct HoleDetectionResult : public DetectionResultData<HolePosition> {
|
||
std::vector<HoleResultData> holeDetails; // 每个孔洞的详细信息
|
||
int totalCandidates = 0; // 候选孔洞总数(过滤前)
|
||
int filteredCount = 0; // 被过滤掉的孔洞数
|
||
|
||
// 默认构造函数
|
||
HoleDetectionResult() = default;
|
||
|
||
// 拷贝构造函数和赋值运算符
|
||
HoleDetectionResult(const HoleDetectionResult&) = default;
|
||
HoleDetectionResult& operator=(const HoleDetectionResult&) = default;
|
||
};
|
||
|
||
// 状态回调接口
|
||
class IYHoleDetectionStatus : public IVisionApplicationStatus<HoleDetectionResult>
|
||
{
|
||
public:
|
||
virtual ~IYHoleDetectionStatus() = default;
|
||
};
|
||
|
||
// 声明Qt元类型,使这些结构体能够在信号槽中跨线程传递
|
||
Q_DECLARE_METATYPE(HoleDetectionResult)
|
||
Q_DECLARE_METATYPE(HolePosition)
|
||
Q_DECLARE_METATYPE(HoleResultData)
|
||
|
||
#endif // IYHOLEDETECTIONSTATUS_H
|