diff --git a/cv_bridge/src/cv_bridge.cpp b/cv_bridge/src/cv_bridge.cpp index dd11c78d2..e763e5da7 100644 --- a/cv_bridge/src/cv_bridge.cpp +++ b/cv_bridge/src/cv_bridge.cpp @@ -121,7 +121,7 @@ int getCvType(const std::string & encoding) /// @cond DOXYGEN_IGNORE enum Encoding { INVALID = -1, GRAY = 0, RGB, BGR, RGBA, BGRA, YUV422, YUV422_YUY2, BAYER_RGGB, BAYER_BGGR, - BAYER_GBRG, BAYER_GRBG}; + BAYER_GBRG, BAYER_GRBG, MAX_ENCODING}; Encoding getEncoding(const std::string & encoding) { @@ -151,7 +151,7 @@ static const int SAME_FORMAT = -1; std::map, std::vector> getConversionCodes() { std::map, std::vector> res; - for (int i = 0; i <= 5; ++i) { + for (int i = 0; i < MAX_ENCODING; ++i) { res[std::pair(Encoding(i), Encoding(i))].push_back(SAME_FORMAT); } @@ -599,7 +599,7 @@ CvImageConstPtr cvtColorForDisplay( } else { // We choose BGR by default here as we assume people will use OpenCV if ((enc::bitDepth(source->encoding) == 8) || - (enc::bitDepth(source->encoding) == 16) || + (enc::bitDepth(source->encoding) == 16) || (enc::bitDepth(source->encoding) == 32)) { encoding = enc::BGR8;