How it works…

In this section, we will discuss program8 (refer to chapter4_tutorials/src/program8.cpp on GitHub), which implements a basic camera capture program using OpenCV and ROS binding to convert cv::Mat images into ROS image messages. This node publishes the image messages from camera frames in the /camera topic and enables us to display images coming from a camera on-the-fly. We will discuss more about source code and implementation in the upcoming chapter, or interested readers could refer to the online resources (https://docs.opencv.org/3.0-beta/modules/videoio/doc/reading_and_writing_video.html).

However, we can run the node using the launch file:

$ roslaunch chapter4_tutorials program8.launch

We can't use rostopic echo /camera ...

Get Robot Operating System Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.