|
5 | 5 |
|
6 | 6 |
|
7 | 7 | class Open3dSurface(SurfaceStrategy):
|
8 |
| - |
9 | 8 | parameters = {
|
10 |
| - 'estimate_normals': [ |
11 |
| - { |
12 |
| - 'name': 'fast_normal_computation', |
13 |
| - 'description': 'Fast normal estimation', |
14 |
| - 'value': True |
15 |
| - }, |
16 |
| - { |
17 |
| - 'name': 'normals', |
18 |
| - 'description': 'Points normals', |
19 |
| - 'value': (1, 3) |
20 |
| - } |
21 |
| - ], |
22 |
| - 'orient_normals_consistent_tangent_plane': [ |
23 |
| - { |
24 |
| - 'name': 'k', |
25 |
| - 'description': 'Nearest neighbors', |
26 |
| - 'value': 100 |
27 |
| - } |
28 |
| - ], |
29 |
| - 'surface_reconstruction_screened_poisson': [ |
30 |
| - { |
31 |
| - 'name': 'depth', |
32 |
| - 'description': 'Maximum depth of the tree', |
33 |
| - 'value': 8 |
34 |
| - }, |
35 |
| - { |
36 |
| - 'name': 'width', |
37 |
| - 'description': 'Target width', |
38 |
| - 'value': 0 |
39 |
| - }, |
40 |
| - { |
41 |
| - 'name': 'scale', |
42 |
| - 'description': 'Ratio between the diameter of the cube', |
43 |
| - 'value': 1.1 |
44 |
| - }, |
45 |
| - { |
46 |
| - 'name': 'linear_fit', |
47 |
| - 'description': 'Use linear interpolation?', |
48 |
| - 'value': False |
49 |
| - }, |
50 |
| - { |
51 |
| - 'name': 'n_threads', |
52 |
| - 'description': 'Number of threads used for reconstruction', |
53 |
| - 'value': -1 |
54 |
| - } |
55 |
| - ] |
| 9 | + 'estimate_normals': [ |
| 10 | + { |
| 11 | + 'name': 'fast_normal_computation', |
| 12 | + 'description': 'Fast normal estimation', |
| 13 | + 'value': True |
| 14 | + }, |
| 15 | + { |
| 16 | + 'name': 'normals', |
| 17 | + 'description': 'Points normals', |
| 18 | + 'value': (1, 3) |
| 19 | + } |
| 20 | + ], |
| 21 | + 'orient_normals_consistent_tangent_plane': [ |
| 22 | + { |
| 23 | + 'name': 'k', |
| 24 | + 'description': 'Nearest neighbors', |
| 25 | + 'value': 100 |
| 26 | + } |
| 27 | + ], |
| 28 | + 'surface_reconstruction_screened_poisson': [ |
| 29 | + { |
| 30 | + 'name': 'depth', |
| 31 | + 'description': 'Maximum depth of the tree', |
| 32 | + 'value': 8 |
| 33 | + }, |
| 34 | + { |
| 35 | + 'name': 'width', |
| 36 | + 'description': 'Target width', |
| 37 | + 'value': 0 |
| 38 | + }, |
| 39 | + { |
| 40 | + 'name': 'scale', |
| 41 | + 'description': 'Ratio between the diameter of the cube', |
| 42 | + 'value': 1.1 |
| 43 | + }, |
| 44 | + { |
| 45 | + 'name': 'linear_fit', |
| 46 | + 'description': 'Use linear interpolation?', |
| 47 | + 'value': False |
| 48 | + }, |
| 49 | + { |
| 50 | + 'name': 'n_threads', |
| 51 | + 'description': 'Number of threads used for reconstruction', |
| 52 | + 'value': -1 |
| 53 | + } |
| 54 | + ] |
56 | 55 | }
|
57 | 56 |
|
58 | 57 | def __init__(self, point_cloud_file="", output_file="", clean_up=True):
|
59 | 58 |
|
60 | 59 | self.point_cloud = PointCloud()
|
61 | 60 | self.mesh = TriangleMesh()
|
62 | 61 |
|
| 62 | + # raise ValueError(f"Contains the {point_cloud_file} attribute: {output_file}") |
| 63 | + |
63 | 64 | super().__init__(point_cloud_file, output_file, clean_up)
|
64 | 65 |
|
65 | 66 | def load_file(self, file_path: str) -> PointCloud:
|
66 | 67 | print('Load point cloud file')
|
67 | 68 |
|
68 | 69 | self.point_cloud = o3d.io.read_point_cloud(
|
69 |
| - file_path, |
70 |
| - print_progress=True |
| 70 | + file_path, |
| 71 | + print_progress=True |
71 | 72 | )
|
72 | 73 |
|
73 | 74 | print(np.asarray(self.point_cloud.points))
|
@@ -124,12 +125,12 @@ def apply_filter(name: str, params_key_values: dict):
|
124 | 125 |
|
125 | 126 | # Save the generated Surface in a .ply file
|
126 | 127 | result = o3d.io.write_triangle_mesh(
|
127 |
| - output_file, |
128 |
| - self.mesh, |
129 |
| - compressed=True, |
130 |
| - write_vertex_colors=True, |
131 |
| - write_vertex_normals=True, |
132 |
| - print_progress=True |
| 128 | + output_file, |
| 129 | + self.mesh, |
| 130 | + compressed=True, |
| 131 | + write_vertex_colors=True, |
| 132 | + write_vertex_normals=True, |
| 133 | + print_progress=True |
133 | 134 | )
|
134 | 135 |
|
135 | 136 | if not result:
|
|
0 commit comments