Spatial Distortions#

Space distortions.

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

Bases: SpatialDistortion

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 2. If the order is L_inf (order=float(“inf”)), we will contract the space to a cube of side length 4. 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)[source]#
Parameters:

positions – Sample to distort

Returns:

distorted sample

Return type:

Union

class nerfstudio.field_components.spatial_distortions.SpatialDistortion(*args, **kwargs)[source]#

Bases: Module

Apply spatial distortions

abstract forward(positions: Union[Float[Tensor, '*bs 3'], Gaussians]) Union[Float[Tensor, '*bs 3'], Gaussians][source]#
Parameters:

positions – Sample to distort

Returns:

distorted sample

Return type:

Union