Spaces:
Runtime error
Runtime error
s194649
commited on
Commit
·
15a3702
1
Parent(s):
0457b5c
debug mode
Browse files- inference.py +6 -0
inference.py
CHANGED
|
@@ -19,6 +19,7 @@ def PCL(mask, depth):
|
|
| 19 |
assert type(depth) == np.ndarray
|
| 20 |
rgb_mask = np.zeros((mask.shape[0], mask.shape[1], 3)).astype("uint8")
|
| 21 |
rgb_mask[mask] = (255, 0, 0)
|
|
|
|
| 22 |
depth_o3d = o3d.geometry.Image(depth)
|
| 23 |
image_o3d = o3d.geometry.Image(rgb_mask)
|
| 24 |
rgbd_image = o3d.geometry.RGBDImage.create_from_color_and_depth(image_o3d, depth_o3d, convert_rgb_to_intensity=False)
|
|
@@ -27,7 +28,12 @@ def PCL(mask, depth):
|
|
| 27 |
# Step 4: Convert PointCloud data to a NumPy array
|
| 28 |
points = np.asarray(pcd.points)
|
| 29 |
colors = np.asarray(pcd.colors)
|
|
|
|
|
|
|
|
|
|
| 30 |
mask = (colors[:, 0] == 255)
|
|
|
|
|
|
|
| 31 |
points = points[mask]
|
| 32 |
colors = colors[mask]
|
| 33 |
return points, colors
|
|
|
|
| 19 |
assert type(depth) == np.ndarray
|
| 20 |
rgb_mask = np.zeros((mask.shape[0], mask.shape[1], 3)).astype("uint8")
|
| 21 |
rgb_mask[mask] = (255, 0, 0)
|
| 22 |
+
print
|
| 23 |
depth_o3d = o3d.geometry.Image(depth)
|
| 24 |
image_o3d = o3d.geometry.Image(rgb_mask)
|
| 25 |
rgbd_image = o3d.geometry.RGBDImage.create_from_color_and_depth(image_o3d, depth_o3d, convert_rgb_to_intensity=False)
|
|
|
|
| 28 |
# Step 4: Convert PointCloud data to a NumPy array
|
| 29 |
points = np.asarray(pcd.points)
|
| 30 |
colors = np.asarray(pcd.colors)
|
| 31 |
+
print(np.unique(colors, axis=0))
|
| 32 |
+
print(np.unique(colors, axis=1))
|
| 33 |
+
print(np.unique(colors))
|
| 34 |
mask = (colors[:, 0] == 255)
|
| 35 |
+
print(mask.sum())
|
| 36 |
+
print(colors.shape)
|
| 37 |
points = points[mask]
|
| 38 |
colors = colors[mask]
|
| 39 |
return points, colors
|