Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -33,11 +33,26 @@ def stitch_rgbd_videos(
|
|
33 |
|
34 |
stitched_video_path = None
|
35 |
if stitch:
|
|
|
|
|
|
|
36 |
# For stitching: read the original video in full resolution (without downscaling).
|
37 |
-
full_frames,
|
38 |
depths, _ = read_video_frames(depth_vis_video, max_len, target_fps, max_res=-1)
|
|
|
|
|
|
|
|
|
39 |
|
40 |
-
print(f"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
# For each frame, create a visual depth image from the inferenced depths.
|
43 |
d_min, d_max = np.min(depths), np.max(depths)
|
|
|
33 |
|
34 |
stitched_video_path = None
|
35 |
if stitch:
|
36 |
+
# Ensure target_fps is valid (positive) or use original fps
|
37 |
+
safe_target_fps = max(1, target_fps) if target_fps > 0 else -1
|
38 |
+
|
39 |
# For stitching: read the original video in full resolution (without downscaling).
|
40 |
+
full_frames, original_fps = read_video_frames(processed_video, max_len, target_fps, max_res=-1)
|
41 |
depths, _ = read_video_frames(depth_vis_video, max_len, target_fps, max_res=-1)
|
42 |
+
|
43 |
+
# Use original_fps if target_fps wasn't specified
|
44 |
+
if target_fps <= 0:
|
45 |
+
target_fps = original_fps
|
46 |
|
47 |
+
print(f"Video fps: {original_fps}, target fps: {target_fps}")
|
48 |
+
print(f"Depth frame shape: {depths[0].shape if len(depths) > 0 else 'No frames'}, "
|
49 |
+
f"dtype: {depths[0].dtype if len(depths) > 0 else 'N/A'}, "
|
50 |
+
f"min: {depths.min() if len(depths) > 0 else 'N/A'}, "
|
51 |
+
f"max: {depths.max() if len(depths) > 0 else 'N/A'}")
|
52 |
+
|
53 |
+
if len(depths) == 0 or len(full_frames) == 0:
|
54 |
+
print("Error: No frames to process in either RGB or depth video")
|
55 |
+
return None
|
56 |
|
57 |
# For each frame, create a visual depth image from the inferenced depths.
|
58 |
d_min, d_max = np.min(depths), np.max(depths)
|