#ifndef ARMORDETECTOR_H #define ARMORDETECTOR_H #include #include #include #include "config.h" struct LightBar { cv::Point2f center; cv::Size2f size; float angle; // in degrees float angle_rad; // in radians float area; std::vector center_line; // [end1, end2] float center_line_length; std::vector box; }; struct ArmorPlate { std::string color; cv::Point2f center; double confidence; std::pair pair; std::vector corners_2d; // Can be computed later for 3D pose }; class ArmorDetector { public: ArmorDetector(); // Main detection function void detect(const cv::Mat& mask, const std::string& target_color, std::vector& valid_light_bars, std::vector& armor_plates); private: float angle_threshold_rad; // Helper methods std::vector extract_initial_light_bars(const cv::Mat& mask); std::vector> merge_nearby_light_bars(const std::vector& initial_light_bars); std::vector filter_valid_light_bars(const std::vector>& processed_boxes); std::vector pair_light_bars_to_armor(const std::vector& light_bars, const std::string& target_color); double calculate_iou(const cv::Rect& b1, const cv::Rect& b2); }; #endif // ARMORDETECTOR_H