(depth: np.ndarray, mask: np.ndarray = None, cmap: str = 'Spectral')
| 19 | |
| 20 | |
| 21 | def colorize_depth_affine(depth: np.ndarray, mask: np.ndarray = None, cmap: str = 'Spectral') -> np.ndarray: |
| 22 | if mask is not None: |
| 23 | depth = np.where(mask, depth, np.nan) |
| 24 | |
| 25 | min_depth, max_depth = np.nanquantile(depth, 0.001), np.nanquantile(depth, 0.999) |
| 26 | depth = (depth - min_depth) / (max_depth - min_depth) |
| 27 | colored = np.nan_to_num(matplotlib.colormaps[cmap](depth)[..., :3], 0) |
| 28 | colored = np.ascontiguousarray((colored.clip(0, 1) * 255).astype(np.uint8)) |
| 29 | return colored |
| 30 | |
| 31 | |
| 32 | def colorize_disparity(disparity: np.ndarray, mask: np.ndarray = None, normalize: bool = True, cmap: str = 'Spectral') -> np.ndarray: |
nothing calls this directly
no outgoing calls
no test coverage detected