Ask Your Question
2

Latest image_view in ROS Fuerte is now expecting RGB rather than BGR

asked 2012-08-29 05:08:45 -0600

Arrakis gravatar image

updated 2014-01-28 17:13:30 -0600

ngrennan gravatar image

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"

edit retag flag offensive close merge delete

Comments

I'll cook up a test case to verify.

mjcarroll gravatar imagemjcarroll ( 2012-08-29 05:52:46 -0600 )edit
2

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?

mjcarroll gravatar imagemjcarroll ( 2012-08-29 06:16:10 -0600 )edit

Could you post the encoding value for the output sensor_msgs/Image messages in your bag?

Eric Perko gravatar imageEric Perko ( 2012-08-29 06:32:42 -0600 )edit

@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.

Arrakis gravatar imageArrakis ( 2012-08-30 07:42:19 -0600 )edit

@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.

Arrakis gravatar imageArrakis ( 2012-08-30 07:47:59 -0600 )edit

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?

Eric Perko gravatar imageEric Perko ( 2012-08-30 09:56:07 -0600 )edit

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

Arrakis gravatar imageArrakis ( 2012-09-02 06:12:37 -0600 )edit

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

Arrakis gravatar imageArrakis ( 2012-09-02 06:12:40 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2012-09-03 03:10:28 -0600

jkammerl gravatar image

This bug should be fixed in r40039.

https://code.ros.org/gf/project/ros-pkg/scmsvn/?action=browse&path=%2F&view=rev&revision=40039

An updated image_transport_plugin stack has been released. Please let me know if the fix works.

edit flag offensive delete link more
0

answered 2012-09-02 06:31:55 -0600

Arrakis gravatar image

updated 2012-09-02 07:01:52 -0600

My aptitude installed ROS auto-updated today, and I am experiencing further breakages. Now when I run my code I get the runtime error:

ERROR: Unable to convert 8UC3 image to bgr8: Unsupported conversion from [8UC3] to [bgr8]

This is a simple fix for future code. Just set cv_bridge::CvImage::encoding to 'bgr8' rather than '8UC3'. However I have seen '8UC3' syntax used (a while ago) in official ROS code.

These ROS changes have rendered my old bag files unusable, whilst providing no extra functionality at all. Perhaps either users should be made aware of changes that break backwards compatibility, or the person committing these changes should be made aware?

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-08-29 05:08:45 -0600

Seen: 1,173 times

Last updated: Sep 03 '12