def test_ply_to_ply_ascii(temp_file): mesh = pcl.PolygonMesh() pcl.io.loadPLYFile(test_data("messy_mesh_ascii.ply"), mesh) pcl.io.savePLYFile(temp_file, mesh, precision=4) mesh2 = pcl.PolygonMesh() pcl.io.loadPLYFile(temp_file, mesh2) assert len(mesh.polygons) == len(mesh2.polygons) assert mesh.cloud.width == mesh2.cloud.width assert mesh.cloud.height == mesh2.cloud.height
def test_greedy_projection_triangulation_simple(): pc = pclpy.read(test_data("street_thinned.las"), "PointXYZRGBA") cloud_with_normals = pcl.PointCloud.PointNormal() pc.compute_normals(radius=0.15, output_cloud=cloud_with_normals, num_threads=8) ms = pcl.surface.GreedyProjectionTriangulation.PointNormal() pi = 3.141592 triangles = pcl.PolygonMesh() ms.setSearchRadius(0.2) ms.setMu(2.5) ms.setMaximumNearestNeighbors(100) ms.setMaximumSurfaceAngle(pi / 4) ms.setMinimumAngle(pi / 18) ms.setMaximumAngle(2 * pi / 3) ms.setNormalConsistency(True) ms.setInputCloud(cloud_with_normals) tree2 = pcl.search.KdTree.PointNormal() ms.setSearchMethod(tree2) ms.reconstruct(triangles) assert 125 < len(triangles.polygons ) < 250 # depending on the build, this number can vary...