Python pcl没有属性from_array

时间:2018-07-05 06:12:32

标签: python point-cloud-library

我试图在此页面上运行示例: https://github.com/strawlab/python-pcl/blob/master/examples/example.py 我在第49行收到错误:AttributeError: type object 'PointCloud' has no attribute 'from_array'。而且,我无法导入一些模块,例如pcl.pcl_visualizationpcl.PointCloud_PointXYZRGB()。有人知道我该如何解决这些问题?

谢谢

1 个答案:

答案 0 :(得分:1)

您应该确保您不是偶然运行PyPCL。这是导入pcl可以映射到的PCL到Python的替代绑定。一种检查方法是运行以下代码段:

class_names = dict([(name, cls) for name, cls in pcl.__dict__.items() if isinstance(cls, type)])
for name, cls in class_names.items():
    print(name)

这将为您提供模块中的类的列表。如果有两个(PointCloud,Quaternion),则可能已经安装了PyPCL,应该卸载该PyPCL。返回的python-pcl中的类列表应如下所示:

PointCloud
PointCloud_PointXYZI
PointCloud_PointXYZRGB
PointCloud_PointXYZRGBA
Vertices
PointCloud_PointWithViewpoint
PointCloud_Normal
PointCloud_PointNormal
KdTree
RangeImages
SampleConsensusModel
SampleConsensusModelPlane
SampleConsensusModelSphere
SampleConsensusModelCylinder
SampleConsensusModelLine
SampleConsensusModelRegistration
SampleConsensusModelStick
Segmentation
Segmentation_PointXYZI
Segmentation_PointXYZRGB
Segmentation_PointXYZRGBA
SegmentationNormal
Segmentation_PointXYZI_Normal
Segmentation_PointXYZRGB_Normal
Segmentation_PointXYZRGBA_Normal
EuclideanClusterExtraction
RegionGrowing
StatisticalOutlierRemovalFilter
StatisticalOutlierRemovalFilter_PointXYZI
StatisticalOutlierRemovalFilter_PointXYZRGB
StatisticalOutlierRemovalFilter_PointXYZRGBA
VoxelGridFilter
VoxelGridFilter_PointXYZI
VoxelGridFilter_PointXYZRGB
VoxelGridFilter_PointXYZRGBA
PassThroughFilter
PassThroughFilter_PointXYZI
PassThroughFilter_PointXYZRGB
PassThroughFilter_PointXYZRGBA
ApproximateVoxelGrid
ApproximateVoxelGrid_PointXYZI
ApproximateVoxelGrid_PointXYZRGB
ApproximateVoxelGrid_PointXYZRGBA
KdTreeFLANN
KdTreeFLANN_PointXYZI
KdTreeFLANN_PointXYZRGB
KdTreeFLANN_PointXYZRGBA
OctreePointCloud
OctreePointCloud_PointXYZI
OctreePointCloud_PointXYZRGB
OctreePointCloud_PointXYZRGBA
OctreePointCloud2Buf
OctreePointCloud2Buf_PointXYZI
OctreePointCloud2Buf_PointXYZRGB
OctreePointCloud2Buf_PointXYZRGBA
OctreePointCloudSearch
OctreePointCloudSearch_PointXYZI
OctreePointCloudSearch_PointXYZRGB
OctreePointCloudSearch_PointXYZRGBA
OctreePointCloudChangeDetector
OctreePointCloudChangeDetector_PointXYZI
OctreePointCloudChangeDetector_PointXYZRGB
OctreePointCloudChangeDetector_PointXYZRGBA
CropHull
CropBox
ProjectInliers
RadiusOutlierRemoval
ConditionAnd
ConditionalRemoval
ConcaveHull
ConcaveHull_PointXYZI
ConcaveHull_PointXYZRGB
ConcaveHull_PointXYZRGBA
MovingLeastSquares
MovingLeastSquares_PointXYZRGB
MovingLeastSquares_PointXYZRGBA
GeneralizedIterativeClosestPoint
IterativeClosestPoint
IterativeClosestPointNonLinear
RandomSampleConsensus
NormalEstimation
VFHEstimation
IntegralImageNormalEstimation
MomentOfInertiaEstimation
HarrisKeypoint3D
NormalDistributionsTransform
Sequence

或者,如果您在虚拟环境中,则可以运行pipenv graph查找此问题。或者:

pip list