ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Send the name of image files

asked 2012-08-26 05:55:55 -0600

130s gravatar image

updated 2012-08-26 06:27:11 -0600

I'm sending image files using image_transport and my client node likes to receive the file names as well but apparently sensor_msgs::Image doesn't have a field for it. Nor I haven't been able to find other measure in ROS to send image file and its name together. What's the most recommended way to achieve my goal? Extend Image and make my own publisher node (isn't it nicer to have this feature by default if it doesn't exist)?

To save an image as a file btw usually requires file extension but knowing file name solves as well (sensor_msgs/CompressedImage has a field for it but still not for file name).

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2012-08-26 07:56:20 -0600

jbohren gravatar image

updated 2012-08-26 07:58:53 -0600

Before trying these, first maybe you should ask yourself if you really need to be sending images with filenames over ROS, instead of just the filenames, and letting your client read them into memory. However, if you really must do this, there are two options that come to mind:

Option 1: You can publish two streams of data, one from the image_transport and one from a normal publisher with your own custom metadata type with an identical header. Then on the receiving end, you should be able to use a message synchronizer with the image_transport as described in this question.

Option 2: If you care about the image data frame-by-frame, then you're probably only using the RAW transport of image_transport. In this case, you don't really need it, and you can just use a normal publisher and use your own composite message like:

sensor_msgs/Image image
string filename
edit flag offensive delete link more

Comments

@jbohren I asked this b/c I wasn't sure if there's already nice solution for my case. msg synchronizer looks interesting & I'll try it.

130s gravatar image 130s  ( 2012-08-29 19:19:38 -0600 )edit

Also nice warning at the beginning! In our case we receive msg from a node on different robot that's made by other team in different org so 1st of all nice to have flexibility (and I can think of situations where sending file names becomes advantageous).

130s gravatar image 130s  ( 2012-08-29 19:20:48 -0600 )edit

Question Tools

Stats

Asked: 2012-08-26 05:55:55 -0600

Seen: 530 times

Last updated: Aug 26 '12