Visualize fake normals of `depth` (optionally scaled to be isotropic).
(depth, acc, scaling=None)
| 111 | |
| 112 | |
| 113 | def 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 | |
| 128 | def visualize_coord_mod(coords, acc): |
nothing calls this directly
no test coverage detected