89 lines
2.2 KiB
C++
89 lines
2.2 KiB
C++
#ifndef IY_DRONESCREWCTRL_STATUS_H
|
|
#define IY_DRONESCREWCTRL_STATUS_H
|
|
|
|
#include <QImage>
|
|
#include <QMetaType>
|
|
#include <QString>
|
|
#include <vector>
|
|
|
|
/**
|
|
* @brief 单个检测目标
|
|
*/
|
|
struct CtrlDetectionBox
|
|
{
|
|
int classId{0};
|
|
float score{0.0f};
|
|
int x{0};
|
|
int y{0};
|
|
int width{0};
|
|
int height{0};
|
|
bool hasPhysicalHeight{false};
|
|
float physicalHeightMm{0.0f};
|
|
bool hasStereoMatch{false};
|
|
bool trusted{false};
|
|
int matchConfidence{1};
|
|
QString matchStatus;
|
|
int pairId{-1};
|
|
int leftIndex{-1};
|
|
int rightIndex{-1};
|
|
};
|
|
|
|
/**
|
|
* @brief 一帧检测结果
|
|
*/
|
|
// Stereo distance result in millimeters.
|
|
struct CtrlDetectionDistance
|
|
{
|
|
int fromId{0};
|
|
int toId{0};
|
|
float distanceMm{0.0f};
|
|
};
|
|
|
|
struct CtrlDetectionFrame
|
|
{
|
|
qint64 frameId{0};
|
|
qint64 timestampUs{0};
|
|
int imageWidth{0};
|
|
int imageHeight{0};
|
|
std::vector<CtrlDetectionBox> boxes;
|
|
std::vector<CtrlDetectionDistance> distances;
|
|
bool success{true};
|
|
int errorCode{0};
|
|
QString message;
|
|
bool isFinalResult{false};
|
|
double rankScore{0.0};
|
|
int rankSampleCount{0};
|
|
qint64 saveIndex{0};
|
|
};
|
|
|
|
Q_DECLARE_METATYPE(CtrlDetectionFrame)
|
|
|
|
/**
|
|
* @brief 工作状态
|
|
*/
|
|
enum class CtrlWorkStatus
|
|
{
|
|
Idle = 0, // 闲置
|
|
Connecting, // 正在连接
|
|
Streaming, // 拉流中
|
|
Detecting, // 检测中(推算)
|
|
Error, // 错误
|
|
};
|
|
|
|
/**
|
|
* @brief 主窗口需要 Presenter 通过此接口更新 UI
|
|
*/
|
|
class IYDroneScrewCtrlStatus
|
|
{
|
|
public:
|
|
virtual ~IYDroneScrewCtrlStatus() = default;
|
|
|
|
virtual void OnRtspFrame(const QImage& frame) = 0;
|
|
virtual void OnDetectionResult(const CtrlDetectionFrame& result) = 0;
|
|
virtual void OnWorkStatusChanged(CtrlWorkStatus status) = 0;
|
|
virtual void OnServerConnectionChanged(bool connected) = 0;
|
|
virtual void OnStatusMessage(const QString& msg) = 0;
|
|
};
|
|
|
|
#endif // IY_DRONESCREWCTRL_STATUS_H
|