Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -7,16 +7,13 @@ import matplotlib.cm as cm
|
|
7 |
import matplotlib # New import for the updated colormap API
|
8 |
import subprocess
|
9 |
import sys
|
10 |
-
import spaces
|
11 |
|
12 |
from utils.dc_utils import read_video_frames, save_video
|
13 |
|
14 |
-
title = "#RGBD
|
15 |
description = """**Video Depth Anything** + RGBD sbs output for viewing with Looking Glass Factory displays.
|
16 |
Please refer to our [paper](https://arxiv.org/abs/2501.12375), [project page](https://videodepthanything.github.io/), and [github](https://github.com/DepthAnything/Video-Depth-Anything) for more details."""
|
17 |
|
18 |
-
@spaces.GPU(enable_queue=True)
|
19 |
-
|
20 |
def stitch_rgbd_videos(
|
21 |
processed_video: str,
|
22 |
depth_vis_video: str,
|
@@ -58,7 +55,12 @@ def stitch_rgbd_videos(
|
|
58 |
# then convert that color image to grayscale.
|
59 |
cmap = matplotlib.colormaps.get_cmap("inferno")
|
60 |
depth_color = (cmap(depth_norm / 255.0)[..., :3] * 255).astype(np.uint8)
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
62 |
depth_vis = np.stack([depth_gray] * 3, axis=-1)
|
63 |
else:
|
64 |
# Directly generate a grayscale image from the normalized depth values.
|
|
|
7 |
import matplotlib # New import for the updated colormap API
|
8 |
import subprocess
|
9 |
import sys
|
|
|
10 |
|
11 |
from utils.dc_utils import read_video_frames, save_video
|
12 |
|
13 |
+
title = """#""RGBD SBS output"
|
14 |
description = """**Video Depth Anything** + RGBD sbs output for viewing with Looking Glass Factory displays.
|
15 |
Please refer to our [paper](https://arxiv.org/abs/2501.12375), [project page](https://videodepthanything.github.io/), and [github](https://github.com/DepthAnything/Video-Depth-Anything) for more details."""
|
16 |
|
|
|
|
|
17 |
def stitch_rgbd_videos(
|
18 |
processed_video: str,
|
19 |
depth_vis_video: str,
|
|
|
55 |
# then convert that color image to grayscale.
|
56 |
cmap = matplotlib.colormaps.get_cmap("inferno")
|
57 |
depth_color = (cmap(depth_norm / 255.0)[..., :3] * 255).astype(np.uint8)
|
58 |
+
|
59 |
+
if len(depth_color.shape) == 3 and depth_color.shape[2] in [3, 4]:
|
60 |
+
depth_gray = cv2.cvtColor(depth_color, cv2.COLOR_RGB2GRAY)
|
61 |
+
else:
|
62 |
+
depth_gray = depth_color
|
63 |
+
|
64 |
depth_vis = np.stack([depth_gray] * 3, axis=-1)
|
65 |
else:
|
66 |
# Directly generate a grayscale image from the normalized depth values.
|