The implementation of convert_to_ros_message sets the encoding string to bgr8 if the cv::Mat is of type CV_8UC3. But in reality the same type, ie 8bit 3 channel, could also be used for rgb8 encodings.
This is acknowledged in encoding2mat_type(..) where both bgr8 and rgb8 return type CV_8UC3.
When implementing camera drivers using this type adapter, the choice of encoding should be left to the user. The auto-inference of the encoding based on cv::Mat type is useful but having an override in the ROSCvMatContainer API would be ideal.
The implementation of convert_to_ros_message sets the encoding string to
bgr8
if thecv::Mat
is of typeCV_8UC3
. But in reality the same type, ie 8bit 3 channel, could also be used forrgb8
encodings.This is acknowledged in encoding2mat_type(..) where both
bgr8
andrgb8
return typeCV_8UC3
.When implementing camera drivers using this type adapter, the choice of encoding should be left to the user. The auto-inference of the encoding based on cv::Mat type is useful but having an override in the
ROSCvMatContainer
API would be ideal.