Ask Your Question

Revision history [back]

To subscribe to an image topic in a python script you'll need a subscriber and callback as described in the publisher and subscriber tutorial. However to process the image you'll need to use the CvBridge module to convert the ROS images to openCV images for processing. A full example of this in python is shown here. In this example the code subscribes to an image topic, and the callback draws a circle onto the image, displays it on screen and re-publishes it on a different image topic.

This second example should get you started, there is no need to modify the raspicam node at all. When a camera node is publishing images to ROS they can be accessed by python and C++ nodes just as easily.

Hope this helps.