Beispiel #1
0
    def test_remove_duplicate_points(self):
        import point_cloud_utils as pcu
        import numpy as np

        # v is a nv by 3 NumPy array of vertices
        v = pcu.load_mesh_v(
            os.path.join(self.test_path, "duplicated_pcloud.ply"))

        v2, idx_v_to_v2, idx_v2_to_v = pcu.deduplicate_point_cloud(
            v, 1e-11, return_index=True)
        self.assertLess(v2.shape[0], v.shape[0])
        self.assertTrue(np.all(np.equal(v2[idx_v2_to_v], v)))
        self.assertTrue(np.all(np.equal(v[idx_v_to_v2], v2)))
Beispiel #2
0
    def test_downsample_mesh_voxel_grid(self):
        import point_cloud_utils as pcu
        import numpy as np

        # v is a nv by 3 NumPy array of vertices
        v = pcu.load_mesh_v(
            os.path.join(self.test_path, "duplicated_pcloud.ply"))

        bbmin, bbmax = v.min(0), v.max(0)
        bbsize = bbmax - bbmin

        vdown, _, _ = pcu.downsample_point_cloud_voxel_grid(bbsize / 128.0, v)

        self.assertLess(vdown.shape[0], v.shape[0])