# Spatial Distortions#

Space distortions.

class nerfstudio.field_components.spatial_distortions.SceneContraction(order: Optional[Union[float, int]] = None)#

Contract unbounded space using the contraction was proposed in MipNeRF-360. We use the following contraction equation:

$\begin{split}f(x) = \begin{cases} x & ||x|| \leq 1 \\ (2 - \frac{1}{||x||})(\frac{x}{||x||}) & ||x|| > 1 \end{cases}\end{split}$

If the order is not specified, we use the Frobenius norm, this will contract the space to a sphere of radius 1. If the order is L_inf (order=float(“inf”)), we will contract the space to a cube of side length 2. If using voxel based encodings such as the Hash encoder, we recommend using the L_inf norm.

Parameters:

order – Order of the norm. Default to the Frobenius norm. Must be set to None for Gaussians.

forward(positions)#
Parameters:

positions – Sample to distort

Returns:

distorted sample

Return type:

Union

class nerfstudio.field_components.spatial_distortions.SpatialDistortion#

Bases: Module

Apply spatial distortions

forward(positions: Union[Tensor, Gaussians]) Union[Tensor, Gaussians]#
Parameters:

positions – Sample to distort

Returns:

distorted sample

Return type:

Union