当前位置: 首页>>代码示例>>Python>>正文


Python pcl.SAC_RANSAC属性代码示例

本文整理汇总了Python中pcl.SAC_RANSAC属性的典型用法代码示例。如果您正苦于以下问题:Python pcl.SAC_RANSAC属性的具体用法?Python pcl.SAC_RANSAC怎么用?Python pcl.SAC_RANSAC使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在pcl的用法示例。


在下文中一共展示了pcl.SAC_RANSAC属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: exact_planar_normals

# 需要导入模块: import pcl [as 别名]
# 或者: from pcl import SAC_RANSAC [as 别名]
def exact_planar_normals(self):
        import pcl
        if self.__csv_path == "":
            print "csv file path is not spcified!"
        raw_data = np.genfromtxt(self.__csv_path, delimiter=",", skip_header=1)
        points_xyz_arr = np.array(raw_data[:, :3], dtype=np.float32)
        points_cloud = pcl.PointCloud()
        points_cloud.from_array(points_xyz_arr)
        for i in xrange(self.__palnar_normal_num):
            seg = points_cloud.make_segmenter()
            seg.set_optimize_coefficients(True)
            seg.set_model_type(pcl.SACMODEL_PLANE)
            seg.set_method_type(pcl.SAC_RANSAC)
            seg.set_distance_threshold(self.ransac_distance_threshold)
            indices, model = seg.segment()
            if len(indices) < self.__plane_detection_points_thre:
                break
            # model turns Hessian Normal Form of a plane in 3D
            # http://mathworld.wolfram.com/HessianNormalForm.html
            self.__normals_list.append(model)
            tmp = points_cloud.to_array()
            tmp = np.delete(tmp, indices, 0)
            points_cloud.from_array(tmp)
            # show_xyzrgb_points_vtk(tmp) 
开发者ID:mfxox,项目名称:ILCC,代码行数:26,代码来源:pcd_corners_est.py

示例2: get_plane_model

# 需要导入模块: import pcl [as 别名]
# 或者: from pcl import SAC_RANSAC [as 别名]
def get_plane_model(arr):
    import pcl
    ransac_distance_threshold = 0.05
    point_cloud = pcl.PointCloud(arr.astype(np.float32))
    seg = point_cloud.make_segmenter_normals(ksearch=50)

    seg.set_model_type(pcl.SACMODEL_PLANE)
    seg.set_method_type(pcl.SAC_RANSAC)
    seg.set_max_iterations(10000)
    seg.set_distance_threshold(ransac_distance_threshold)
    indices, model = seg.segment()
    print "percentage of points in plane model: ", np.float32(len(indices)) / arr.shape[0]
    return model


# project a point to an estimated plane 
开发者ID:mfxox,项目名称:ILCC,代码行数:18,代码来源:pcd_corners_est.py

示例3: do_ransac_plane_segmentation

# 需要导入模块: import pcl [as 别名]
# 或者: from pcl import SAC_RANSAC [as 别名]
def do_ransac_plane_segmentation(point_cloud, max_distance = 0.01):

  segmenter = point_cloud.make_segmenter()

  segmenter.set_model_type(pcl.SACMODEL_PLANE)
  segmenter.set_method_type(pcl.SAC_RANSAC)
  segmenter.set_distance_threshold(max_distance)

  #obtain inlier indices and model coefficients
  inlier_indices, coefficients = segmenter.segment()

  inliers = point_cloud.extract(inlier_indices, negative = False)
  outliers = point_cloud.extract(inlier_indices, negative = True)

  return inliers, outliers



##################################################################################
# This pipeline separates the objects in the table from the given scene

# Load the point cloud in memory 
开发者ID:mithi,项目名称:point-cloud-filter,代码行数:24,代码来源:filter_objects.py

示例4: pc_segmentation

# 需要导入模块: import pcl [as 别名]
# 或者: from pcl import SAC_RANSAC [as 别名]
def pc_segmentation(pc):
    # vg = pc.make_voxel_grid_filter()
    # vg.set_leaf_size(0.01, 0.01, 0.01)
    # cloud_filtered = vg.filter()
    # tree = cloud_filtered.make_kdtree()

    # seg = pc.make_segmenter()
    # seg.set_optimize_coefficients(True)
    # seg.set_model_type(pcl.SACMODEL_PLANE)
    # seg.set_method_type(pcl.SAC_RANSAC)
    # seg.set_distance_threshold(0.001)
    # cluster_indices, coefficients = seg.segment()
    # inds = np.ones((pc.width,1))
    # inds[cluster_indices] = 0
    # return inds

    # segment = pcl.ConditionalEuclideanClustering()
    # cluster_indices = segment.Extract()

    # segment = cloud_filtered.make_RegionGrowing(ksearch=50)
    # segment.set_MinClusterSize(100)
    # segment.set_MaxClusterSize(25000)
    # segment.set_NumberOfNeighbours(5)
    # segment.set_SmoothnessThreshold(0.2)
    # segment.set_CurvatureThreshold(0.05)
    # segment.set_SearchMethod(tree)
    # cluster_indices = segment.Extract()

    cloud_filtered = pc
    segment = cloud_filtered.make_EuclideanClusterExtraction()
    segment.set_ClusterTolerance(0.5)
    segment.set_MinClusterSize(30)
    segment.set_MaxClusterSize(10000)
    # segment.set_SearchMethod(tree)
    cluster_indices = segment.Extract()

    cloud_cluster = pcl.PointCloud()
    # import pdb; pdb.set_trace()
    # print('cluster_indices : ' + str(len(cluster_indices)) + " count.")
    cloud_clusters = []
    for j, indices in enumerate(cluster_indices):
        # print('indices = ' + str(len(indices)))
        points = np.zeros((len(indices), 3), dtype=np.float32)

        for i, indice in enumerate(indices):
            points[i][0] = cloud_filtered[indice][0]
            points[i][1] = cloud_filtered[indice][1]
            points[i][2] = cloud_filtered[indice][2]
        # print(points.shape)
        cloud_clusters.append(points)
        # cloud_clusters[j].from_array(points)
    return cloud_clusters 
开发者ID:alliecc,项目名称:argoverse_baselinetracker,代码行数:54,代码来源:tools_pcl.py


注:本文中的pcl.SAC_RANSAC属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。