源代码:
#include<iostream>
#include<pcl/io/pcd_io.h>
#include <pcl/io/ply_io.h>
#include<pcl/point_types.h>
#include <pcl/kdtree/kdtree_flann.h>
#include <pcl/features/normal_3d.h>
#include <pcl/io/obj_io.h>
#include <pcl/surface/gp3.h>
#include <pcl/visualization/pcl_visualizer.h>
int main(int argc, char** argv) {
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>());
pcl::PCLPointCloud2 cloud_blob;
//*打开点云文件
if (pcl::io::loadPCDFile("F:\\PCL_Rabbit\\ConsoleApplication1\\rabbit.pcd", cloud_blob) == -1) {
PCL_ERROR("Couldn't read file rabbit.pcd\n");
return(-1);
}
pcl::fromPCLPointCloud2(cloud_blob, *cloud);
//法线估计对象
pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> n;
//存储估计的法线
pcl::PointCloud<pcl::Normal>::Ptr normals(new pcl::PointCloud<pcl::Normal>);
//定