As far as topics go, on the publisher side you should append "/compressed" to your intended topic name, e.g. "stereo/left/image_raw/compressed". Then any node using image_transport can subscribe to the base topic "stereo/left/image_raw" as long as you set the parameter ~image_transport to "compressed", for example:
$ rosrun image_view image_view image:=stereo/left/image_raw _image_transport:=compressed
image_transport was not really designed with this use case in mind, but it does work.
Patrick
The axis_camera node in the texas_drivers stack does exactly this.
https://code.ros.org/trac/wg-ros-pkg/browser/stacks/texas_drivers/trunk/axis_camera/axis.py
The relevant snippets (python code, but C++ would be almost identical):
Create the appropriate publishers ("compressed" and "camera_info"
self.pub = rospy.Publisher("axis_camera/compressed", CompressedImage, self)
self.caminfo_pub = rospy.Publisher("axis_camera/camera_info",
CameraInfo, self)
Populate the appropriate messages and publish:
img = fp.read(content_length)
msg = CompressedImage()
msg.header.stamp = rospy.Time.now()
msg.format = "jpeg"
msg.data = img
self.axis.pub.publish(msg)
cimsg = CameraInfo()
cimsg.header.stamp = msg.header.stamp
cimsg.width = self.width
cimsg.height = self.height
self.axis.caminfo_pub.publish(cimsg)
On Tue, Mar 16, 2010 at 7:10 AM, Rene Ladan <r.c.ladan@gmail.com> wrote:
> Hi,
>
> I'm writing a node to publish images from the Surveyor stereo camera
> (see http://www.surveyor.com/stereo/ ).
> The camera publishes the images in JPEG format. The logical thing
> would be to somehow feed them to the
> compressed_image_format node (after setting up a handmade header?) to
> publish them. Is there any example
> code which does this?
>
> Also, if I understand correctly, the subscriber can just subscribe to
> the normal image_transport topic, but needs
> to have extra code to decompress compressed images before using them?
>
> Thanks,
> Rene
> --
> http://www.rene-ladan.nl/
>
> GPG fingerprint = E738 5471 D185 7013 0EE0 4FC8 3C1D 6F83 12E1 84F6
> (subkeys.pgp.net)
> _______________________________________________
> ros-users mailing list
> ros-users@code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>
_______________________________________________
ros-users mailing list
ros-users@code.ros.org
https://code.ros.org/mailman/listinfo/ros-users