3 #include <pcl/point_types.h> 
    4 #include <pcl/point_cloud.h> 
    5 #include <pcl_ros/point_cloud.h> 
   10 #include <sensor_msgs/Image.h> 
   11 #include <sensor_msgs/CameraInfo.h> 
   39         pub_rgb_img_ = std::make_shared<ros::Publisher>(
nh_.advertise<sensor_msgs::Image>(ns + 
"rgb/image", 1));
 
   40         pub_rgb_info_ = std::make_shared<ros::Publisher>(
nh_.advertise<sensor_msgs::CameraInfo>(ns + 
"rgb/camera_info", 1));
 
   41         ROS_DEBUG_STREAM_NAMED(
"ServerROS", 
"rgb image topic: " << 
pub_rgb_img_->getTopic());
 
   42         ROS_DEBUG_STREAM_NAMED(
"ServerROS", 
"rgb camera info topic: " << 
pub_rgb_info_->getTopic());
 
   46         ROS_DEBUG_NAMED(
"ServerROS", 
"rgb image publisher not initialized");
 
   47         ROS_DEBUG_NAMED(
"ServerROS", 
"rgb camera info publisher not initialized");
 
   51         pub_depth_img_ = std::make_shared<ros::Publisher>(
nh_.advertise<sensor_msgs::Image>(ns + 
"depth/image", 1));
 
   52         pub_depth_info_ = std::make_shared<ros::Publisher>(
nh_.advertise<sensor_msgs::CameraInfo>(ns + 
"depth/camera_info", 1));
 
   53         ROS_DEBUG_STREAM_NAMED(
"ServerROS", 
"depth image topic: " << 
pub_depth_img_->getTopic());
 
   54         ROS_DEBUG_STREAM_NAMED(
"ServerROS", 
"depth camera info topic: " << 
pub_depth_info_->getTopic());
 
   58         ROS_DEBUG_NAMED(
"ServerROS", 
"depth image publisher not initialized");
 
   59         ROS_DEBUG_NAMED(
"ServerROS", 
"depth camera info publisher not initialized");
 
   63         pub_depth_pc_ = std::make_shared<ros::Publisher>(
nh_.advertise<pcl::PointCloud<pcl::PointXYZ> >(ns + 
"depth/points", 1));
 
   64         ROS_DEBUG_STREAM_NAMED(
"ServerROS", 
"pointcloud topic: " << 
pub_depth_pc_->getTopic());
 
   68         ROS_DEBUG_NAMED(
"ServerROS", 
"pointcloud publisher not initialized");
 
   85             sensor_msgs::Image msg;
 
   86             sensor_msgs::CameraInfo info_msg;
 
   92             info_msg.header = msg.header;
 
  101              pcl::PointCloud<pcl::PointXYZRGB>::Ptr pc_msg(
new pcl::PointCloud<pcl::PointXYZRGB>());
 
  103              pc_msg->header.stamp = 
static_cast<uint64_t
>(image.
getTimestamp() * 1e6);
 
  107              pc_msg->is_dense = 
true;
 
  110              for(
int y = 0; y < view.
getHeight(); ++y)
 
  112                  for(
int x = 0; x < view.
getWidth(); ++x)
 
  117                          const cv::Vec3b& 
c = view.
getColor(x, y);
 
  120                          pc_msg->points.push_back(pcl::PointXYZRGB());
 
  121                          pcl::PointXYZRGB& p_pcl = pc_msg->points.back();
 
  122                          p_pcl.x = 
static_cast<float>(p.
x);
 
  123                          p_pcl.y = 
static_cast<float>(-p.
y);
 
  124                          p_pcl.z = 
static_cast<float>(-p.
z);
 
  132                          pc_msg->is_dense = 
false;
 
  148         sensor_msgs::Image msg;
 
  149         sensor_msgs::CameraInfo info_msg;
 
  155         info_msg.header = msg.header;