从PCL中的另一个点云中删除一个点云中的点? [英] Remove points in one point cloud from another in PCL?
问题描述
假设我有两个点云 A 和 B.我想做以下操作:C=A-B 其中 C 是操作的输出云.我知道 PCL 具有用于连接两个点云的+"操作,例如:
Let's say I have two point clouds A and B. I want to do the following operation: C=A-B where C is the output cloud of the operation. I'm aware PCL has the '+' operation for concatenating two point clouds like:
pcl::PointCloud<pcl::PointXYZ> A;
pcl::PointCloud<pcl::PointXYZ> B; //assume A and B have points in them
pcl::PointCloud<pcl::PointXYZ> C = A+B;
但是,我认为没有-"运算符可以将一个点云中的点从另一个点云中删除.
However I don't think there's a '-' operator for removing points in one point cloud from another.
我可以为 A 和 B 创建哈希映射吗?输出 C 只有在哈希图中出现一次的点.或者有没有更好的方法来做到这一点?
Can I create hash map for A and B? The output C has only points which appear once in the hash map. Or is there a better way to do this?
推荐答案
如果云 B
是云 A
的子集(即点具有相同的位置,但它们只是一个子集)并且您知道它们的索引,然后您可以简单地过滤索引.
If the cloud B
is a subset of the cloud A
(i.e. the points have the same locations, but they are just a subset) and you know their indices, then you can simply filter the indices.
在更一般的情况下,A
和 B
中的点相似但不相同,您需要更有趣一些.对于B
中的每个点,使用半径搜索或kd-search 在A
中寻找最近的点,然后从A
中删除已识别的点.
In the more general case, for which the points in A
and B
are similar but not the same, you need to get a bit fancier. For each point in B
, look for the closest point in A
using radius search or kd-search, then remove the identified points from A
.
这篇关于从PCL中的另一个点云中删除一个点云中的点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!