点云技术相关产学研社区

 找回密码
 立即注册加入PCL中国点云技术相关产学研社区

扫一扫,访问微社区

查看: 7356|回复: 4

用PrincipalCurvaturesEstimation计算曲率的问题

[复制链接]
发表于 2014-6-9 14:41:44 | 显示全部楼层 |阅读模式
我用PrincipalCurvaturesEstimation计算了曲率,代码是官方的代码,然后想知道pcl::PrincipalCurvatures这个数据结构中到底哪个成员才是点的曲率?

代码:
#include <iostream>
#include <vector>

#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/features/normal_3d.h>
#include <pcl/features/principal_curvatures.h>

#include <pcl/PolygonMesh.h>
#include <pcl/io/ply_io.h>

using namespace std;

int main ()
{
  /*
  pcl::PCLPointCloud2 cloud1;
  pcl::io::loadPLYFile("L10.ply",cloud1);
  pcl::io::savePCDFile("L10.pcd",cloud1);
  */

  pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);

  if (pcl::io::loadPCDFile<pcl::PointXYZ> ("L10.pcd", *cloud) == -1) //* load the file
  {
    PCL_ERROR ("Couldn't read file");
    return (-1);
  }

  std::cout << "Loaded " << cloud->points.size () << " points." << std::endl;

  // Compute the normals
  pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> normal_estimation;
  normal_estimation.setInputCloud (cloud);

  pcl::search::KdTree<pcl::PointXYZ>::Ptr tree (new pcl::search::KdTree<pcl::PointXYZ>);
  normal_estimation.setSearchMethod (tree);

  pcl::PointCloud<pcl::Normal>::Ptr cloud_with_normals (new pcl::PointCloud<pcl::Normal>);
  normal_estimation.setRadiusSearch (3);//0.03
  normal_estimation.compute (*cloud_with_normals);

  // Setup the principal curvatures computation
  pcl::PrincipalCurvaturesEstimation<pcl::PointXYZ, pcl::Normal, pcl::PrincipalCurvatures> principal_curvatures_estimation;

  // Provide the original point cloud (without normals)
  principal_curvatures_estimation.setInputCloud (cloud);

  // Provide the point cloud with normals
  principal_curvatures_estimation.setInputNormals (cloud_with_normals);

  // Use the same KdTree from the normal estimation
  principal_curvatures_estimation.setSearchMethod (tree);
  principal_curvatures_estimation.setRadiusSearch (3.0);

  // Actually compute the principal curvatures
  pcl::PointCloud<pcl::PrincipalCurvatures>::Ptr principal_curvatures (new pcl::PointCloud<pcl::PrincipalCurvatures> ());
  principal_curvatures_estimation.compute (*principal_curvatures);

  std::cout << "output points.size (): " << principal_curvatures->points.size () << std::endl;

  // Display and retrieve the shape context descriptor vector for the 0th point.
  pcl::PrincipalCurvatures descriptor = principal_curvatures->points[0];
  std::cout << descriptor << std::endl;

  cin.get();
  return 0;
}

回复

使用道具 举报

发表于 2014-6-10 16:17:57 | 显示全部楼层
float pc1和float pc2分别代表两个主曲率的值,float principal_curvature_x、principal_curvature_y、principal_curvature_z代表一个主方向的三个分量
回复 支持 反对

使用道具 举报

发表于 2014-9-16 15:32:32 | 显示全部楼层
这个我也没弄懂呢, float pc1和float pc2 是最大和最小曲率吧? float principal_curvature_x、principal_curvature_y、principal_curvature_z 是最大曲率的方向?  应该和法线垂直吧?
回复 支持 反对

使用道具 举报

发表于 2014-9-23 15:55:49 | 显示全部楼层
我觉得这两个值不是主曲率
回复 支持 反对

使用道具 举报

发表于 2015-11-24 22:57:04 | 显示全部楼层
请问这些代码在下面网页哪里可以找到?http://docs.pointclouds.org/trun ... mation.html#details
回复 支持 反对

使用道具 举报

本版积分规则

QQ|小黑屋|点云技术相关产学研社区 ( 陕ICP备13001629号 )

GMT+8, 2024-5-6 05:35 , Processed in 7.800530 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表