我在ros-indigo环境下,运行opencv来得到realsense r200的图像。
源码是直接使用的ros下cv_bridge的包的教程:如下
#include<ros/ros.h> //ros标准库头文件
#include<iostream> //C++标准输入输出库
/*
cv_bridge中包含CvBridge库
*/
#include<cv_bridge/cv_bridge.h>
/*
ROS图象类型的编码函数
*/
#include<sensor_msgs/image_encodings.h>
/*
image_transport 头文件用来在ROS系统中的话题上发布和订阅图象消息
*/
#include<image_transport/image_transport.h>
//OpenCV2标准头文件
#include<opencv2/core/core.hpp>
#include<opencv2/highgui/highgui.hpp>
#include<opencv2/imgproc/imgproc.hpp>
static const std::string OPENCV_WINDOW = "Image window";
class ImageConverter
{
ros::NodeHandle nh_;
image_transport::ImageTransport it_;
image_transport::Subscriber image_sub_;
image_transport::Publisher image_pub