Ask Your Question
0

Viewing images inside messages

asked 2016-11-05 02:52:25 -0500

gnurf gravatar image

I am writing a system with a stereo camera, and would like to group left/right image pairs together as soon as possible, to reduce desynchronization due to asynchronous exchanges. It results that my messages are not Image themselves, but containing 2 Image. Is there a way to easily see images inside any kind of message ? Ideally something like rqt_image_view, but able to peek inside topic messages fields, rather than just show those that are of top-level type Image ?

edit retag flag offensive close merge delete

Comments

Not an answer, just curious:

[..] as soon as possible, to reduce desynchronization due to asynchronous exchanges

is there something in your system that makes using header.stamp for this not possible? It is explicitly meant to synchronise msgs.

gvdhoorn gravatar image gvdhoorn  ( 2016-11-05 06:38:14 -0500 )edit

Synchronizing messages based on a timestamp would be much harder than just receiving pairs that I know by design have been generated together. The images are correlated at the source, I see as wasteful separating them, then doing additional efforts to re-correlate them.

gnurf gravatar image gnurf  ( 2016-11-05 08:10:15 -0500 )edit

Synchronising subscriptions is built-in into the middleware (see wiki/message_filters - Policy-based Synchronizer. Using separate dataflows allows you to re-use existing msg defs, in this case Images and ..

gvdhoorn gravatar image gvdhoorn  ( 2016-11-05 09:25:58 -0500 )edit

.. CameraInfo data.

I'm not claiming that what you're doing is wrong btw, just curious.

gvdhoorn gravatar image gvdhoorn  ( 2016-11-05 09:26:18 -0500 )edit

Subscribing to a field inside a msg is not universally supported. rostopic echo .. can do it. The relay_field command in the topic_tools pkg can also do it. It can then also republish the field to another topic. That would allow you to use image_view to view the extracted image.

gvdhoorn gravatar image gvdhoorn  ( 2016-11-05 09:47:50 -0500 )edit

The synchro middleware looks cool, especially to sync separated sources, but in my case I think it would be adding unneeded complexity. Plus I'd like to annotate the images with custom fields, so that would make a lot of things to synchronize, just for the sake of having pure Image messages.

gnurf gravatar image gnurf  ( 2016-11-05 13:53:51 -0500 )edit

I managed to use echo, but am struggling with relay_field. (I saw your question about it on github, thanks for digging !). I think it's not very practical, from the looks of it: you'd have to explicit every single field of the Image you want to produce, it seems (and even that I didn't manage).

gnurf gravatar image gnurf  ( 2016-11-05 13:55:58 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-11-10 01:44:32 -0500

gnurf gravatar image

updated 2016-11-10 02:04:12 -0500

gvdhoorn gravatar image

Actually it works with simply topic_tools transform:

$ rosmsg show stereo_camera/RectifiedPair
std_msgs/Header header
  uint32 seq
  time stamp
  string frame_id
sensor_msgs/Image left
...

$ rosrun topic_tools transform /rectified_pair /rect_left sensor_msgs/Image

I'm not sure relay_field is necessary anymore. At least in my case, transform can relay simply enough.

edit flag offensive delete link more

Comments

1

Nice. Good to hear it worked for you.

And thanks for reporting back.

gvdhoorn gravatar image gvdhoorn  ( 2016-11-10 02:03:29 -0500 )edit

Thanks for formatting my answer :)

gnurf gravatar image gnurf  ( 2016-11-10 14:54:51 -0500 )edit

No problem :).

gvdhoorn gravatar image gvdhoorn  ( 2016-11-11 02:38:24 -0500 )edit

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-11-05 02:52:25 -0500

Seen: 256 times

Last updated: Nov 10 '16