点云边缘提取及可视化

点云素材:bunny.txt

#include 
#include 
#include 

void CreateCloudFromTxt(const std::string& file_path,
                        pcl::PointCloud::Ptr cloud) {
    std::ifstream fin(file_path.c_str());
    std::string line;
    pcl::PointXYZ point;
    while (getline(fin, line)) {
        std::stringstream ss(line);
        ss >> point.x;
        ss >> point.y;
        ss >> point.z;
        cloud->push_back(point);
    }
    fin.close();
}

void EstimateNormal(const pcl::PointCloud::Ptr cloud,
                    pcl::PointCloud::Ptr normals) {
  pcl::NormalEstimation normal_est;
  normal_est.setInputCloud(cloud);
  // normal_est.setRadiusSearch(0.05); // 

你可能感兴趣的:(PCL)