#pragma once #include #include // [新增] 用于 unique_ptr #include #include #include #include #include "spdlog/spdlog.h" #include "yoloDetector/yolo_detector.hpp" // [新增] 包含检测器头文件 (同时也包含了 DetectionResult 定义) // [删除] 移除此处定义的 DetectionResult,直接使用 yolo_detector.hpp 中的定义 /* struct DetectionResult { int x; int y; int width; int height; std::string label; float confidence; }; */ class VideoPipeline { public: VideoPipeline(); ~VideoPipeline(); // 启动视频流处理 void Start(const std::string& inputUrl, const std::string& outputUrl); void StartTest(const std::string& filePath, const std::string& outputUrl); // 停止处理 void Stop(); private: void processLoop(std::string inputUrl, std::string outputUrl, bool isFileSource); // [删除] 移除模拟推理函数 // std::vector mockInference(const cv::Mat& frame); // 绘图函数 void drawOverlay(cv::Mat& frame, const std::vector& results); private: std::atomic running_; std::thread processingThread_; // [新增] YOLO 检测器实例 std::unique_ptr detector_; };