Spaces:
Runtime error
Runtime error
jens
commited on
Commit
·
313008d
1
Parent(s):
369b1b2
fix
Browse files- inference.py +2 -2
inference.py
CHANGED
|
@@ -73,7 +73,7 @@ class DepthPredictor:
|
|
| 73 |
def generate_obj(self, image, n_samples, mask):
|
| 74 |
# Step 1: Create a point cloud
|
| 75 |
point_cloud, color_array = self.generate_pcl(image)
|
| 76 |
-
point_cloud, color_array = point_cloud[mask.ravel()[:-1]], color_array[mask.ravel()[:-1]]
|
| 77 |
# sample 1000 points
|
| 78 |
idxs = np.random.choice(len(point_cloud), int(n_samples))
|
| 79 |
point_cloud = point_cloud[idxs]
|
|
@@ -83,7 +83,7 @@ class DepthPredictor:
|
|
| 83 |
# Create cubes and add them to the mesh
|
| 84 |
for point, color in zip(point_cloud, color_array):
|
| 85 |
cube = o3d.geometry.TriangleMesh.create_box(width=0.000005, height=0.000005, depth=0.000005)
|
| 86 |
-
cube.translate(point)
|
| 87 |
cube.paint_uniform_color(color)
|
| 88 |
mesh += cube
|
| 89 |
# Save the mesh to an .obj file
|
|
|
|
| 73 |
def generate_obj(self, image, n_samples, mask):
|
| 74 |
# Step 1: Create a point cloud
|
| 75 |
point_cloud, color_array = self.generate_pcl(image)
|
| 76 |
+
#point_cloud, color_array = point_cloud[mask.ravel()[:-1]], color_array[mask.ravel()[:-1]]
|
| 77 |
# sample 1000 points
|
| 78 |
idxs = np.random.choice(len(point_cloud), int(n_samples))
|
| 79 |
point_cloud = point_cloud[idxs]
|
|
|
|
| 83 |
# Create cubes and add them to the mesh
|
| 84 |
for point, color in zip(point_cloud, color_array):
|
| 85 |
cube = o3d.geometry.TriangleMesh.create_box(width=0.000005, height=0.000005, depth=0.000005)
|
| 86 |
+
cube.translate(-point)
|
| 87 |
cube.paint_uniform_color(color)
|
| 88 |
mesh += cube
|
| 89 |
# Save the mesh to an .obj file
|