The ROS interface with OpenCV

OpenCV is also integrated into ROS, mainly for image processing. The vision_opencv ROS stack includes the complete OpenCV library and the interface with ROS.

The vision_opencv meta package consists of individual packages:

  • cv_bridge: This contains the CvBridge class. This class converts ROS image messages to the OpenCV image data type and vice versa.
  • image_geometry: This contains a collection of methods to handle image and pixel geometry.

The following diagram shows how OpenCV is interfaced with ROS:

OpenCV-ROS interfacing

The image data types of OpenCV are IplImage and Mat. If we want to work with OpenCV in ROS, we have to convert IplImage or Mat to ROS image messages. The ROS package vision_opencv has the CvBridge class; this class can convert IplImage to a ROS image and vice versa. Once we get the ROS image topics from any kind of vision sensor, we can use ROS CvBridge in order to convert it from ROS topic to Mat or IplImage format.

The following section shows you how to create a ROS package; this package contains a node to subscribe to RGB and depth images, process RGB images to detect edges and display all images after converting them to an image type equivalent to OpenCV.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.238.20