@@ -134,16 +134,16 @@ Encoding getEncoding(const std::string& encoding)
134
134
return INVALID;
135
135
}
136
136
137
- static const int SAME_FORMAT = -1 ;
137
+ static const int SAME_ENCODING = -1 ;
138
138
139
- /* * Return a lit of OpenCV conversion codes to get from one Format to the other
140
- * The key is a pair: <FromFormat, ToFormat > and the value a succession of OpenCV code conversion
139
+ /* * Return a lit of OpenCV conversion codes to get from one encoding to the other
140
+ * The key is a pair: <FromEncoding, ToEncoding > and the value a succession of OpenCV code conversion
141
141
* It's not efficient code but it is only called once and the structure is small enough
142
142
*/
143
143
std::map<std::pair<Encoding, Encoding>, std::vector<int > > getConversionCodes () {
144
144
std::map<std::pair<Encoding, Encoding>, std::vector<int > > res;
145
145
for (int i=0 ; i<=5 ; ++i)
146
- res[std::pair<Encoding, Encoding>(Encoding (i),Encoding (i))].push_back (SAME_FORMAT );
146
+ res[std::pair<Encoding, Encoding>(Encoding (i),Encoding (i))].push_back (SAME_ENCODING );
147
147
148
148
res[std::make_pair (GRAY, RGB)].push_back (cv::COLOR_GRAY2RGB);
149
149
res[std::make_pair (GRAY, BGR)].push_back (cv::COLOR_GRAY2BGR);
@@ -214,7 +214,7 @@ const std::vector<int> getConversionCode(std::string src_encoding, std::string d
214
214
" ] is. The conversion does not make sense" );
215
215
if (!is_num_channels_the_same)
216
216
throw Exception (" [" + src_encoding + " ] and [" + dst_encoding + " ] do not have the same number of channel" );
217
- return std::vector<int >(1 , SAME_FORMAT );
217
+ return std::vector<int >(1 , SAME_ENCODING );
218
218
}
219
219
220
220
// 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<int> getConversionCode(std::string src_encoding, std::string d
223
223
if (!is_num_channels_the_same)
224
224
throw Exception (" [" + src_encoding + " ] is a color encoding but [" + dst_encoding + " ] " +
225
225
" is not so they must have the same OpenCV type, CV_8UC3, CV16UC1 ...." );
226
- return std::vector<int >(1 , SAME_FORMAT );
226
+ return std::vector<int >(1 , SAME_ENCODING );
227
227
}
228
228
229
229
// If we are converting from a color type to another type, then everything is fine
@@ -238,7 +238,7 @@ const std::vector<int> getConversionCode(std::string src_encoding, std::string d
238
238
// And deal with depth differences if the colors are different
239
239
std::vector<int > res = val->second ;
240
240
if ((enc::bitDepth (src_encoding) != enc::bitDepth (dst_encoding)) && (getEncoding (src_encoding) != getEncoding (dst_encoding)))
241
- res.push_back (SAME_FORMAT );
241
+ res.push_back (SAME_ENCODING );
242
242
243
243
return res;
244
244
}
@@ -320,7 +320,7 @@ CvImagePtr toCvCopyImpl(const cv::Mat& source,
320
320
cv::Mat image2;
321
321
for (size_t i=0 ; i<conversion_codes.size (); ++i) {
322
322
int conversion_code = conversion_codes[i];
323
- if (conversion_code == SAME_FORMAT )
323
+ if (conversion_code == SAME_ENCODING )
324
324
{
325
325
// Same number of channels, but different bit depth
326
326
int src_depth = enc::bitDepth (src_encoding);
@@ -550,7 +550,7 @@ CvImageConstPtr cvtColorForDisplay(const CvImageConstPtr& source,
550
550
{
551
551
try
552
552
{
553
- // Let's decide upon an output format
553
+ // Let's decide upon an output encoding
554
554
if (enc::numChannels (source->encoding ) == 1 )
555
555
{
556
556
if ((source->encoding == enc::TYPE_32SC1) ||
@@ -661,13 +661,13 @@ CvImageConstPtr cvtColorForDisplay(const CvImageConstPtr& source,
661
661
return cvtColor (img_scaled, encoding);
662
662
}
663
663
664
- // If no color conversion is possible, we must "guess" the input format
664
+ // If no color conversion is possible, we must "guess" the input encoding
665
665
CvImagePtr source_typed (new CvImage ());
666
666
source_typed->image = source->image ;
667
667
source_typed->header = source->header ;
668
668
source_typed->encoding = source->encoding ;
669
669
670
- // If we get the OpenCV format , if we have 1,3 or 4 channels, we are most likely in mono, BGR or BGRA modes
670
+ // If we get the OpenCV encoding , if we have 1,3 or 4 channels, we are most likely in mono, BGR or BGRA modes
671
671
if (source->encoding == " CV_8UC1" )
672
672
source_typed->encoding = enc::MONO8;
673
673
else if (source->encoding == " 16UC1" )
@@ -687,7 +687,7 @@ CvImageConstPtr cvtColorForDisplay(const CvImageConstPtr& source,
687
687
688
688
try
689
689
{
690
- // Now that the output is a proper color format , try to see if any conversion is possible
690
+ // Now that the output is a proper color encoding , try to see if any conversion is possible
691
691
return cvtColor (source_typed, encoding);
692
692
}
693
693
catch (cv_bridge::Exception& e)
0 commit comments