分享

如何从点云创建深度图像(1)

 昵称43128558 2017-07-17

如何从点云创建深度图像(1)

 

 


   本小节一起学习如何从点云和给定的传感器位置来创建深度图像,下面的程序,首先是生成一个矩形点云,然后基于该点云创建深度图像。

代码

首先,在PCLPoint Cloud Learning)中国协助发行的书提供光盘的第9章例1文件夹中,打开名为range_image_creation.cpp的代码文件。

解释说明

下面来解析打开源代码中的关键语句。

#include <pcl/range_image/range_image.h>          //深度图像头文件

int main (int argc, char** argv) {

  pcl::PointCloud<pcl::PointXYZ> pointCloud;      //定义点云对象

  for (float y=-0.5f; y<=0.5f; y+=0.01f) {        //循环产生点数据

   for (float z=-0.5f; z<=0.5f; z+=0.01f) {

      pcl::PointXYZ point;

      point.x = 2.0f - y;

      point.y = y;

      point.z = z;

      pointCloud.points.push_back(point);          //循环添加点数据到点云对象

    }

  }

  pointCloud.width = (uint32_t) pointCloud.points.size();

  pointCloud.height = 1;                            //设置点云对象的头信息

这段程序首先创建一组数据作为点云的数据内容,再设置文件头的信息,整个实现生成一个呈矩形形状的点云。

  float angularResolution = (float) (  1.0f * (M_PI/180.0f)); // 按弧度1

  float maxAngleWidth     = (float) (360.0f * (M_PI/180.0f)); // 按弧度360.0

  float maxAngleHeight    = (float) (180.0f * (M_PI/180.0f)); // 按弧度180.0

  Eigen::Affine3f sensorPose = (Eigen::Affine3f)Eigen::Translation3f(0.0f, 0.0f, 0.0f);                                                           //采集位置

  pcl::RangeImage::CoordinateFrame coordinate_frame = pcl::RangeImage::CAMERA_FRAME;                           //深度图像遵循的坐标系统

  float noiseLevel=0.00;

  float minRange = 0.0f;

  int borderSize = 1;

    未完待续,敬请关注“如何从点云创建深度图像(2)的其他内容。

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多