Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -88,19 +88,13 @@ def stitch_rgbd_videos(
|
|
88 |
H_full, W_full = rgb_full.shape[:2]
|
89 |
depth_vis_resized = cv2.resize(depth_vis, (W_full, H_full))
|
90 |
|
91 |
-
# Ensure both
|
92 |
-
|
93 |
-
|
94 |
-
#if len(depth_vis_resized.shape) == 2:
|
95 |
-
# depth_vis_resized = cv2.cvtColor(depth_vis_resized, cv2.COLOR_GRAY2BGR)
|
96 |
|
97 |
-
# Ensure same
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
# Ensure images are contiguous in memory.
|
102 |
-
#rgb_full = np.ascontiguousarray(rgb_full)
|
103 |
-
#depth_vis_resized = np.ascontiguousarray(depth_vis_resized)
|
104 |
|
105 |
# Now safely concatenate.
|
106 |
stitched = cv2.hconcat([rgb_full, depth_vis_resized])
|
|
|
88 |
H_full, W_full = rgb_full.shape[:2]
|
89 |
depth_vis_resized = cv2.resize(depth_vis, (W_full, H_full))
|
90 |
|
91 |
+
# Ensure both are 3-channel images:
|
92 |
+
if len(rgb_full.shape) == 3 and len(depth_vis_resized.shape) == 2:
|
93 |
+
depth_vis_resized = cv2.cvtColor(depth_vis_resized, cv2.COLOR_GRAY2BGR)
|
|
|
|
|
94 |
|
95 |
+
# Ensure both are the same type (commonly uint8):
|
96 |
+
if rgb_full.dtype != depth_vis_resized.dtype:
|
97 |
+
depth_vis_resized = depth_vis_resized.astype(rgb_full.dtype)
|
|
|
|
|
|
|
|
|
98 |
|
99 |
# Now safely concatenate.
|
100 |
stitched = cv2.hconcat([rgb_full, depth_vis_resized])
|