SFM: sfm-based depth, some breadcrumbs for pycolmap (#1457)

* save

* save

* more cleanup

* save

* save

* update phototourism

* save

* works

* works

* cleanup

* cleanup

* lint

* python3 default

* cleanup
This commit is contained in:
Paul Wais authored and GitHub committed 2023-02-25 21:10:53 -08:00
1 parent b62571d537
commit 5c73766653
19 files changed
+621 -469

No files matched your search

+2 -2
View File
@@ -31,7 +31,7 @@ def apply_colormap(image: TensorType["bs":..., 1], cmap="viridis") -> TensorType
cmap: Colormap for image.
Returns:
TensorType: Colored image
TensorType: Colored image with colors in [0, 1]
"""
colormap = cm.get_cmap(cmap)
@@ -62,7 +62,7 @@ def apply_depth_colormap(
cmap: Colormap to apply.
Returns:
Colored depth image
Colored depth image with colors in [0, 1]
"""
near_plane = near_plane or float(torch.min(depth))
+8
View File
@@ -16,6 +16,7 @@
Miscellaneous helper code.
"""
from typing import Any, Callable, Dict, List, Optional, Union
import torch
@@ -147,3 +148,10 @@ def update_avg(prev_avg: float, new_val: float, step: int) -> float:
float: new updated average
"""
return (step * prev_avg + new_val) / (step + 1)
def strtobool(val) -> bool:
"""Cheap replacement for `distutils.util.strtobool()` which is deprecated
FMI https://stackoverflow.com/a/715468
"""
return val.lower() in ("yes", "y", "true", "t", "on", "1")