Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -49,8 +49,9 @@ def plot_depth_map(depth_map, original_image):
|
|
49 |
# Rotate by 90 degrees
|
50 |
x, y = y, x
|
51 |
|
52 |
-
#
|
53 |
-
|
|
|
54 |
|
55 |
ax.plot_surface(x, y, depth_map, facecolors=colors, shade=False)
|
56 |
ax.view_init(elev=70, azim=0) # Tilt by 20 degrees (90 - 20 = 70)
|
@@ -74,7 +75,7 @@ def process_frame(image):
|
|
74 |
|
75 |
depth_map = (depth_map - depth_map.min()) / (depth_map.max() - depth_map.min())
|
76 |
|
77 |
-
return plot_depth_map(depth_map,
|
78 |
|
79 |
interface = gr.Interface(
|
80 |
fn=process_frame,
|
|
|
49 |
# Rotate by 90 degrees
|
50 |
x, y = y, x
|
51 |
|
52 |
+
# Resize original image to match depth map dimensions
|
53 |
+
original_image_resized = cv2.resize(original_image, (depth_map.shape[1], depth_map.shape[0]))
|
54 |
+
colors = original_image_resized.reshape(-1, 3) / 255.0
|
55 |
|
56 |
ax.plot_surface(x, y, depth_map, facecolors=colors, shade=False)
|
57 |
ax.view_init(elev=70, azim=0) # Tilt by 20 degrees (90 - 20 = 70)
|
|
|
75 |
|
76 |
depth_map = (depth_map - depth_map.min()) / (depth_map.max() - depth_map.min())
|
77 |
|
78 |
+
return plot_depth_map(depth_map, image) # Pass the original image, not resized
|
79 |
|
80 |
interface = gr.Interface(
|
81 |
fn=process_frame,
|