In this section, we will see how to convert between the ROS image message (sensor_msgs/Image) and the OpenCV image data type (cv::Mat). The main ROS package used for this conversion is cv_bridge, which is part of the vision_opencv stack. The ROS library inside cv_bridge, called CvBridge, helps to perform this conversion. We can use the CvBridge library inside our code and perform the conversion. The following figure shows how the conversion is performed between ROS and OpenCV:
Here, the CvBridge library acts as a bridge for converting the ROS ...