MCPcopy
hub / github.com/apple/ml-depth-pro / invert_depth

Function invert_depth

src/depth_pro/eval/boundary_metrics.py:245–259  ·  view source on GitHub ↗

Inverts a depth map with numerical stability. Args: ---- depth (np.ndarray): Depth map to be inverted. eps (float): Minimum value to avoid division by zero (default is 1e-6). Returns: ------- np.ndarray: Inverted depth map.

(depth: np.ndarray, eps: float = 1e-6)

Source from the content-addressed store, hash-verified

243
244
245def invert_depth(depth: np.ndarray, eps: float = 1e-6) -> np.ndarray:
246 """Inverts a depth map with numerical stability.
247
248 Args:
249 ----
250 depth (np.ndarray): Depth map to be inverted.
251 eps (float): Minimum value to avoid division by zero (default is 1e-6).
252
253 Returns:
254 -------
255 np.ndarray: Inverted depth map.
256
257 """
258 inverse_depth = 1.0 / depth.clip(min=eps)
259 return inverse_depth
260
261
262def SI_boundary_F1(

Callers 2

SI_boundary_F1Function · 0.85
SI_boundary_RecallFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected