Skip to content

Commit

Permalink
Merge pull request #540 from ijnek/feat/max-encoding
Browse files Browse the repository at this point in the history
ensure same format encoding happens for all encoded types
  • Loading branch information
ijnek authored Nov 28, 2024
2 parents a34a0c2 + e7cfc5d commit 6d06aa7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cv_bridge/src/cv_bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -151,7 +151,7 @@ static const int SAME_FORMAT = -1;
std::map<std::pair<Encoding, Encoding>, std::vector<int>> getConversionCodes()
{
std::map<std::pair<Encoding, Encoding>, std::vector<int>> res;
for (int i = 0; i <= 5; ++i) {
for (int i = 0; i < MAX_ENCODING; ++i) {
res[std::pair<Encoding, Encoding>(Encoding(i), Encoding(i))].push_back(SAME_FORMAT);
}

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 6d06aa7

Please sign in to comment.