Let's start with the header file. The ROS header files we are using in the code are here. We have to include ros/ros.h in every ROS C++ node; otherwise, the source code will not compile. The remaining three headers are image-transport headers, which have functions to publish and subscribe to image messages at a low bandwidth. The cv_bridge header has functions to convert between OpenCV ROS data types. The image_encoding.h header has the image-encoding format used during ROS-OpenCV conversions:
#include <ros/ros.h> #include <image_transport/image_transport.h> #include <cv_bridge/cv_bridge.h> #include <sensor_msgs/image_encodings.h>
The next set of headers is for OpenCV. The imgproc header consists of image-processing ...