python - python-pcl Segmentation_PointXYZI'对象没有属性'set_MaxIterations'
问题描述
我是 C++ 新手。因此,我正在尝试使用 python-pcl,但出现错误:
AttributeError: 'pcl._pcl.Segmentation_PointXYZI' object has no attribute 'set_MaxIterations'
我正在尝试为平面模型创建分割对象并使用 PointXYZI 类型设置参数。我必须使用 PointXYZI。我怎么解决这个问题?
我的代码:
def cluster_extraction(self,data):
print("Type1: ", type(data))
cloud_filtered = self.downsampling(data,0.3)
print("Type2: ", type(cloud_filtered))
seg = cloud_filtered.make_segmenter()
seg.set_optimize_coefficients (True)
seg.set_model_type (pcl.SACMODEL_PLANE)
seg.set_method_type (pcl.SAC_RANSAC)
seg.set_MaxIterations (100)
seg.set_distance_threshold (0.02)
输出:
('Type1: ', <type 'pcl._pcl.PointCloud_PointXYZI'>)
('Type2: ', <type 'pcl._pcl.PointCloud_PointXYZI'>)
[ERROR] [1596926303.890116]: bad callback: <bound method sub_pub_node.callback of <__main__.sub_pub_node object at 0x7f154be44ad0>>
Traceback (most recent call last):
File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/topics.py", line 750, in _invoke_callback
cb(msg)
File "node.py", line 154, in callback
downsampled_data = self.processing(pcl2_data)
File "node.py", line 103, in processing
processing.cluster_extraction(pcl2_data)
File "node.py", line 43, in cluster_extraction
seg.set_MaxIterations (100)
AttributeError: 'pcl._pcl.Segmentation_PointXYZI' object has no attribute 'set_MaxIterations'
解决方案
根据strawlab的官方示例,正确的调用是:
seg.set_max_iterations(100)
推荐阅读
- php - .htaccess - 重写 URL 并显示来自其他来源的内容
- wordpress - 如何从我的网站中删除奇怪的链接
- java - 使用arch库中的pagedList进行网络分页
- openstack - Openstack Pike 安装 Neutron Compute 找不到错误
- react-native - 无法运行 - 显示控制台错误“此版本的弹出菜单需要 RN 0.55+。检查我们的兼容性表。”
- javascript - 离子范围滑块不适用于小范围值角度 4
- javascript - 无法使用 moment.js 格式化
- python - 创建一个输出字典的张量流数据集
- java - 发送推送跨平台,集线器 Azure
- java - 如何在 Kotlin 中检查数组类型(不是泛型类型)