00001 /* 00002 License: BSD 00003 https://raw.github.com/robotics-in-concert/rocon_devices/license/LICENSE 00004 */ 00005 00006 #ifndef ROCON_RTSP_CAMERA_RELAY 00007 #define ROCON_RTSP_CAMERA_RELAY 00008 00009 #include<ros/ros.h> 00010 #include<opencv2/opencv.hpp> 00011 #include<cv_bridge/cv_bridge.h> 00012 00013 #include<std_msgs/String.h> 00014 #include<image_transport/image_transport.h> 00015 #include<sensor_msgs/image_encodings.h> 00016 #include<sensor_msgs/Image.h> 00017 #include<sensor_msgs/CameraInfo.h> 00018 00019 namespace rocon { 00020 00021 class RoconRtspCameraRelay { 00022 public: 00023 RoconRtspCameraRelay(ros::NodeHandle& n); 00024 ~RoconRtspCameraRelay(); 00025 00026 bool init(const std::string video_stream_url); 00027 bool reset(const std::string video_stream_url); 00028 00029 void spin(); 00030 00031 protected: 00032 void convertCvToRosImg(const cv::Mat& mat, sensor_msgs::Image& ros_img, sensor_msgs::CameraInfo& ci); 00033 00034 private: 00035 cv::VideoCapture vcap_; 00036 std::string video_stream_address_; 00037 std::string status_; 00038 00039 image_transport::Publisher pub_video_; 00040 ros::Publisher pub_camera_info_; 00041 ros::Publisher pub_status_; 00042 ros::NodeHandle nh_; 00043 }; 00044 } 00045 00046 #endif