Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -63,12 +63,15 @@ def stitch_rgbd_videos(
|
|
63 |
# then convert that color image to grayscale.
|
64 |
cmap = matplotlib.colormaps.get_cmap("inferno")
|
65 |
depth_color = (cmap(depth_norm / 255.0)[..., :3] * 255).astype(np.uint8)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
-
depth_gray = cv2.cvtColor(depth_color, cv2.COLOR_RGB2GRAY)
|
68 |
depth_vis = np.stack([depth_gray] * 3, axis=-1)
|
69 |
-
|
70 |
-
#depth_gray = cv2.cvtColor(depth_color, cv2.COLOR_RGB2GRAY)
|
71 |
-
#depth_vis = np.stack([depth_gray] * 3, axis=-1)
|
72 |
else:
|
73 |
# Directly generate a grayscale image from the normalized depth values.
|
74 |
depth_vis = np.stack([depth_norm] * 3, axis=-1)
|
|
|
63 |
# then convert that color image to grayscale.
|
64 |
cmap = matplotlib.colormaps.get_cmap("inferno")
|
65 |
depth_color = (cmap(depth_norm / 255.0)[..., :3] * 255).astype(np.uint8)
|
66 |
+
|
67 |
+
# Check if depth_color actually has 3 or 4 channels.
|
68 |
+
if depth_color.ndim == 3 and depth_color.shape[2] in [3, 4]:
|
69 |
+
depth_gray = cv2.cvtColor(depth_color, cv2.COLOR_RGB2GRAY)
|
70 |
+
else:
|
71 |
+
# If it's not 3 or 4 channels, assume it's already grayscale.
|
72 |
+
depth_gray = depth_color
|
73 |
|
|
|
74 |
depth_vis = np.stack([depth_gray] * 3, axis=-1)
|
|
|
|
|
|
|
75 |
else:
|
76 |
# Directly generate a grayscale image from the normalized depth values.
|
77 |
depth_vis = np.stack([depth_norm] * 3, axis=-1)
|