Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure same format encoding happens for all encoded types #540

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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