【吐槽】——《点云库PCL从入门到精通》一书

目录

槽点一:生搬硬套,照抄官方教程

槽点二:书中代码未经验证运行

槽点三:使用已失效或者不存在的属性

槽点四:翻译失准,产生歧义


槽点一:生搬硬套,照抄官方教程

这本书的大部分示例代码都是照抄官方教程:Introduction — Point Cloud Library 0.0 documentation

随便摘抄一段原文:链接【How to use a KdTree to search — Point Cloud Library 0.0 documentation

A k-d tree, or k-dimensional tree, is a data structure used in computer science for organizing some number of points in a space with k dimensions. It is a binary search tree with other constraints imposed on it. K-d trees are very useful for range and nearest neighbor searches. For our purposes we will generally only be dealing with point clouds in three dimensions, so all of our k-d trees will be three-dimensional. Each level of a k-d tree splits all children along a specific dimension, using a hyperplane that is perpendicular to the corresponding axis. At the root of the tree all children will be split based on the first dimension (i.e. if the first dimension coordinate is less than the root it will be in the left-sub tree and if it is greater than the root it will obviously be in the right sub-tree). Each level down in the tree divides on the next dimension, returning to the first dimension once all others have been exhausted. The most efficient way to build a k-d tree is to use a partition method like the one Quick Sort uses to place the median point at the root and everything with a smaller one-dimensional value to the left and larger to the right. You then repeat this procedure on both the left and right sub-trees until the last trees that you are to partition are only composed of one element.

 机器翻译:

 《点云库PCL从入门到精通》书中翻译:

其中最大的槽点在于对Quick Sort的翻译:快速分类, 这里的Quick Sort应该是快速排序,就算机翻也是快速排序。

槽点二:书中代码未经验证运行

在第五章-可视化中,P116中的关于CloudViewer类的测试代码,无论是书中,还是其给出的源代码中,点云数据类型格式都是照抄官网教程上的源码:XYZRGBA,但事实上,此书提供的pcd文件:maize.pcd是XYZ格式。如果直接按照书中或者源代码中程序运行,将会产生错误:

 应改成:

	//加载点云文件到点云对象
	pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
	pcl::io::loadPCDFile("maize.pcd", *cloud);

可见书中代码尚未运行验证,读者应谨慎阅读此书!

槽点三:使用已失效或者不存在的属性

在书中第五章-可视化中,书中给出的源码点云库PCL从入门到精通\第五章\2 range_image_visualization\source\range_image_visualization.cpp中关于setViewerPose函数的实现:

void 
setViewerPose (pcl::visualization::PCLVisualizer& viewer, const Eigen::Affine3f& viewer_pose)
{
  Eigen::Vector3f pos_vector = viewer_pose * Eigen::Vector3f(0, 0, 0);
  Eigen::Vector3f look_at_vector = viewer_pose.rotation () * Eigen::Vector3f(0, 0, 1) + pos_vector;
  Eigen::Vector3f up_vector = viewer_pose.rotation () * Eigen::Vector3f(0, -1, 0);
  viewer.camera_.pos[0] = pos_vector[0];
  viewer.camera_.pos[1] = pos_vector[1];
  viewer.camera_.pos[2] = pos_vector[2];
  viewer.camera_.focal[0] = look_at_vector[0];
  viewer.camera_.focal[1] = look_at_vector[1];
  viewer.camera_.focal[2] = look_at_vector[2];
  viewer.camera_.view[0] = up_vector[0];
  viewer.camera_.view[1] = up_vector[1];
  viewer.camera_.view[2] = up_vector[2];
  viewer.updateCamera();
}

其中使用了在PCL1.8.1中已经不存在的属性camera_,但是此本书在开头明明说是以PCL1.8.1为教学版本。

官方教程中:关于此函数的实现:

void 
setViewerPose (pcl::visualization::PCLVisualizer& viewer, const Eigen::Affine3f& viewer_pose)
{
  Eigen::Vector3f pos_vector = viewer_pose * Eigen::Vector3f(0, 0, 0);
  Eigen::Vector3f look_at_vector = viewer_pose.rotation () * Eigen::Vector3f(0, 0, 1) + pos_vector;
  Eigen::Vector3f up_vector = viewer_pose.rotation () * Eigen::Vector3f(0, -1, 0);
  viewer.setCameraPosition (pos_vector[0], pos_vector[1], pos_vector[2],
                            look_at_vector[0], look_at_vector[1], look_at_vector[2],
                            up_vector[0], up_vector[1], up_vector[2]);
}

