range_image_creation.cpp
Go to the documentation of this file.
00001 #include <pcl/range_image/range_image.h>
00002 
00003 int main (int argc, char** argv) {
00004   pcl::PointCloud<pcl::PointXYZ> pointCloud;
00005   
00006   // Generate the data
00007   for (float y=-0.5f; y<=0.5f; y+=0.01f) {
00008     for (float z=-0.5f; z<=0.5f; z+=0.01f) {
00009       pcl::PointXYZ point;
00010       point.x = 2.0f - y;
00011       point.y = y;
00012       point.z = z;
00013       pointCloud.points.push_back(point);
00014     }
00015   }
00016   pointCloud.width = (uint32_t) pointCloud.points.size();
00017   pointCloud.height = 1;
00018   
00019   // We now want to create a range image from the above point cloud, with a 1deg angular resolution
00020   float angularResolution = (float) (  1.0f * (M_PI/180.0f));  //   1.0 degree in radians
00021   float maxAngleWidth     = (float) (360.0f * (M_PI/180.0f));  // 360.0 degree in radians
00022   float maxAngleHeight    = (float) (180.0f * (M_PI/180.0f));  // 180.0 degree in radians
00023   Eigen::Affine3f sensorPose = (Eigen::Affine3f)Eigen::Translation3f(0.0f, 0.0f, 0.0f);
00024   pcl::RangeImage::CoordinateFrame coordinate_frame = pcl::RangeImage::CAMERA_FRAME;
00025   float noiseLevel=0.00;
00026   float minRange = 0.0f;
00027   int borderSize = 1;
00028   
00029   pcl::RangeImage rangeImage;
00030   rangeImage.createFromPointCloud(pointCloud, angularResolution, maxAngleWidth, maxAngleHeight,
00031                                   sensorPose, coordinate_frame, noiseLevel, minRange, borderSize);
00032   
00033   std::cout << rangeImage << "\n";
00034 }


pcl
Author(s): Open Perception
autogenerated on Mon Oct 6 2014 03:17:37