// // Created by UnknownObject on 2022/9/21. // Copyright (c) 2022 UnknownNetworkService. All rights reserved. // #ifndef MAINCAR_TRAFFIC_LIGHT_H #define MAINCAR_TRAFFIC_LIGHT_H #include #include #include #include #include "public_types.h" #include "opencv_support.h" #include #define TRAFFIC_LIGHT_RECO_VERSION "1.0.0" namespace uns { class TrafficLight { private: int GetCircle(cv::Mat& img); bool CheckRGB(cv::Vec3b point); int tri_max(int a, int b, int c); void ImageProcess(cv::Mat& image); bool ApproximatelyEqual(int a, int b, int offset); void CutImage(cv::Mat& image,int radius,cv::Point center); void CountMax(cv::Vec3b data, int& rmax, int& gmax, int& bmax); private: bool MuchLarger(int a, int b, double rate); void CountColor(const cv::Mat& img, double rate, int& r_cnt, int& g_cnt, int& y_cnt); cv::Mat SplitImage(const cv::Mat& img); Light::TL_COLOR GetImageColor(const cv::Mat& img, double rate); public: Light::TL_COLOR GetColor(cv::Mat &image, int offset); public: Light::TL_COLOR Reco(cv::Mat &img); }; }; #endif //MAINCAR_TRAFFIC_LIGHT_H