Update app.py
Browse files
app.py
CHANGED
@@ -42,8 +42,8 @@ async def analyze_path(file: UploadFile = File(...)):
|
|
42 |
|
43 |
# 🟢 Xử lý ảnh sau khi dự đoán
|
44 |
predicted_depth = outputs.predicted_depth.squeeze().cpu().numpy()
|
45 |
-
|
46 |
-
|
47 |
# 🔵 Chuyển depth_map thành ảnh có thể hiển thị
|
48 |
depth_colored = cv2.applyColorMap(depth_map, cv2.COLORMAP_INFERNO)
|
49 |
depth_pil = Image.fromarray(depth_colored)
|
|
|
42 |
|
43 |
# 🟢 Xử lý ảnh sau khi dự đoán
|
44 |
predicted_depth = outputs.predicted_depth.squeeze().cpu().numpy()
|
45 |
+
# depth_map = (predicted_depth - predicted_depth.min()) / (predicted_depth.max() - predicted_depth.min())
|
46 |
+
depth_map = (predicted_depth * 255 / predicted_depth.max()).astype("uint8")
|
47 |
# 🔵 Chuyển depth_map thành ảnh có thể hiển thị
|
48 |
depth_colored = cv2.applyColorMap(depth_map, cv2.COLORMAP_INFERNO)
|
49 |
depth_pil = Image.fromarray(depth_colored)
|