记录PCL学习过程中遇到的报错
(1)class "pcl::MovingLeastSquares < pcl:PointXYZ, pcl::PointNormal>”没有成员"setPolynomialFit"
PCL版本问题,将setPolynomialFit()改为setPolynomialOrder(),在PCL官网中已查询不到setPolynomialFit()。
(2) throw pcl::IOException ("[pcl::PCDWriter::writeASCII] Input point cloud has no data!");
原因:
1、文件加载、写入时的路径问题,确保路径正确,建议使用绝对路径。
2、点云处理过程中,参数设置问题,将原始点云全部处理掉了,例如设置数值参数时要注意单位,一般情况下单位要保持与点云数据的单位相同。
// 创建直通滤波器
pcl::PassThrough<pcl::PointXYZ> pass;
pass.setInputCloud(passthrough_cloud);
pass.setFilterFieldName("z");
pass.setFilterLimits(0.0, 750.0); //这里的单位要注意是米、厘米、还是毫米
(3)EIGEN_DEVICE_FUNC inline void aligned_free(void *ptr)
运行PCL直通滤波时报此错误,上网搜索发现遇到这个错误的情况较少,使用网上搜索的方法依然报此错误。
方法如下:
VS:通过项目属性->C/C++->代码生成->启用增强指令集->选择AVX
最后将报错部分的内部代码注释,代码停止报错。
/** \internal Frees memory allocated with aligned_malloc. */
EIGEN_DEVICE_FUNC inline void aligned_free(void *ptr)
{
//#if (EIGEN_DEFAULT_ALIGN_BYTES==0)ll EIGEN_MALLOC_ALREADY_ALIGNED
//std: : free(ptr) ;
//#else
//handmade_aligned_free(ptr) ;
//#endif
}
(4)cmake .. 在树莓派官方系统编译pcl点云处理程序时报错
CMake Error: Cannot determine link language for target "point_cloud_process".
CMake Error: CMake can not determine linker language for target: point_cloud_process
原因:
CMakeLists.txt编译失败, 因为只能编译.c结尾或者是.cpp结尾的文件, 检查CMakeLists文件中,是否有不是以.c或.cpp结尾的文件。
书写CMakeLists.txt时,忘记添加如图红框的.cpp后缀
(5)
CMake Error at CMakeLists.txt:11 (add_executable):
Cannot find source file:
point_cloud_process.cpp
Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
.hpp .hxx .in .txx
CMake Error at CMakeLists.txt:11 (add_executable):
No SOURCES given to target: point_cloud_process
原因:
书写点云源码时,文件忘记添加.cpp后缀,报错已提示。