槽点四:翻译失准,产生歧义

第五章,P121中:

 官网的原文:PCLVisualizer — Point Cloud Library 0.0 documentation

 这两句明显是翻译错了。

官网原文中说的是下一行(next line),指的是:

viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "sample cloud");

 而此书翻译成:下面的命令行(next line),会让读者误以为是:

viewer->addCoordinateSystem(1.0);

 此外,关于 can be used to place the axes at any point in the world的翻译,明明说的是这个函数可以传入坐标,指定坐标轴的位置。

没想到,直接翻译官方教程也能出书,真是刷新我的认知。

<think>好的,我现在需要帮助用户找到学习PCL点云库的代码教程和相关资源。首先,用户提到了《点云库PCL入门精通》这本,并且引用了相关的GitHub源代码链接,所以应该优先推荐这本及其配套代码。 接下来,用户可能需要具体的代码示例,除了上的内容,官方教程和文档也是重要的资源。我需要确认PCL的官方文档和教程链接是否仍然有效,并且是否适合入门。另外,用户可能对实践项目感兴趣,比如点云滤波、配准、分割等,这些内容在中和官方教程中应该都有涉及。 然后,用户提到的引用3中提到了第十章关于特征描述与提取的内容,以及个外部链接。我需要检查这个链接是否相关,并建议用户参考官方教程中的3D物体识别部分,以补充本知识。 还要考虑用户的不同背景,比如本科生、硕士生或者工程人员,可能需要不同的学习路径。例如,初学者应该从基础开始,而有定经验的人可能需要更高级的应用和优化方法。 最后,生成相关问题时,需要覆盖学习路径、籍与代码的关系、实际项目应用、常见问题解决以及官方资源推荐等方面,确保用户能全面了解如何入门精通PCL库。</think>### PCL点云库学习路径及代码教程 根据引用[1][2][3],学习PCL点云库可分为以下阶段: #### 、基础学习阶段 1. **环境搭建**: - 安装PCL 1.11+版本(建议通过vcpkg或源码编译) - 配置Visual Studio或Qt Creator开发环境 - 验证安装:运行`pcl_viewer`查看点云文件(如.pcd) 2. **核心模块入门**: ```cpp // 基础点云读取示例 #include <pcl/io/pcd_io.h> #include <pcl/point_types.h> int main() { pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>); if (pcl::io::loadPCDFile<pcl::PointXYZ>("test.pcd", *cloud) == -1) { PCL_ERROR("Couldn't read file\n"); return -1; } std::cout << "Loaded " << cloud->points.size() << " points" << std::endl; return 0; } ``` #### 二、进阶学习资源 1. **推荐教材**: - 《点云库PCL入门精通》配套代码库[^2]: ```bash git clone https://github.com/LiveStockShapeAnalysis/Point-Cloud-Processing-example ``` - 包含各章节完整工程文件(滤波/分割/配准等) 2. **官方教程**: - 特征提取与3D物体识别教程[^3]: $$ \text{FeatureDescriptor} = \frac{1}{N}\sum_{i=1}^{N} \Phi(p_i, p_j) $$ 其中$\Phi$表示特征计算函数,$p_i$为查询点,$p_j$为邻域点 #### 三、实践项目建议 1. **初级项目**: - 点云滤波(直通滤波/体素滤波) - 平面分割(RANSAC算法) - ICP点云配准 2. **中级项目**: - 三维物体识别(使用ESF/VFH等特征描述子) - 点云曲面重建(泊松重建) #### 四、调试技巧 1. 使用`pcl::console::setVerbosityLevel()`提升调试输出 2. 通过CloudCompare可视化中间处理结果 3. 对NaN值进行过滤: ```cpp pcl::PassThrough<pcl::PointXYZ> pass; pass.setFilterLimits(std::numeric_limits<float>::lowest(), std::numeric_limits<float>::max()); ```
评论 9
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

SOC罗三炮

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

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

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

打赏作者

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

抵扣说明:

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

余额充值