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

Can I use image transport for the two different image topics?

asked 2018-07-17 08:33:06 -0600

mozer gravatar image

Using an RGBD camera (RealSense D435), we want to log compressed color images (JPEG 'compressed'), and depth images (PNG 'compressedDepth'). The realsense driver publishes these compressed topics which is great.

However the problem comes in processing the two types data: Image transport gives some tutorials on how to subscribe to a compressed topic using a single param 'image_transport compressed'

But these two topics are of a different type, so we cannot set a single 'image_transport' variable to compressed or compressedDepth.

Question: Can a single application use image_transport to subscribe to both a compressed JPEG topic and a compressedDepth PNG topic. This is needed to be able to run Visual Odometry on this data.

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
1

answered 2018-07-18 03:14:19 -0600

pavel92 gravatar image

I am not sure but I think that image_transport should be able to allow you to subscribe to different topics with different data types. Take a look into compressed_image_transport and compressed_depth_image_transport. They both refer to this tutorial. Its a bit vague, but you should have two different parameters(<base_topic>/compressed/format (string, default: jpeg)). Compressed color images should be on /camera/rgb/image_raw/compressed and compressed depth images on /camera/depth/image_raw/compressed. You should be able to change the format (jpeg or png) for them separately. You can check for the color images if you echo this /camera/rgb/image_raw/compressed/parameter_updates for example.

Also this link might help you with another way of setting the compressed parameter.

edit flag offensive delete link more
1

answered 2018-07-18 03:45:00 -0600

Reamees gravatar image

updated 2018-07-18 03:46:13 -0600

From what I understand from your question is that you are recording bags with compressed image topics and need to do some processing on the recorded images. If you want you can build the decompression into your image processing node, you can google for examples or look at the image_transport API. It is unclear to me what the problem there is, adding the second topic to your code that handles one topic?

I'm not sure what it is exactly you are asking, so I will answer a question that I think you have. How do I get decompressed images that I can process from a bag of compressed data?

Make a launch file to decompress the data using republish(change the "your_*_topic" to the actual topics you want to decompress):

<launch>
    <node name="decompress_jpg" pkg="image_transport" type="republish" output="screen"
        args="compressed in:=/your_jpg_topic raw out:=/your_jpg_topic_raw">
    </node>

    <node name="decompress_png" pkg="image_transport" type="republish" output="screen"
        args="compressed in:=/your_png_topic raw out:=/your_png_topic_raw">
    </node>
</launch>

To diplay the images you could make another launch file like this

<launch>
   <node name="image_view_jpg" pkg="image_view" type="image_view" respawn="false" output="screen">
        <remap from="image" to="/your_jpg_topic_raw" />
    </node>

    <node name="image_view_png" pkg="image_view" type="image_view" respawn="false" output="screen">
        <remap from="image" to="/your_png_topic_raw" />
    </node>
</launch>
edit flag offensive delete link more
0

answered 2018-07-18 07:49:20 -0600

mozer gravatar image

updated 2018-07-18 07:49:55 -0600

Thanks the link you suggested gave me my solution.

Within one application I can directly specify transport when subscribing with TransportHints:

imageTransportSub_ = imageTransport_.subscribe(cameraTopic, 1, &App::imageCallback, this, image_transport::TransportHints("compressed"));

imageDepthTransportSub_ = imageTransport_.subscribe(cameraDepthTopic, 1, &App::imageDepthCallback, this, image_transport::TransportHints("compressedDepth"));

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-07-17 08:33:06 -0600

Seen: 2,317 times

Last updated: Jul 18 '18