Exemplo n.º 1
0
def test_difference_of_normals_estimation_simple():
    pc = pclpy.read(test_data("street.las"), "PointXYZRGBA")

    pc_subsampled = pclpy.octree_voxel_downsample(pc, 0.05)
    subsampled = pclpy.octree_voxel_downsample(pc_subsampled, 0.4)

    normals_large = pcl.PointCloud.PointNormal()
    pc_subsampled.compute_normals(radius=4,
                                  output_cloud=normals_large,
                                  num_threads=8,
                                  search_surface=subsampled)
    normals_small = pcl.PointCloud.PointNormal()
    pc_subsampled.compute_normals(radius=0.10,
                                  output_cloud=normals_small,
                                  num_threads=8)

    don = pcl.features.DifferenceOfNormalsEstimation.PointXYZRGBA_PointNormal_PointNormal(
    )
    don.setInputCloud(pc_subsampled)
    don.setNormalScaleLarge(normals_large)
    don.setNormalScaleSmall(normals_small)
    output = pcl.PointCloud.PointNormal(pc_subsampled.xyz)
    don.computeFeature(output)
    indices = np.argwhere(output.curvature > 0.4)
    output2 = pcl.PointCloud.PointNormal(output, pcl.vectors.Int(indices))

    clusters = pclpy.extract_clusters(pcl.PointCloud.PointXYZ(output2.xyz),
                                      0.1, 50, 100000)
    assert len(clusters) == 32
Exemplo n.º 2
0
def test_fpfh_simple():
    pc = pclpy.read(test_data("street.las"), "PointXYZ")

    pc = pclpy.octree_voxel_downsample(pc, 0.25)
    normals = pc.compute_normals(radius=0.5, num_threads=8)

    fpfh = pcl.features.FPFHEstimation.PointXYZ_Normal_FPFHSignature33()
    fpfh.setInputCloud(pc)
    fpfh.setInputNormals(normals)
    fpfh.setRadiusSearch(0.5)

    fpfhs = pcl.PointCloud.FPFHSignature33()
    fpfh.compute(fpfhs)

    expected_bottom_right = np.array([
        [6.2739134, 2.528063, 2.078603],
        [1.3269598, 1.0290794, 0.27428713],
        [0., 0., 0.],
    ])

    assert np.allclose(fpfhs.histogram[-3:, -3:], expected_bottom_right)
Exemplo n.º 3
0
def test_voxel_centroid_api_rgba():
    pc = pclpy.read(test_data("street_thinned.las"), "PointXYZRGBA")
    output = pclpy.octree_voxel_downsample(pc, resolution=0.3, centroids=False)
    assert output.size() == 3148