Trying fix variants
Browse files
app.py
CHANGED
@@ -28,9 +28,17 @@ depth_model = DPTForDepthEstimation.from_pretrained("Intel/dpt-large").to(device
|
|
28 |
|
29 |
|
30 |
def processar_profundidade(depth_arr: np.ndarray) -> Image.Image:
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
|
36 |
def processar_imagem(imagem: Image.Image):
|
|
|
28 |
|
29 |
|
30 |
def processar_profundidade(depth_arr: np.ndarray) -> Image.Image:
|
31 |
+
d_min, d_max = depth_arr.min(), depth_arr.max()
|
32 |
+
depth_stretched = (depth_arr - d_min) / (d_max - d_min + 1e-8)
|
33 |
+
depth_stretched = (depth_stretched * 255).astype(np.uint8)
|
34 |
+
|
35 |
+
depth_pil = Image.fromarray(depth_stretched)
|
36 |
+
depth_pil = ImageOps.autocontrast(depth_pil)
|
37 |
+
|
38 |
+
enhancer = ImageEnhance.Sharpness(depth_pil)
|
39 |
+
depth_pil = enhancer.enhance(2.0)
|
40 |
+
|
41 |
+
return depth_pil
|
42 |
|
43 |
|
44 |
def processar_imagem(imagem: Image.Image):
|