diff --git a/cv_bridge/src/cv_bridge.cpp b/cv_bridge/src/cv_bridge.cpp index 1c6a685d4..a8570b09a 100644 --- a/cv_bridge/src/cv_bridge.cpp +++ b/cv_bridge/src/cv_bridge.cpp @@ -134,16 +134,16 @@ Encoding getEncoding(const std::string& encoding) return INVALID; } -static const int SAME_FORMAT = -1; +static const int SAME_ENCODING = -1; -/** Return a lit of OpenCV conversion codes to get from one Format to the other - * The key is a pair: and the value a succession of OpenCV code conversion +/** Return a lit of OpenCV conversion codes to get from one encoding to the other + * The key is a pair: and the value a succession of OpenCV code conversion * It's not efficient code but it is only called once and the structure is small enough */ std::map, std::vector > getConversionCodes() { std::map, std::vector > res; for(int i=0; i<=5; ++i) - res[std::pair(Encoding(i),Encoding(i))].push_back(SAME_FORMAT); + res[std::pair(Encoding(i),Encoding(i))].push_back(SAME_ENCODING); res[std::make_pair(GRAY, RGB)].push_back(cv::COLOR_GRAY2RGB); res[std::make_pair(GRAY, BGR)].push_back(cv::COLOR_GRAY2BGR); @@ -214,7 +214,7 @@ const std::vector getConversionCode(std::string src_encoding, std::string d "] is. The conversion does not make sense"); if (!is_num_channels_the_same) throw Exception("[" + src_encoding + "] and [" + dst_encoding + "] do not have the same number of channel"); - return std::vector(1, SAME_FORMAT); + return std::vector(1, SAME_ENCODING); } // If we are converting from a color type to a non color type, we can only do so if we stick @@ -223,7 +223,7 @@ const std::vector getConversionCode(std::string src_encoding, std::string d if (!is_num_channels_the_same) throw Exception("[" + src_encoding + "] is a color encoding but [" + dst_encoding + "] " + "is not so they must have the same OpenCV type, CV_8UC3, CV16UC1 ...."); - return std::vector(1, SAME_FORMAT); + return std::vector(1, SAME_ENCODING); } // If we are converting from a color type to another type, then everything is fine @@ -238,7 +238,7 @@ const std::vector getConversionCode(std::string src_encoding, std::string d // And deal with depth differences if the colors are different std::vector res = val->second; if ((enc::bitDepth(src_encoding) != enc::bitDepth(dst_encoding)) && (getEncoding(src_encoding) != getEncoding(dst_encoding))) - res.push_back(SAME_FORMAT); + res.push_back(SAME_ENCODING); return res; } @@ -320,7 +320,7 @@ CvImagePtr toCvCopyImpl(const cv::Mat& source, cv::Mat image2; for(size_t i=0; iencoding) == 1) { if ((source->encoding == enc::TYPE_32SC1) || @@ -661,13 +661,13 @@ CvImageConstPtr cvtColorForDisplay(const CvImageConstPtr& source, return cvtColor(img_scaled, encoding); } - // If no color conversion is possible, we must "guess" the input format + // If no color conversion is possible, we must "guess" the input encoding CvImagePtr source_typed(new CvImage()); source_typed->image = source->image; source_typed->header = source->header; source_typed->encoding = source->encoding; - // If we get the OpenCV format, if we have 1,3 or 4 channels, we are most likely in mono, BGR or BGRA modes + // If we get the OpenCV encoding, if we have 1,3 or 4 channels, we are most likely in mono, BGR or BGRA modes if (source->encoding == "CV_8UC1") source_typed->encoding = enc::MONO8; else if (source->encoding == "16UC1") @@ -687,7 +687,7 @@ CvImageConstPtr cvtColorForDisplay(const CvImageConstPtr& source, try { - // Now that the output is a proper color format, try to see if any conversion is possible + // Now that the output is a proper color encoding, try to see if any conversion is possible return cvtColor(source_typed, encoding); } catch (cv_bridge::Exception& e)