构造点云数据
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.0 - 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));
float maxAngleHeight = (float)(180.0f * (M_PI / 180.0f));//模拟的范围传感器有一个完整的360度全景图
Eigen::Affine3f sensorPose = (Eigen::Affine3f) Eigen::Translation3f(0.0f, 0.0f, 0.0f);//传感器的位置定义了虚拟传感器的6 DOF位置,它的原点是滚动=俯仰=偏航=0。
pcl::RangeImage::CoordinateFrame coordinate_frame = pcl::RangeImage::CAMERA_FRAME;//x朝向右,y向下,z轴是向前的,另一种选择是激光框架,x面向前方,y向左,z向上。
float noiseLevel = 0.00;//对于噪声,噪声是0,范围图像是使用普通