在 Python 中使用点云库

Using Point Cloud Library in Python

本文关键字:Python      更新时间:2023-10-16

您好,我正在尝试在 Python 中使用点云库,因为我是这个C++库和 Python 的新手,我正在按照 http://strawlab.github.io/python-pcl/#pcl.PointCloud 教程进行操作

但是,每当我尝试导入 pcl 并定义模块(例如pcl.PointCloud())时,都会收到以下错误;

AttributeError: 'module' object has no attribute 'PointCloud'

我已使用 sys.path.append 指向已安装 PCL 文件的正确目录,因为它们不在站点包中。它在上面的链接上说C++代码已经有了 Python 绑定,但我不确定我尝试在 Python 中调用哪些文件。有谁知道如何克服此错误并加载这些模块?

谢谢安德鲁

试试这个,

sudo add-apt-repository ppa:sweptlaser/python3-pcl
sudo apt update
sudo apt install python3-pcl

完成此操作后,您应该能够运行:

python3 -c 'import pcl'

它将返回没有错误(与ModuleNotFoundError: No module named 'pcl'相反)。

测试于:

优麒麟 18.04 LTS

蟒蛇 3.6.9

参考: https://askubuntu.com/a/1170661/922137

尝试跳过括号:

from pcl import PointCloud

然后创建一个 PointCloud 实例,例如p

p = PointCloud()

希望对您有所帮助!

根据此页面,看起来您需要PCL 1.5.1和cython 0.16: http://strawlab.github.io/python-pcl/

""

https://blog.pollithy.com/python/numpy/pointcloud/tutorial-pypcd""

python3.6 -m pip install --user git+https://github.com/DanielPollithy/pypcd.git