Spaces:
Running
Running
fix index
Browse files
app.py
CHANGED
@@ -21,7 +21,7 @@ def predict(image, color_map):
|
|
21 |
# apply matplotlib colormap (e.g., viridis)
|
22 |
depth_array = np.array(depth_image) # Convert PIL image to NumPy array
|
23 |
colormap = plt.get_cmap(color_map) # Choose a colormap
|
24 |
-
depth_colored = colormap(depth_array
|
25 |
depth_colored = (depth_colored * 255).astype(np.uint8) # Convert to RGB (discard alpha)
|
26 |
|
27 |
depth_colored = Image.fromarray(depth_colored)
|
|
|
21 |
# apply matplotlib colormap (e.g., viridis)
|
22 |
depth_array = np.array(depth_image) # Convert PIL image to NumPy array
|
23 |
colormap = plt.get_cmap(color_map) # Choose a colormap
|
24 |
+
depth_colored = colormap(depth_array / 255.0) # Normalize and apply colormap
|
25 |
depth_colored = (depth_colored * 255).astype(np.uint8) # Convert to RGB (discard alpha)
|
26 |
|
27 |
depth_colored = Image.fromarray(depth_colored)
|