ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
sensor_msgs::image_encodings::TYPE_8UC3 is not a color format, it is a data type with 3 channels of 8 bits each (but with no information of what each channel mean), so cv_bridge::toCvCopy doesn't know who to transform from bayer_rggb8 color format.
I assume that what you really want is to transform the original image received in bayer_rggb8 format to the more commonly used BGR8 format.
In that case try the following:
imgTmp = cv_bridge::toCvCopy(msg, sensor_msgs::image_encodings::BGR8);
Now, BGR8 is a color format, it also has 3 channels of 8 bits each, but now you know that the first channel corresponds to Blue, the second corresponds to Green and the third corresponds to Red.
2 | No.2 Revision |
sensor_msgs::image_encodings::TYPE_8UC3 is not a color format, it is a data type with 3 channels of 8 bits each (but with no information of what each channel mean), so cv_bridge::toCvCopy doesn't know who to transform from bayer_rggb8 color format.
I assume that what you really want is to transform the original image received in bayer_rggb8 format to the more commonly used BGR8 format.
In that case try the following:
imgTmp = cv_bridge::toCvCopy(msg, sensor_msgs::image_encodings::BGR8);
Now, BGR8 is a color format, it also has 3 channels of 8 bits each, but now you know that the first channel corresponds to Blue, the second corresponds to Green and the third corresponds to Red.
If by doing this you get random uniform colors, then make sure that the original image published by the driver is actually in bayer_rggb8 format.