IP Camera connected and published in ROS Image Message

Capturing Images from IP Camera and Publish it in ROS Image Message

Source https://github.com/ardyadipta/ROS/tree/master/camera_image

The upside and challenges of this work were so many ROS packages available for reading images from cameras. However, most of them were meant for PR2 robot or specific brand IP Cameras such as AXIS. Those packages were complicated with a lot of configurations and format, which were specified for that camera. Doing reverse-engineering on those packages was a hassle since a lot of configurations need to be understood. So, I decided to keep learning from OpenCV module and tried to build my own package from scratch.

At the end, I learned how to get images from IP camera. I used a stream module from OpenCV library to read every byte of the image, then stored it to OpenCV matrix CvMat and converted it to ROS Message using cv_bridge, a ROS Module which is able to convert OpenCV images to ROS Messages and vice versa. The chart of this work can be seen in figure 1.

To demonstrate it, I opened  3 windows as seen in figure 2: Publisher Node, Subscriber Node and rqt_graph window. Publisher node captured the images from the IP camera, converted the images using cv_bridge, and then sent the ROS Image message named “/camera_image”. Subscriber node received the messages from publisher node, reconverted it back to OpenCV Image and then showed the OpenCV Image. The last window is rqt_graph, which was showed the relation between those nodes and the name of the message that was sent by the publisher to the subscriber node.

CV Bridge

Figure 1. CV Bridge Communication

IP Camera connected and published in ROS Image Message

Figure 2. IP Camera connected and published in ROS Image Message



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

by Bliss Drive Review