當前位置: 首頁>>代碼示例>>Python>>正文


Python pcl.SACMODEL_PLANE屬性代碼示例

本文整理匯總了Python中pcl.SACMODEL_PLANE屬性的典型用法代碼示例。如果您正苦於以下問題:Python pcl.SACMODEL_PLANE屬性的具體用法?Python pcl.SACMODEL_PLANE怎麽用?Python pcl.SACMODEL_PLANE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在pcl的用法示例。


在下文中一共展示了pcl.SACMODEL_PLANE屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: exact_planar_normals

# 需要導入模塊: import pcl [as 別名]
# 或者: from pcl import SACMODEL_PLANE [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 SACMODEL_PLANE [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 SACMODEL_PLANE [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 SACMODEL_PLANE [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.SACMODEL_PLANE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。