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

capture publish and subscribe image using ROS

asked 2014-11-17 00:26:22 -0500

KDROS gravatar image

Hello Everyone,

I am newbie in ROS i have written C code for Capturing images using OpenCV and then using socket communication I am sending that images to remote location. Now I have to create same in ROS so that one node can capture images and other nodes can publish and subscribe multiple images. I dont know whether it is possible or not in ROS. Plz guide me something and share link that can easily work..

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-11-17 01:50:33 -0500

ahendrix gravatar image

updated 2014-11-17 01:52:20 -0500

ROS has the image_transport library which adds additional convenience methods for publishing and subscribing to images and their matching camera transformation matrices.

In addition, there is the cv_camera package which provides a ROS node that captures images through the OpenCV API and publishes them as ROS messages. This should take care of the capture and publish part of your pipeline. There are also many other camera drivers available for ROS which provide the same API for other types of cameras, and can expose vendor-specific APIs such as shutter, gain and synchronization control.

You'll want to explore the image_transport tutorials to subscribe to an existing image stream, convert it to an OpenCV format and process it.

edit flag offensive delete link more


I was using Usb_cam for capturing images. It is publishing image on topic "image_raw", with camera info, I dont have need of the camera info,I want to writesubscriber, Suggest changes required in link

KDROS gravatar image KDROS  ( 2014-11-18 23:36:24 -0500 )edit

I'm sorry; I don't understand you question well enough to give a better answer.

ahendrix gravatar image ahendrix  ( 2014-11-18 23:45:54 -0500 )edit

Sorry, Goto the Link and see publisher topic in usb_cam_node.cpp , It will publish image and camera info in this topic, How to write subscriber node for that

KDROS gravatar image KDROS  ( 2014-11-19 00:01:20 -0500 )edit

The image_transport subscriber tutorial should work. You may need to change the image topic, either in the tutorial or through remapping at runtime.

ahendrix gravatar image ahendrix  ( 2014-11-19 00:42:37 -0500 )edit

Since usb_cam is publishing two things image n camera info, so I think there is need to change callback function. What is remapping at runtime?

KDROS gravatar image KDROS  ( 2014-11-19 23:05:41 -0500 )edit

You said that you don't care about the camera info. Why do you want to subscribe to it?

ahendrix gravatar image ahendrix  ( 2014-11-19 23:37:00 -0500 )edit

Remapping allows you to change topic names without recompiling. See: for more info.

ahendrix gravatar image ahendrix  ( 2014-11-19 23:38:53 -0500 )edit

want to know very basic que. When will usb_cam publish image? after fixed time or, whenever i will save the image using right click in image_view?

KDROS gravatar image KDROS  ( 2014-11-24 02:12:12 -0500 )edit

Question Tools

1 follower


Asked: 2014-11-17 00:26:22 -0500

Seen: 4,566 times

Last updated: Nov 17 '14