36 #ifndef SENSOR_MSGS_IMAGE_ENCODINGS_H 37 #define SENSOR_MSGS_IMAGE_ENCODINGS_H 44 namespace image_encodings
104 "8UC",
"8SC",
"16UC",
"16SC",
"32SC",
"32FC",
"64FC"};
109 return encoding == RGB8 || encoding == BGR8 ||
110 encoding == RGBA8 || encoding == BGRA8 ||
111 encoding == RGB16 || encoding == BGR16 ||
112 encoding == RGBA16 || encoding ==
BGRA16;
117 return encoding == MONO8 || encoding ==
MONO16;
122 return encoding == BAYER_RGGB8 || encoding == BAYER_BGGR8 ||
123 encoding == BAYER_GBRG8 || encoding == BAYER_GRBG8 ||
124 encoding == BAYER_RGGB16 || encoding == BAYER_BGGR16 ||
130 return encoding == RGBA8 || encoding == BGRA8 ||
131 encoding == RGBA16 || encoding ==
BGRA16;
137 if (encoding == MONO8 ||
140 if (encoding == BGR8 ||
145 if (encoding == BGRA8 ||
147 encoding == BGRA16 ||
150 if (encoding == BAYER_RGGB8 ||
151 encoding == BAYER_BGGR8 ||
152 encoding == BAYER_GBRG8 ||
153 encoding == BAYER_GRBG8 ||
154 encoding == BAYER_RGGB16 ||
155 encoding == BAYER_BGGR16 ||
156 encoding == BAYER_GBRG16 ||
157 encoding == BAYER_GRBG16)
165 if (encoding.substr(0, prefix.size()) != prefix)
167 if (encoding.size() == prefix.size())
169 int n_channel = atoi(encoding.substr(prefix.size(),
170 encoding.size() - prefix.size()).c_str());
175 if (encoding == YUV422)
178 throw std::runtime_error(
"Unknown encoding " + encoding);
184 if (encoding == MONO16)
186 if (encoding == MONO8 ||
191 encoding == BAYER_RGGB8 ||
192 encoding == BAYER_BGGR8 ||
193 encoding == BAYER_GBRG8 ||
194 encoding == BAYER_GRBG8)
197 if (encoding == MONO16 ||
200 encoding == BGRA16 ||
201 encoding == RGBA16 ||
202 encoding == BAYER_RGGB16 ||
203 encoding == BAYER_BGGR16 ||
204 encoding == BAYER_GBRG16 ||
205 encoding == BAYER_GRBG16)
213 if (encoding.substr(0, prefix.size()) != prefix)
215 if (encoding.size() == prefix.size())
216 return atoi(prefix.c_str());
217 int n_channel = atoi(encoding.substr(prefix.size(),
218 encoding.size() - prefix.size()).c_str());
220 return atoi(prefix.c_str());
223 if (encoding == YUV422)
226 throw std::runtime_error(
"Unknown encoding " + encoding);
const std::string TYPE_16UC4
const std::string BAYER_GRBG8
const std::string BAYER_GRBG16
const std::string TYPE_8SC4
const std::string TYPE_64FC3
const std::string TYPE_8UC4
const std::string BAYER_RGGB16
static bool isBayer(const std::string &encoding)
const std::string TYPE_32FC4
const std::string TYPE_8UC1
GLsizei const GLchar *const * string
static bool hasAlpha(const std::string &encoding)
const std::string BAYER_GBRG8
const std::string BAYER_GBRG16
static bool isMono(const std::string &encoding)
const std::string TYPE_8SC3
const std::string BAYER_BGGR16
static bool isColor(const std::string &encoding)
Tools for manipulating sensor_msgs.
const std::string ABSTRACT_ENCODING_PREFIXES[]
const std::string TYPE_32FC1
const std::string TYPE_16SC3
const std::string TYPE_8UC2
const std::string TYPE_16UC1
const std::string TYPE_8SC1
const std::string TYPE_64FC4
const std::string TYPE_16UC3
const std::string TYPE_16UC2
const std::string TYPE_32SC2
const std::string BAYER_BGGR8
const std::string TYPE_64FC1
static int numChannels(const std::string &encoding)
const std::string TYPE_64FC2
const std::string TYPE_32SC3
static const char * encoding
const std::string BAYER_RGGB8
const std::string TYPE_8UC3
const std::string TYPE_32SC4
const std::string TYPE_32FC3
static int bitDepth(const std::string &encoding)
const std::string TYPE_16SC2
const std::string TYPE_32FC2
const std::string TYPE_32SC1
const std::string TYPE_16SC4
const std::string TYPE_8SC2
const std::string TYPE_16SC1