diff --git a/include/publisher_vision.h b/include/publisher_vision.h index e194fa0298f48bb44411a7b2594be9c27310a02c..482d4e262dec72f1c316b968079d42ce78b0062b 100644 --- a/include/publisher_vision.h +++ b/include/publisher_vision.h @@ -45,7 +45,7 @@ namespace wolf { -enum COLOR {BLUE = 0, +enum Color {BLUE = 0, GREEN, YELLOW, MAGENTA, @@ -76,14 +76,14 @@ class PublisherVisionDebug : public Publisher struct Feature { double thickness_; int size_pix_; - COLOR color_; + Color color_; }; struct Tracks { bool show_id_; double size_id_; double thickness_; - COLOR color_; + Color color_; int min_luminosity_; int max_luminosity_; struct Feature feature_last_; @@ -93,13 +93,13 @@ class PublisherVisionDebug : public Publisher bool show_; bool show_on_diff_topic_; double thickness_; - COLOR color_; + Color color_; }; struct Landmarks { bool show_id_; double size_id_; int size_pix_; - COLOR color_; + Color color_; }; Tracks tracks_; @@ -112,27 +112,30 @@ class PublisherVisionDebug : public Publisher private: /* - Convert a string corresponding to a color to its corresponding COLOR enum value + Convert a string corresponding to a color to its corresponding Color enum value */ - COLOR colorStringToEnum(const std::string _color); + Color colorStringToEnum(const std::string _color); /* Search for the maximum and minimum of features in one track in the track matrix */ - std::pair<int,int> minMaxFeatureInTrack(const std::map<SizeStd, Track>& _tracks) const; + std::pair<int,int> minMaxFeatureInTrack(const std::map<SizeStd, Track>& _tracks) const; /* Return a unique RGB color vector depending on the lenght of the track given, so the longer is the track the darker it is */ - std::vector<int> colorTrackAndFeatures(int _nb_feature_in_track, int _max_feature_in_tracks, int _min_feature_in_tracks, COLOR _color_of_features); - - std::vector<int> primaryColor(COLOR _color_of_lmks); + std::vector<int> colorTrackAndFeatures(int _nb_feature_in_track, int _max_feature_in_tracks, int _min_feature_in_tracks, Color _color_of_features); + + /* + Return a RGB color vector coresponding to the color asked + */ + std::vector<int> primaryColor(Color _color_of_lmks); /* Change an image to show tracks and features within it */ - void showTracks(cv::Mat _image, const TrackMatrix& _track_matrix, CaptureBasePtr _cap_img); + void showTracks(cv::Mat _image, const TrackMatrix& _track_matrix, CaptureBasePtr _cap_img); /* Return the transformation from world to camera @@ -169,6 +172,9 @@ class PublisherVisionDebug : public Publisher */ void showLandmarks (cv::Mat _image, const TrackMatrix& _track_matrix, const CaptureBasePtr& _cap); + /* + Change an image to show tracks and features from the preprocess within it + */ void showTracksPreprocess (cv::Mat _image, const CaptureImagePtr& _origin, const CaptureImagePtr& _last); }; diff --git a/src/publisher_vision.cpp b/src/publisher_vision.cpp index b142968d40847b90a83ed9b1611588118e49cd0f..b1a74596038d39b97fb24ecfbaa04ad3a160e811 100644 --- a/src/publisher_vision.cpp +++ b/src/publisher_vision.cpp @@ -39,25 +39,25 @@ namespace wolf { -COLOR PublisherVisionDebug::colorStringToEnum(const std::string _color) +Color PublisherVisionDebug::colorStringToEnum(const std::string _color) { if (_color == "BLUE") - return COLOR::BLUE; + return Color::BLUE; else if (_color == "GREEN") - return COLOR::GREEN; + return Color::GREEN; else if (_color == "YELLOW") - return COLOR::YELLOW; + return Color::YELLOW; else if (_color == "MAGENTA") - return COLOR::MAGENTA; + return Color::MAGENTA; else if (_color == "CYAN") - return COLOR::CYAN; + return Color::CYAN; else if (_color == "GREY") - return COLOR::GREY; + return Color::GREY; else if (_color == "RED") - return COLOR::RED; + return Color::RED; else { std::cout << _color << " color not available! Defaulting to CYAN." << std::endl; - return COLOR::CYAN; + return Color::CYAN; } } @@ -175,7 +175,7 @@ void PublisherVisionDebug::publishDerived() cv::cvtColor(cap_img->getImage(), cv_img_debug_preprocess, cv::COLOR_GRAY2BGR); cv::cvtColor(cap_img->getImage(), cv_img_debug, cv::COLOR_GRAY2BGR); -// cv::cvtColor(cap_img_origin->getImage(), cv_img_debug, cv::COLOR_GRAY2BGR); +// cv::cvtColor(cap_img_origin->getImage(), cv_img_debug, cv::Color_GRAY2BGR); // Draw all tracks showTracks(cv_img_debug, track_matrix, cap_img); @@ -247,7 +247,7 @@ std::pair<int, int> PublisherVisionDebug::minMaxFeatureInTrack(const std::map<Si std::vector<int> PublisherVisionDebug::colorTrackAndFeatures(int _nb_feature_in_track, int _max_feature_in_tracks, int _min_feature_in_tracks, - COLOR _color_of_features) + Color _color_of_features) { // std::cout << "\n\ncolorTrackAndFeatures" << '\n'; @@ -319,7 +319,7 @@ std::vector<int> PublisherVisionDebug::colorTrackAndFeatures(int _nb_feature_in_ return color; } -std::vector<int> PublisherVisionDebug::primaryColor(COLOR _color) +std::vector<int> PublisherVisionDebug::primaryColor(Color _color) { std::vector<int> color = {0, 0, 0};