Spaces:
Runtime error
Runtime error
jens
commited on
Commit
·
0f1c4a8
1
Parent(s):
a3d7074
invert depth map
Browse files- inference.py +2 -2
inference.py
CHANGED
|
@@ -39,7 +39,7 @@ class DepthPredictor:
|
|
| 39 |
return formatted
|
| 40 |
|
| 41 |
def generate_pcl(self, image):
|
| 42 |
-
depth = self.predict(image)
|
| 43 |
# Step 2: Create an RGBD image from the RGB and depth image
|
| 44 |
depth_o3d = o3d.geometry.Image(depth)
|
| 45 |
image_o3d = o3d.geometry.Image(np.array(image))
|
|
@@ -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(
|
| 87 |
cube.paint_uniform_color(color)
|
| 88 |
mesh += cube
|
| 89 |
# Save the mesh to an .obj file
|
|
|
|
| 39 |
return formatted
|
| 40 |
|
| 41 |
def generate_pcl(self, image):
|
| 42 |
+
depth = 255 - self.predict(image)
|
| 43 |
# Step 2: Create an RGBD image from the RGB and depth image
|
| 44 |
depth_o3d = o3d.geometry.Image(depth)
|
| 45 |
image_o3d = o3d.geometry.Image(np.array(image))
|
|
|
|
| 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
|