使用 pcl::VoxelGrid报错In template: type ‘detail::CopyPointHelper<PointXYZ, PointXYZ>‘ does not provide

使用 pcl::VoxelGrid报错In template: type ‘detail::CopyPointHelper<PointXYZ, PointXYZ>‘ does not provide

   // Voxel Grid Downsampling
    pcl::VoxelGrid<pcl::PointXYZ> sor;
    sor.setInputCloud(cloud_filtered);
    //三个参数分别代表x、y、z方向上的体素尺寸,都被设置为0.025米。这意味着在每个维度上,每0.025米的距离内,所有点都将被合并到一个体素中,从而选择一个代表点或者进行某种聚合操作(如平均值),以此来减少点云的密度
    sor.setLeafSize(0.025f, 0.025f, 0.025f); // Set voxel size to 0.025 meters
    pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_downsampled(new pcl::PointCloud<pcl::PointXYZ>);
   // sor.filter(*cloud_downsampled);
    sor.filter(*cloud_downsampled);

报错:

In template: type 'detail::CopyPointHelper<PointXYZ, PointXYZ>' does not provide a call operator error occurred here in instantiation of function template specialization 'pcl::copyPoint<pcl::PointXYZ, pcl::PointXYZ>' requested here in instantiation of function template specialization 'pcl::copyPointCloud<pcl::PointXYZ, pcl::PointXYZ>' requested here in instantiation of member function 'pcl::Filterpcl::PointXYZ::filter' requested here

sr/include/pcl-1.10/pcl/common/impl/io.hpp: In function ‘int pcl::getFieldIndex(const string&, const std::vector<pcl::PCLPointField>&)’:
/usr/include/pcl-1.10/pcl/common/impl/io.hpp:73:27: error: use of ‘auto’ in lambda parameter declaration only available with ‘-std=c++14’ or ‘-std=gnu++14’
   73 |       [&field_name](const auto& field) { return field.name == field_name; });
      |                           ^~~~
/usr/include/pcl-1.10/pcl/common/impl/io.hpp: In lambda function:
/usr/include/pcl-1.10/pcl/common/impl/io.hpp:73:55: error: request for member ‘name’ in ‘field’, which is of non-class type ‘const int’
   73 |       [&field_name](const auto& field) { return field.name == field_name; });
      |                                                       ^~~~
/usr/include/pcl-1.10/pcl/common/impl/io.hpp: In function ‘void pcl::copyPointCloud(const pcl::PointCloud<PointT>&, const std::vector<pcl::PointIndices>&, pcl::PointCloud<PointOutT>&)’:
/usr/include/pcl-1.10/pcl/common/impl/io.hpp:272:16: error: use of ‘auto’ in lambda parameter declaration only available with ‘-std=c++14’ or ‘-std=gnu++14’
  272 |       [](const auto& acc, const auto& index) { return index.indices.size() + acc; });
      |                ^~~~
/usr/include/pcl-1.10/pcl/common/impl/io.hpp:272:33: error: use of ‘auto’ in lambda parameter declaration only available with ‘-std=c++14’ or ‘-std=gnu++14’
  272 |       [](const auto& acc, const auto& index) { return index.indices.size() + acc; });
      |                                 ^~~~
/usr/include/pcl-1.10/pcl/common/impl/io.hpp: In lambda function:
/usr/include/pcl-1.10/pcl/common/impl/io.hpp:272:61: error: request for member ‘indices’ in ‘index’, which is of non-class type ‘const int’
  272 |       [](const auto& acc, const auto& index) { return index.indices.size() + acc; });

 

解决:

原因 pcl版本过高

cmakeList.txt 中使用 C++14

if( CMAKE_BUILD_TYPE STREQUAL "Release")
  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -std=c++14 -fPIC")
else()
  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -std=c++14 -fPIC")
endif()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

_无往而不胜_

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

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

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

打赏作者

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

抵扣说明:

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

余额充值