Spaces:
Runtime error
Runtime error
s194649
commited on
Commit
·
ba6989b
1
Parent(s):
daeee36
fix
Browse files
app.py
CHANGED
|
@@ -134,7 +134,7 @@ with block:
|
|
| 134 |
def on_depth_reconstruction_btn_click(inputs):
|
| 135 |
print("depth reconstruction")
|
| 136 |
image = inputs[input_image]
|
| 137 |
-
path = dpt.generate_obj_masks2(image=image, cube_size=inputs[cube_size], masks=masks) #
|
| 138 |
return {pcl_figure: path}
|
| 139 |
depth_reconstruction_btn.click(on_depth_reconstruction_btn_click, components, [pcl_figure], queue=False)
|
| 140 |
|
|
|
|
| 134 |
def on_depth_reconstruction_btn_click(inputs):
|
| 135 |
print("depth reconstruction")
|
| 136 |
image = inputs[input_image]
|
| 137 |
+
path = dpt.generate_obj_masks2(image=image, cube_size=inputs[cube_size], masks=inputs[masks]) #
|
| 138 |
return {pcl_figure: path}
|
| 139 |
depth_reconstruction_btn.click(on_depth_reconstruction_btn_click, components, [pcl_figure], queue=False)
|
| 140 |
|
utils.py
CHANGED
|
@@ -195,22 +195,3 @@ def PCL3(image):
|
|
| 195 |
|
| 196 |
return fig
|
| 197 |
|
| 198 |
-
|
| 199 |
-
def PCL(mask, depth):
|
| 200 |
-
assert mask.shape == depth.shape
|
| 201 |
-
assert type(mask) == np.ndarray
|
| 202 |
-
assert type(depth) == np.ndarray
|
| 203 |
-
rgb_mask = np.zeros((mask.shape[0], mask.shape[1], 3))
|
| 204 |
-
rgb_mask[mask] = (1.0, 0.0, 0.0)
|
| 205 |
-
depth_o3d = o3d.geometry.Image(depth)
|
| 206 |
-
image_o3d = o3d.geometry.Image(mask)
|
| 207 |
-
rgbd_image = o3d.geometry.RGBDImage.create_from_color_and_depth(image_o3d, depth_o3d, convert_rgb_to_intensity=False)
|
| 208 |
-
# Step 3: Create a PointCloud from the RGBD image
|
| 209 |
-
pcd = o3d.geometry.PointCloud.create_from_rgbd_image(rgbd_image, o3d.camera.PinholeCameraIntrinsic(o3d.camera.PinholeCameraIntrinsicParameters.PrimeSenseDefault))
|
| 210 |
-
# Step 4: Convert PointCloud data to a NumPy array
|
| 211 |
-
points = np.asarray(pcd.points)
|
| 212 |
-
colors = np.asarray(pcd.colors)
|
| 213 |
-
mask = (colors[:, 0] == 1.0)
|
| 214 |
-
points = points[mask]
|
| 215 |
-
colors = colors[mask]
|
| 216 |
-
return points, colors
|
|
|
|
| 195 |
|
| 196 |
return fig
|
| 197 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|