mtwohey2 commited on
Commit
70e91c6
·
verified ·
1 Parent(s): e0d775a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -12
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 images have 3 channels.
92
- #if len(rgb_full.shape) == 2:
93
- # rgb_full = cv2.cvtColor(rgb_full, cv2.COLOR_GRAY2BGR)
94
- #if len(depth_vis_resized.shape) == 2:
95
- # depth_vis_resized = cv2.cvtColor(depth_vis_resized, cv2.COLOR_GRAY2BGR)
96
 
97
- # Ensure same data type.
98
- #if rgb_full.dtype != depth_vis_resized.dtype:
99
- # depth_vis_resized = depth_vis_resized.astype(rgb_full.dtype)
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])