MCPcopy Create free account
hub / github.com/Jiawei-Yang/FreeNeRF / visualize_normals

Function visualize_normals

internal/vis.py:113–125  ·  view source on GitHub ↗

Visualize fake normals of `depth` (optionally scaled to be isotropic).

(depth, acc, scaling=None)

Source from the content-addressed store, hash-verified

111
112
113def visualize_normals(depth, acc, scaling=None):
114 """Visualize fake normals of `depth` (optionally scaled to be isotropic)."""
115 if scaling is None:
116 mask = ~jnp.isnan(depth)
117 x, y = jnp.meshgrid(
118 jnp.arange(depth.shape[1]), jnp.arange(depth.shape[0]), indexing='xy')
119 xy_var = (jnp.var(x[mask]) + jnp.var(y[mask])) / 2
120 z_var = jnp.var(depth[mask])
121 scaling = jnp.sqrt(xy_var / z_var)
122
123 scaled_depth = scaling * depth
124 normals = depth_to_normals(scaled_depth)
125 return matte(jnp.isnan(normals) + jnp.nan_to_num((normals + 1) / 2, 0), acc)
126
127
128def visualize_coord_mod(coords, acc):

Callers

nothing calls this directly

Calls 2

depth_to_normalsFunction · 0.85
matteFunction · 0.85

Tested by

no test coverage detected