gpt4 book ai didi

c++ - pcl::VoxelGrid 不适用于 pcl::PointCloud

转载 作者:行者123 更新时间:2023-11-28 04:50:37 25 4
gpt4 key购买 nike

我现在正在使用一些 Laserscans,并希望在 C++ 中对 PointClouds 进行下采样。我在构建过程中遇到了一个奇怪的问题,我认为在我尝试编译代码时的库链接过程中。这里是问题似乎来自的最小代码片段:

pcl::PointCloud<pcl::PointXYZ>::Ptr point_cloud_last (new pcl::PointCloud<pcl::PointXYZ>);
pcl::PointCloud<pcl::PointXYZ>::Ptr downsampled (new pcl::PointCloud<pcl::PointXYZ>);
point_cloud_last = _last_pt_cl.makeShared();
pcl::VoxelGrid<pcl::PointXYZ> sor;
sor.setInputCloud (point_cloud_last);
sor.setLeafSize (0.05f, 0.05f, 0.05f);
sor.filter (*downsampled);

当我尝试编译时出现以下错误:

undefined reference to `pcl::VoxelGrid<pcl::PointXYZ>::applyFilter(pcl::PointCloud<pcl::PointXYZ>&)'

我发现,这可能是因为 CMakeList 中缺少组件。在这里我的 CMakeList 被剪断了:

find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
cv_bridge
tf
message_generation
)
find_package(OpenCV REQUIRED)
find_package(PCL 1.7 REQUIRED

如果有人知道,有什么问题,请告诉我。我正在使用 Eclipse、PCL 1.7、ros indigo。

最佳答案

似乎有点晚了,但我也遇到了这个问题。 target_link_libraries-lpcl_filters 在我的案例中有所帮助。

关于c++ - pcl::VoxelGrid<PointXYZ> 不适用于 pcl::PointCloud<PointXYZ>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48292715/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com