66 lines
2.3 KiB
C
66 lines
2.3 KiB
C
|
|
#ifndef IYTUNNELCHANNELSTATUS_H
|
|||
|
|
#define IYTUNNELCHANNELSTATUS_H
|
|||
|
|
|
|||
|
|
#include <string>
|
|||
|
|
#include <functional>
|
|||
|
|
#include <vector>
|
|||
|
|
#include <QImage>
|
|||
|
|
#include <QMetaType>
|
|||
|
|
|
|||
|
|
// 使用 AppCommon 提供的通用接口和类型
|
|||
|
|
#include "IVisionApplicationStatus.h"
|
|||
|
|
|
|||
|
|
// 隧道检测位置结构体(继承自 PositionData 模板)
|
|||
|
|
struct TunnelPosition : public PositionData<double> {
|
|||
|
|
// 默认构造函数
|
|||
|
|
TunnelPosition() : PositionData<double>() {}
|
|||
|
|
|
|||
|
|
// 带参构造函数
|
|||
|
|
TunnelPosition(double _x, double _y, double _z, double _roll, double _pitch, double _yaw)
|
|||
|
|
: PositionData<double>(_x, _y, _z, _roll, _pitch, _yaw) {}
|
|||
|
|
|
|||
|
|
// 拷贝构造函数和赋值运算符
|
|||
|
|
TunnelPosition(const TunnelPosition&) = default;
|
|||
|
|
TunnelPosition& operator=(const TunnelPosition&) = default;
|
|||
|
|
|
|||
|
|
// 从 PositionData 拷贝构造
|
|||
|
|
TunnelPosition(const PositionData<double>& pos)
|
|||
|
|
: PositionData<double>(pos) {}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// 检测结果结构体(继承自 DetectionResultData 模板)
|
|||
|
|
struct TunnelDetectionResult : public DetectionResultData<TunnelPosition> {
|
|||
|
|
int detectionType = 0; // 检测类型:0-正常,1-异常
|
|||
|
|
double confidence = 0.0; // 置信度
|
|||
|
|
std::string alarmMessage; // 报警消息
|
|||
|
|
|
|||
|
|
// 2D图像(来自海康相机)
|
|||
|
|
QImage hikImage;
|
|||
|
|
|
|||
|
|
// 默认构造函数
|
|||
|
|
TunnelDetectionResult() = default;
|
|||
|
|
|
|||
|
|
// 拷贝构造函数和赋值运算符
|
|||
|
|
TunnelDetectionResult(const TunnelDetectionResult&) = default;
|
|||
|
|
TunnelDetectionResult& operator=(const TunnelDetectionResult&) = default;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// 状态回调接口(继承自 IVisionApplicationStatus 模板)
|
|||
|
|
// 使用 AppCommon 提供的通用接口,无需重复定义回调方法
|
|||
|
|
// 注意:2D海康相机状态使用 OnCamera2StatusChanged 更新
|
|||
|
|
class IYTunnelChannelStatus : public IVisionApplicationStatus<TunnelDetectionResult>
|
|||
|
|
{
|
|||
|
|
public:
|
|||
|
|
virtual ~IYTunnelChannelStatus() = default;
|
|||
|
|
|
|||
|
|
// 2D图像更新(海康相机实时预览)
|
|||
|
|
virtual void OnHikImageUpdated(const QImage& image) = 0;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// 声明Qt元类型,使这些结构体能够在信号槽中传递
|
|||
|
|
Q_DECLARE_METATYPE(TunnelPosition)
|
|||
|
|
Q_DECLARE_METATYPE(TunnelDetectionResult)
|
|||
|
|
// WorkStatus 已在 IVisionApplicationStatus.h 中声明
|
|||
|
|
|
|||
|
|
#endif // IYTUNNELCHANNELSTATUS_H
|