Latest image_view in ROS Fuerte is now expecting RGB rather than BGR
I have a cv_bridge::CvImage image of type '8UC3'. This publishes a cv::Mat of type BGR. I have old bag files with image topics published this way. Up until yesterday these displayed fine. Today, when visualising with image_view, red is now blue, blue is now red. However, when I display a live stream using the exact same code, the colours are as they should be.
It thus seems that image_transport has changed from images outputting BGR format to RGB. As I can see no positive benefits for this change, and with the added inconvenience of breaking old bag files, is this a bug? It seems very much like a case of "If it isn't broken, don't fix it"
I'll cook up a test case to verify.
I created a test case here: https://gist.github.com/3515031 This creates an image with a Blue-Green-Red-Black pattern, which is then opened in an OpenCV image. Opening with image_view provides the same result. Perhaps try this test case and see if it works for you?
Could you post the encoding value for the output sensor_msgs/Image messages in your bag?
@Eric Perko It seems you're on the right track. Using rostopic echo from my old bag file I have
format: jpeg
But in the new bag files I have
format: 8UC3; jpeg compressed
These were recorded using the exact same code, and so should be identical. Clearly they're not.
@mjcarroll Thanks for the help. The problem only exists in images recorded in old bag files (prior to the day of this post) when displayed in new image_view / rviz. Whether it's gone from BGR->RGB or from RGB->BGR I'm not sure, but it has definitely been changed.
It seems you are looking at the wrong topic... sensor_msgs/Image (http://www.ros.org/doc/api/sensor_msgs/html/msg/Image.html) doesn't have a "format" field, only an encoding field. Could you post a old and new bagfile somewhere so that we can download and take a look at it?
I am actually using compressed images, which do have the format field. I assumed the message format would be the same but it seems not:
http://www.ros.org/doc/api/sensor_msgs/html/msg/CompressedImage.html
I am actually using compressed images, which do have the format field. I assumed the message format would be the same but it seems not: http://www.ros.org/doc/api/sensor_msgs/html/msg/CompressedImage.html