PCL-FPFH描述符

PCL-描述子-FPFH

FPFH描述子建立

1.原始点云

变量声明,为了对场景和模型做匹配,设计了1,2两个变量。

	pcl::PointCloud<PointType>				cloud1, cloud2;
	pcl::PointCloud<NormalType>				cloud1_normals, cloud2_normals;
	pcl::PointCloud<PointType>				cloud1_keypoints, cloud2_keypoints;
	pcl::PointCloud<pcl::FPFHSignature33>   cloud1_fpfh, cloud2_fpfh;
2.提取关键点

体素和均匀采样速度较快

	void compute_filters_voxel_grid(float leaf_size)
	{
		pcl::VoxelGrid<PointType> voxel_grid;
		voxel_grid.setLeafSize(leaf_size, leaf_size, leaf_size);

		voxel_grid.setInputCloud(cloud1.makeShared());
		voxel_grid.filter(cloud1_keypoints);

		voxel_grid.setInputCloud(cloud2.makeShared());
		voxel_grid.filter(cloud2_keypoints);
	}
	void compute_filters_uniform_sample(float leaf_size)
	{
		pcl::UniformSampling<PointType> filter;
		filter.setRadiusSearch(leaf_size);

		filter.setInputCloud(cloud1.makeShared());
		filter.filter(cloud1_keypoints);

		filter.setInputCloud(cloud2.makeShared());
		filter.filter(cloud2_keypoints);
	}
3.法线建立

关键点提取法线

	template <typename T>
	void compute_normals(float radius, T cloud1, T cloud2)
	{
		// Estimate the normals.
		pcl::NormalEstimationOMP<pcl::PointXYZ, pcl::Normal> normalEstimation;
		normalEstimation.setRadiusSearch(radius);
		normalEstimation.setNumberOfThreads(12);
		pcl::search::KdTree<pcl::PointXYZ>::Ptr kdtree(new pcl::search::KdTree<pcl::PointXYZ>);
		normalEstimation.setSearchMethod(kdtree);

		normalEstimation.setInputCloud(cloud1.makeShared());
		normalEstimation.compute(cloud1_normals);

		normalEstimation.setInputCloud(cloud2.makeShared());
		normalEstimation.compute(cloud2_normals);
	}
4.FPFH描述子建立
	void calculate_FPFH(float radius)
	{
		pcl::FPFHEstimationOMP<pcl::PointXYZ, pcl::Normal, pcl::FPFHSignature33> fpfh;
		fpfh.setRadiusSearch(radius);
		fpfh.setNumberOfThreads(12);

		pcl::search::KdTree<pcl::PointXYZ>::Ptr kdtree(new pcl::search::KdTree<pcl::PointXYZ>);
		fpfh.setSearchMethod(kdtree);

		fpfh.setInputCloud(cloud1_keypoints.makeShared());
		//fpfh.setSearchSurface(cloud1.makeShared());
		fpfh.setInputNormals(cloud1_normals.makeShared());
		fpfh.compute(cloud1_fpfh);

		fpfh.setInputCloud(cloud2_keypoints.makeShared());
		//fpfh.setSearchSurface(cloud2.makeShared());
		fpfh.setInputNormals(cloud2_normals.makeShared());
		fpfh.compute(cloud2_fpfh);
	}

如上是FPFH描述子核心代码,如需其他代码,可留言。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

DoubleYuanL

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值