image_pipeline icon indicating copy to clipboard operation
image_pipeline copied to clipboard

Add a compressed_image_view app that subscribe to a sensor_msgs/CompressedImage directly

Open romainreignier opened this issue 5 years ago • 4 comments

Useful for node that directly publishes compressed image without image_transport

romainreignier avatar May 10 '19 16:05 romainreignier

Question: Why not add this capability to the existing image_view node? It should just be a check if the word compressed /namespace/camera/image/compressed is around, then link the subscriber against that topic with the a compressed callback.

SteveMacenski avatar May 10 '19 16:05 SteveMacenski

@SteveMacenski Thanks for your quick reply. Indeed, it is possible to add this directly in image_view and by-pass the image_transport subscriber. I am ok with both solution, just tell me which one to choose.

romainreignier avatar May 10 '19 17:05 romainreignier

@romainreignier using the Subscriber/CameraSubscriber you can add a field of type TransportHints which contains a default_transport which can be set to compressed. In this case, you'd just have to check if the topic ends with /compressed if so, make the hint contain the transport type appropriate and then register that callback.

More info here: http://wiki.ros.org/image_transport

From how I read these docs (http://docs.ros.org/diamondback/api/image_transport/html/classimage__transport_1_1ImageTransport.html#ac871ee686e1d6767ec5c2eec9daf9399) you probably dont even need to use the fact that /compressed is the topic beyond the hints. The argument name base_topic makes me think that if you just tell it to use the hint of compressed that it will automatically deal with that other stuff for you. That should change this to about a 3 line change in the main() and potentially not even needing another callback (but probably)

SteveMacenski avatar May 10 '19 17:05 SteveMacenski

@SteveMacenski Sorry but I misunderstood your point. My issue is to subscribe to a topic of type sensor_msgs/CompressedImage but not advertised by image_transport so the topic does not ends with compressed.

romainreignier avatar May 13 '19 07:05 romainreignier

@romainreignier Is this still something you're interested in having merged? Please let me know or I can close the PR.

JWhitleyWork avatar Dec 04 '22 22:12 JWhitleyWork

I think that it would be nice to have this tool. But I understand if you don't want to maintain it because the use case does not seem too popular.

romainreignier avatar Dec 14 '22 18:12 romainreignier

You should actually still be able to make image_view work for you by directly remapping the compressed topic name:

ros2 run image_view image_view --ros-args -r image/compressed:=your/other/topic/name -p image_transport:=compressed

mikeferguson avatar Jan 18 '24 03:01 mikeferguson

This PR also targets melodic, which is EOL.

mikeferguson avatar Jan 18 '24 03:01 mikeferguson