vr180_convert package

class vr180_convert.DenormalizeTransformer(scale: tuple[float, float], center: tuple[float, float])[source]

Bases: TransformerBase

Denormalize the coordinates from [-1, 1] to the original image size.

center: tuple[float, float]

The center of the image. Recommended to be the center of the result image.

inverse_transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Inverse transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

scale: tuple[float, float]

The scale of the image. Recommended to be the half of the width and height of the result image.

set_inverse_transform_request(*, x: bool | None | str = '$UNCHANGED$') DenormalizeTransformer

Request metadata passed to the inverse_transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to inverse_transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to inverse_transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in inverse_transform.

Returns:

self – The updated object.

Return type:

object

set_transform_request(*, x: bool | None | str = '$UNCHANGED$') DenormalizeTransformer

Request metadata passed to the transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in transform.

Returns:

self – The updated object.

Return type:

object

transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

class vr180_convert.EquirectangularEncoder(is_latitude_y: bool = True)[source]

Bases: TransformerBase

Encodes equirectangular image.

inverse_transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Inverse transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

is_latitude_y: bool

Whether latitude is encoded in y axis.

set_inverse_transform_request(*, x: bool | None | str = '$UNCHANGED$') EquirectangularEncoder

Request metadata passed to the inverse_transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to inverse_transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to inverse_transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in inverse_transform.

Returns:

self – The updated object.

Return type:

object

set_transform_request(*, x: bool | None | str = '$UNCHANGED$') EquirectangularEncoder

Request metadata passed to the transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in transform.

Returns:

self – The updated object.

Return type:

object

transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

class vr180_convert.Euclidean3DRotator(rotation: quaternion)[source]

Bases: Euclidean3DTransformer

Rotate as 3D unit vector.

inverse_transform_v(v: ndarray[Any, dtype[_ScalarType_co]]) ndarray[Any, dtype[_ScalarType_co]][source]

Inverse transform 3D unit vector.

Parameters:

v (NDArray) – The 3D unit vector. z axis is forward, x axis is right, y axis is up.

Returns:

The inverse transformed 3D unit vector. z axis is forward, x axis is right, y axis is up.

Return type:

NDArray

rotation: quaternion

The rotation quaternion.

set_inverse_transform_request(*, x: bool | None | str = '$UNCHANGED$') Euclidean3DRotator

Request metadata passed to the inverse_transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to inverse_transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to inverse_transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in inverse_transform.

Returns:

self – The updated object.

Return type:

object

set_transform_request(*, x: bool | None | str = '$UNCHANGED$') Euclidean3DRotator

Request metadata passed to the transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in transform.

Returns:

self – The updated object.

Return type:

object

transform_v(v: ndarray[Any, dtype[_ScalarType_co]]) ndarray[Any, dtype[_ScalarType_co]][source]

Transform 3D unit vector.

Parameters:

v (NDArray) – The 3D unit vector. z axis is forward, x axis is right, y axis is up.

Returns:

The transformed 3D unit vector. z axis is forward, x axis is right, y axis is up.

Return type:

NDArray

class vr180_convert.Euclidean3DTransformer[source]

Bases: TransformerBase

Transform as 3D unit vector.

inverse_transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Inverse transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

abstract inverse_transform_v(v: ndarray[Any, dtype[_ScalarType_co]]) ndarray[Any, dtype[_ScalarType_co]][source]

Inverse transform 3D unit vector.

Parameters:

v (NDArray) – The 3D unit vector. z axis is forward, x axis is right, y axis is up.

Returns:

The inverse transformed 3D unit vector. z axis is forward, x axis is right, y axis is up.

Return type:

NDArray

set_inverse_transform_request(*, x: bool | None | str = '$UNCHANGED$') Euclidean3DTransformer

Request metadata passed to the inverse_transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to inverse_transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to inverse_transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in inverse_transform.

Returns:

self – The updated object.

Return type:

object

set_transform_request(*, x: bool | None | str = '$UNCHANGED$') Euclidean3DTransformer

Request metadata passed to the transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in transform.

Returns:

self – The updated object.

Return type:

object

transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

abstract transform_v(v: ndarray[Any, dtype[_ScalarType_co]]) ndarray[Any, dtype[_ScalarType_co]][source]

Transform 3D unit vector.

Parameters:

v (NDArray) – The 3D unit vector. z axis is forward, x axis is right, y axis is up.

Returns:

The transformed 3D unit vector. z axis is forward, x axis is right, y axis is up.

Return type:

NDArray

vr180_convert.FisheyeDecoder(mapping_type: Literal['rectilinear', 'stereographic', 'equidistant', 'equisolid', 'orthographic']) InverseTransformer[FisheyeEncoder][source]

Decodes fisheye image.

Parameters:

mapping_type (Literal['rectilinear', 'stereographic', 'equidistant', 'equisolid', 'orthographic']) – The mapping type of the fisheye image.

Returns:

The fisheye decoder.

Return type:

InverseTransformer

class vr180_convert.FisheyeEncoder(mapping_type: Literal['rectilinear', 'stereographic', 'equidistant', 'equisolid', 'orthographic'])[source]

Bases: PolarRollTransformer

Encodes fisheye image.

inverse_transform_polar(theta: ndarray[Any, dtype[_ScalarType_co]], roll: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

[-pi/2, pi/2] -> [-1, 1].

mapping_type: Literal['rectilinear', 'stereographic', 'equidistant', 'equisolid', 'orthographic']

The mapping type of the fisheye image.

set_inverse_transform_request(*, x: bool | None | str = '$UNCHANGED$') FisheyeEncoder

Request metadata passed to the inverse_transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to inverse_transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to inverse_transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in inverse_transform.

Returns:

self – The updated object.

Return type:

object

set_transform_request(*, x: bool | None | str = '$UNCHANGED$') FisheyeEncoder

Request metadata passed to the transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in transform.

Returns:

self – The updated object.

Return type:

object

transform_polar(theta: ndarray[Any, dtype[_ScalarType_co]], roll: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

[-1, 1] -> [-pi/2, pi/2].

class vr180_convert.MultiTransformer(transformers: list[TransformerBase])[source]

Bases: TransformerBase

A transformer that applies multiple transformers in sequence.

inverse_transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Inverse transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

set_inverse_transform_request(*, x: bool | None | str = '$UNCHANGED$') MultiTransformer

Request metadata passed to the inverse_transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to inverse_transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to inverse_transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in inverse_transform.

Returns:

self – The updated object.

Return type:

object

set_transform_request(*, x: bool | None | str = '$UNCHANGED$') MultiTransformer

Request metadata passed to the transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in transform.

Returns:

self – The updated object.

Return type:

object

transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

transformers: list[TransformerBase]
class vr180_convert.NormalizeTransformer(center: tuple[float, float] | None = None, scale: tuple[float, float] | Literal['min', 'max'] | None = None)[source]

Bases: TransformerBase

Normalize the coordinates to [-1, 1].

center: tuple[float, float] | None

The center of the image. If None, the center is the center of the image.

inverse_transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Inverse transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

scale: tuple[float, float] | Literal['min', 'max'] | None

The scale of the image. If “min” or None, the scale is the minimum of the width and height. If “max”, the scale is the maximum of the width and height.

set_inverse_transform_request(*, x: bool | None | str = '$UNCHANGED$') NormalizeTransformer

Request metadata passed to the inverse_transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to inverse_transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to inverse_transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in inverse_transform.

Returns:

self – The updated object.

Return type:

object

set_transform_request(*, x: bool | None | str = '$UNCHANGED$') NormalizeTransformer

Request metadata passed to the transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in transform.

Returns:

self – The updated object.

Return type:

object

transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

class vr180_convert.PolarRollTransformer[source]

Bases: TransformerBase

Transform using polar coordinates.

inverse_transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Inverse transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

abstract inverse_transform_polar(theta: ndarray[Any, dtype[_ScalarType_co]], roll: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Inverse transform using polar coordinates.

Parameters:
  • theta (NDArray) – The distance or angle from the center (front-facing direction)

  • roll (NDArray) – The angle around the center (front-facing direction)

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

theta and roll after transformation.

Return type:

tuple[NDArray, NDArray]

set_inverse_transform_request(*, x: bool | None | str = '$UNCHANGED$') PolarRollTransformer

Request metadata passed to the inverse_transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to inverse_transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to inverse_transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in inverse_transform.

Returns:

self – The updated object.

Return type:

object

set_transform_request(*, x: bool | None | str = '$UNCHANGED$') PolarRollTransformer

Request metadata passed to the transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in transform.

Returns:

self – The updated object.

Return type:

object

transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

abstract transform_polar(theta: ndarray[Any, dtype[_ScalarType_co]], roll: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Transform using polar coordinates.

Parameters:
  • theta (NDArray) – The distance or angle from the center (front-facing direction)

  • roll (NDArray) – The angle around the center (front-facing direction)

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

theta and roll after transformation.

Return type:

tuple[NDArray, NDArray]

class vr180_convert.TransformerBase[source]

Bases: BaseEstimator, TransformerMixin

Base class for transformers.

abstract inverse_transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Inverse transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

set_inverse_transform_request(*, x: bool | None | str = '$UNCHANGED$') TransformerBase

Request metadata passed to the inverse_transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to inverse_transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to inverse_transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in inverse_transform.

Returns:

self – The updated object.

Return type:

object

set_transform_request(*, x: bool | None | str = '$UNCHANGED$') TransformerBase

Request metadata passed to the transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in transform.

Returns:

self – The updated object.

Return type:

object

abstract transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

class vr180_convert.ZoomTransformer(scale: float)[source]

Bases: TransformerBase

Zoom the image.

inverse_transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Inverse transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

scale: float

The zoom scale.

set_inverse_transform_request(*, x: bool | None | str = '$UNCHANGED$') ZoomTransformer

Request metadata passed to the inverse_transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to inverse_transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to inverse_transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in inverse_transform.

Returns:

self – The updated object.

Return type:

object

set_transform_request(*, x: bool | None | str = '$UNCHANGED$') ZoomTransformer

Request metadata passed to the transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in transform.

Returns:

self – The updated object.

Return type:

object

transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

vr180_convert.apply(transformer: TransformerBase, *, in_paths: Sequence[Path | str | ndarray[Any, dtype[_ScalarType_co]]] | Path | str | ndarray[Any, dtype[_ScalarType_co]], out_paths: Sequence[Path | str] | None | Path | str = None, size_output: tuple[int, int] = (2048, 2048), interpolation: int = 4, boarder_mode: int = 0, boarder_value: int | tuple[int, int, int] = 0, radius: float | Literal['auto', 'max'] = 'auto') Sequence[ndarray[Any, dtype[uint8]]][source]

Apply transformer to images.

Parameters:
  • transformer (TransformerBase) – Transformer to be applied.

  • in_paths (Sequence[Path | str] | Path | str) – Input image paths.

  • out_paths (Sequence[Path | str] | None | Path | str, optional) – Output image paths, by default None If None, do not save the images.

  • size_output (tuple[int, int], optional) – Size of the output image, by default (2048, 2048)

  • interpolation (int, optional) – Interpolation method for opencv, by default cv.INTER_LANCZOS4

  • boarder_mode (int, optional) – Boarder mode for opencv, by default cv.BORDER_CONSTANT

  • boarder_value (int | tuple[int, int, int], optional) – Boarder value for opencv, by default 0

  • radius (float | Literal["auto", "max"], optional) – Radius of the fisheye image, by default "auto"

Returns:

Images after transformation.

Return type:

Sequence[NDArray[np.uint8]]

vr180_convert.apply_lr(transformer: TransformerBase | tuple[TransformerBase, TransformerBase], *, left_path: Path | str | ndarray[Any, dtype[_ScalarType_co]], right_path: Path | str | ndarray[Any, dtype[_ScalarType_co]], out_path: Path | str, size_output: tuple[int, int] = (2048, 2048), interpolation: int = 4, boarder_mode: int = 0, boarder_value: int | tuple[int, int, int] = 0, radius: float | Literal['auto', 'max'] = 'auto', merge: bool = False) None[source]

Apply transformer to a pair of images.

Parameters:
  • transformer (TransformerBase) – Transformer to be applied.

  • left_path (Path | str) – Left image path.

  • right_path (Path | str) – Right image path.

  • in_paths (Sequence[Path | str] | Path | str) – Input image paths.

  • out_path (Path | str) – Output image path.

  • size_output (tuple[int, int], optional) – Size of the output image, by default (2048, 2048)

  • interpolation (int, optional) – Interpolation method for opencv, by default cv.INTER_LANCZOS4

  • boarder_mode (int, optional) – Boarder mode for opencv, by default cv.BORDER_CONSTANT

  • boarder_value (int | tuple[int, int, int], optional) – Boarder value for opencv, by default 0

  • radius (float | Literal["auto", "max"], optional) – Radius of the fisheye image, by default "auto"

  • merge (bool, optional) – Whether to merge the images mainly for calibration, by default False

vr180_convert.get_map(transformer: TransformerBase, *, radius: float, size_input: tuple[int, int], size_output: tuple[int, int] = (2048, 2048)) tuple[ndarray[Any, dtype[float32]], ndarray[Any, dtype[float32]]][source]

Generate remap map.

Parameters:
  • transformer (TransformerBase) – Transformer to be applied.

  • radius (float) – Radius of the fisheye image.

  • size_input (tuple[int, int]) – Size of the input image.

  • size_output (tuple[int, int], optional) – Size of the output image, by default (2048, 2048)

Returns:

xmap and ymap.

Return type:

tuple[NDArray[np.float32], NDArray[np.float32]]

Submodules

vr180_convert.cli module

vr180_convert.cli.lr(left_path: Path, right_path: Path, transformer: str = '', out_path: Path = PosixPath('.'), size: str = '4096x4096', interpolation: _InterpolationFlags = _InterpolationFlags.INTER_LANCZOS4, border_mode: _BorderTypes = _BorderTypes.BORDER_CONSTANT, border_value: int = 0, radius: str = 'auto', merge: bool = False, autosearch_timestamp_calib_r_earlier_l: float = 0.0, swap: bool = False, name_unique: bool = False, automatch: str = '') None[source]

Remap a pair of fisheye images to a pair of SBS equirectangular images.

vr180_convert.cli.s(in_paths: list[Path], transformer: str = '', out_path: Path = PosixPath('.'), size: str = '4096x4096', interpolation: _InterpolationFlags = _InterpolationFlags.INTER_LANCZOS4, boarder_mode: _BorderTypes = _BorderTypes.BORDER_CONSTANT, boarder_value: int = 0, radius: str = 'auto') None[source]

Remap fisheye images to SBS equirectangular images.

vr180_convert.cli.swap(in_paths: list[Path]) None[source]

Swap left and right images.

vr180_convert.cli.xmp(in_paths: list[Path], wslpath: bool = False) None[source]

Add XMP metadata to the image.

vr180_convert.remapper module

vr180_convert.remapper.apply(transformer: TransformerBase, *, in_paths: Sequence[Path | str | ndarray[Any, dtype[_ScalarType_co]]] | Path | str | ndarray[Any, dtype[_ScalarType_co]], out_paths: Sequence[Path | str] | None | Path | str = None, size_output: tuple[int, int] = (2048, 2048), interpolation: int = 4, boarder_mode: int = 0, boarder_value: int | tuple[int, int, int] = 0, radius: float | Literal['auto', 'max'] = 'auto') Sequence[ndarray[Any, dtype[uint8]]][source]

Apply transformer to images.

Parameters:
  • transformer (TransformerBase) – Transformer to be applied.

  • in_paths (Sequence[Path | str] | Path | str) – Input image paths.

  • out_paths (Sequence[Path | str] | None | Path | str, optional) – Output image paths, by default None If None, do not save the images.

  • size_output (tuple[int, int], optional) – Size of the output image, by default (2048, 2048)

  • interpolation (int, optional) – Interpolation method for opencv, by default cv.INTER_LANCZOS4

  • boarder_mode (int, optional) – Boarder mode for opencv, by default cv.BORDER_CONSTANT

  • boarder_value (int | tuple[int, int, int], optional) – Boarder value for opencv, by default 0

  • radius (float | Literal["auto", "max"], optional) – Radius of the fisheye image, by default "auto"

Returns:

Images after transformation.

Return type:

Sequence[NDArray[np.uint8]]

vr180_convert.remapper.apply_lr(transformer: TransformerBase | tuple[TransformerBase, TransformerBase], *, left_path: Path | str | ndarray[Any, dtype[_ScalarType_co]], right_path: Path | str | ndarray[Any, dtype[_ScalarType_co]], out_path: Path | str, size_output: tuple[int, int] = (2048, 2048), interpolation: int = 4, boarder_mode: int = 0, boarder_value: int | tuple[int, int, int] = 0, radius: float | Literal['auto', 'max'] = 'auto', merge: bool = False) None[source]

Apply transformer to a pair of images.

Parameters:
  • transformer (TransformerBase) – Transformer to be applied.

  • left_path (Path | str) – Left image path.

  • right_path (Path | str) – Right image path.

  • in_paths (Sequence[Path | str] | Path | str) – Input image paths.

  • out_path (Path | str) – Output image path.

  • size_output (tuple[int, int], optional) – Size of the output image, by default (2048, 2048)

  • interpolation (int, optional) – Interpolation method for opencv, by default cv.INTER_LANCZOS4

  • boarder_mode (int, optional) – Boarder mode for opencv, by default cv.BORDER_CONSTANT

  • boarder_value (int | tuple[int, int, int], optional) – Boarder value for opencv, by default 0

  • radius (float | Literal["auto", "max"], optional) – Radius of the fisheye image, by default "auto"

  • merge (bool, optional) – Whether to merge the images mainly for calibration, by default False

vr180_convert.remapper.get_map(transformer: TransformerBase, *, radius: float, size_input: tuple[int, int], size_output: tuple[int, int] = (2048, 2048)) tuple[ndarray[Any, dtype[float32]], ndarray[Any, dtype[float32]]][source]

Generate remap map.

Parameters:
  • transformer (TransformerBase) – Transformer to be applied.

  • radius (float) – Radius of the fisheye image.

  • size_input (tuple[int, int]) – Size of the input image.

  • size_output (tuple[int, int], optional) – Size of the output image, by default (2048, 2048)

Returns:

xmap and ymap.

Return type:

tuple[NDArray[np.float32], NDArray[np.float32]]

vr180_convert.remapper.get_radius_smart(radius: float | Literal['auto', 'max'], images: Sequence[ndarray[Any, dtype[_ScalarType_co]]]) float[source]

Get radius smartly.

Parameters:
  • radius (float | Literal["auto", "max"]) – The strategy to get the radius.

  • images (Sequence[NDArray]) – Images to be processed.

Returns:

The radius.

Return type:

float

vr180_convert.remapper.match_lr(decoder: TransformerBase, points_l: Sequence[tuple[float, float]], points_r: Sequence[tuple[float, float]], in_paths: Sequence[Path | str], *, radius: float | Literal['auto', 'max'] = 'auto') quaternion[source]

Get the quaternion that minimizes the distance between the rotated points.

Parameters:
  • decoder (TransformerBase) – Transformer to be applied. Must implement inverse_transform().

  • points_l (tuple[tuple[float, float], ...]) – The points in the left image.

  • points_r (tuple[tuple[float, float], ...]) – The points in the right image.

  • in_paths (Sequence[Path | str]) – Input image paths.

  • radius (float | Literal["auto", "max&quot], optional) – The strategy to get the radius.

Returns:

The quaternion to be applied to the left points.

Return type:

quaternion

Raises:

ValueError – If the number of points is not the same.

vr180_convert.remapper.rotation_match(points_to_be_rotated: ndarray[Any, dtype[_ScalarType_co]], points: ndarray[Any, dtype[_ScalarType_co]]) quaternion[source]

Match the rotation of two sets of 3d points.

Parameters:
  • points_to_be_rotated (_type_) – Array of shape (…, 3)

  • points (NDArray) – Array of shape (…, 3)

Returns:

quaternion that minimizes the distance between the rotated points_to_be_rotated and points.

Return type:

quaternion

References

https://lisyarus.github.io/blog/posts/3d-shape-matching-with-quaternions.html

vr180_convert.testing module

vr180_convert.testing.generate_test_image(size: int = 2048, path: str | Path | None = None) ndarray[Any, dtype[uint8]][source]

Generate a test image.

Parameters:
  • size (int, optional) – The height and width of the image, by default 2048

  • path (str | Path | None, optional) – The path to save the image, by default None If None, the image will not be saved.

Returns:

The generated image.

Return type:

NDArray[np.uint8]

vr180_convert.transformer module

class vr180_convert.transformer.DenormalizeTransformer(scale: tuple[float, float], center: tuple[float, float])[source]

Bases: TransformerBase

Denormalize the coordinates from [-1, 1] to the original image size.

center: tuple[float, float]

The center of the image. Recommended to be the center of the result image.

inverse_transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Inverse transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

scale: tuple[float, float]

The scale of the image. Recommended to be the half of the width and height of the result image.

set_inverse_transform_request(*, x: bool | None | str = '$UNCHANGED$') DenormalizeTransformer

Request metadata passed to the inverse_transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to inverse_transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to inverse_transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in inverse_transform.

Returns:

self – The updated object.

Return type:

object

set_transform_request(*, x: bool | None | str = '$UNCHANGED$') DenormalizeTransformer

Request metadata passed to the transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in transform.

Returns:

self – The updated object.

Return type:

object

transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

vr180_convert.transformer.EquirectangularDecoder(is_latitude_y: bool = True) InverseTransformer[EquirectangularEncoder][source]

Decodes equirectangular image.

Parameters:

is_latitude_y (bool, optional) – Whether latitude is encoded in y axis, by default True

Returns:

The equirectangular decoder.

Return type:

InverseTransformer[EquirectangularEncoder]

class vr180_convert.transformer.EquirectangularEncoder(is_latitude_y: bool = True)[source]

Bases: TransformerBase

Encodes equirectangular image.

inverse_transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Inverse transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

is_latitude_y: bool

Whether latitude is encoded in y axis.

set_inverse_transform_request(*, x: bool | None | str = '$UNCHANGED$') EquirectangularEncoder

Request metadata passed to the inverse_transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to inverse_transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to inverse_transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in inverse_transform.

Returns:

self – The updated object.

Return type:

object

set_transform_request(*, x: bool | None | str = '$UNCHANGED$') EquirectangularEncoder

Request metadata passed to the transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in transform.

Returns:

self – The updated object.

Return type:

object

transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

class vr180_convert.transformer.Euclidean3DRotator(rotation: quaternion)[source]

Bases: Euclidean3DTransformer

Rotate as 3D unit vector.

inverse_transform_v(v: ndarray[Any, dtype[_ScalarType_co]]) ndarray[Any, dtype[_ScalarType_co]][source]

Inverse transform 3D unit vector.

Parameters:

v (NDArray) – The 3D unit vector. z axis is forward, x axis is right, y axis is up.

Returns:

The inverse transformed 3D unit vector. z axis is forward, x axis is right, y axis is up.

Return type:

NDArray

rotation: quaternion

The rotation quaternion.

set_inverse_transform_request(*, x: bool | None | str = '$UNCHANGED$') Euclidean3DRotator

Request metadata passed to the inverse_transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to inverse_transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to inverse_transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in inverse_transform.

Returns:

self – The updated object.

Return type:

object

set_transform_request(*, x: bool | None | str = '$UNCHANGED$') Euclidean3DRotator

Request metadata passed to the transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in transform.

Returns:

self – The updated object.

Return type:

object

transform_v(v: ndarray[Any, dtype[_ScalarType_co]]) ndarray[Any, dtype[_ScalarType_co]][source]

Transform 3D unit vector.

Parameters:

v (NDArray) – The 3D unit vector. z axis is forward, x axis is right, y axis is up.

Returns:

The transformed 3D unit vector. z axis is forward, x axis is right, y axis is up.

Return type:

NDArray

class vr180_convert.transformer.Euclidean3DTransformer[source]

Bases: TransformerBase

Transform as 3D unit vector.

inverse_transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Inverse transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

abstract inverse_transform_v(v: ndarray[Any, dtype[_ScalarType_co]]) ndarray[Any, dtype[_ScalarType_co]][source]

Inverse transform 3D unit vector.

Parameters:

v (NDArray) – The 3D unit vector. z axis is forward, x axis is right, y axis is up.

Returns:

The inverse transformed 3D unit vector. z axis is forward, x axis is right, y axis is up.

Return type:

NDArray

set_inverse_transform_request(*, x: bool | None | str = '$UNCHANGED$') Euclidean3DTransformer

Request metadata passed to the inverse_transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to inverse_transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to inverse_transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in inverse_transform.

Returns:

self – The updated object.

Return type:

object

set_transform_request(*, x: bool | None | str = '$UNCHANGED$') Euclidean3DTransformer

Request metadata passed to the transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in transform.

Returns:

self – The updated object.

Return type:

object

transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

abstract transform_v(v: ndarray[Any, dtype[_ScalarType_co]]) ndarray[Any, dtype[_ScalarType_co]][source]

Transform 3D unit vector.

Parameters:

v (NDArray) – The 3D unit vector. z axis is forward, x axis is right, y axis is up.

Returns:

The transformed 3D unit vector. z axis is forward, x axis is right, y axis is up.

Return type:

NDArray

vr180_convert.transformer.FisheyeDecoder(mapping_type: Literal['rectilinear', 'stereographic', 'equidistant', 'equisolid', 'orthographic']) InverseTransformer[FisheyeEncoder][source]

Decodes fisheye image.

Parameters:

mapping_type (Literal['rectilinear', 'stereographic', 'equidistant', 'equisolid', 'orthographic']) – The mapping type of the fisheye image.

Returns:

The fisheye decoder.

Return type:

InverseTransformer

class vr180_convert.transformer.FisheyeEncoder(mapping_type: Literal['rectilinear', 'stereographic', 'equidistant', 'equisolid', 'orthographic'])[source]

Bases: PolarRollTransformer

Encodes fisheye image.

inverse_transform_polar(theta: ndarray[Any, dtype[_ScalarType_co]], roll: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

[-pi/2, pi/2] -> [-1, 1].

mapping_type: Literal['rectilinear', 'stereographic', 'equidistant', 'equisolid', 'orthographic']

The mapping type of the fisheye image.

set_inverse_transform_request(*, x: bool | None | str = '$UNCHANGED$') FisheyeEncoder

Request metadata passed to the inverse_transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to inverse_transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to inverse_transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in inverse_transform.

Returns:

self – The updated object.

Return type:

object

set_transform_request(*, x: bool | None | str = '$UNCHANGED$') FisheyeEncoder

Request metadata passed to the transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in transform.

Returns:

self – The updated object.

Return type:

object

transform_polar(theta: ndarray[Any, dtype[_ScalarType_co]], roll: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

[-1, 1] -> [-pi/2, pi/2].

class vr180_convert.transformer.InverseTransformer(transformer: T)[source]

Bases: TransformerBase, Generic[T]

Transformer that calls inverse_transform() in transform() and vice versa.

inverse_transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Inverse transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

set_inverse_transform_request(*, x: bool | None | str = '$UNCHANGED$') InverseTransformer

Request metadata passed to the inverse_transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to inverse_transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to inverse_transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in inverse_transform.

Returns:

self – The updated object.

Return type:

object

set_transform_request(*, x: bool | None | str = '$UNCHANGED$') InverseTransformer

Request metadata passed to the transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in transform.

Returns:

self – The updated object.

Return type:

object

transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

transformer: T

The transformer to be inverted.

class vr180_convert.transformer.MultiTransformer(transformers: list[TransformerBase])[source]

Bases: TransformerBase

A transformer that applies multiple transformers in sequence.

inverse_transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Inverse transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

set_inverse_transform_request(*, x: bool | None | str = '$UNCHANGED$') MultiTransformer

Request metadata passed to the inverse_transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to inverse_transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to inverse_transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in inverse_transform.

Returns:

self – The updated object.

Return type:

object

set_transform_request(*, x: bool | None | str = '$UNCHANGED$') MultiTransformer

Request metadata passed to the transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in transform.

Returns:

self – The updated object.

Return type:

object

transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

transformers: list[TransformerBase]
class vr180_convert.transformer.NormalizeTransformer(center: tuple[float, float] | None = None, scale: tuple[float, float] | Literal['min', 'max'] | None = None)[source]

Bases: TransformerBase

Normalize the coordinates to [-1, 1].

center: tuple[float, float] | None

The center of the image. If None, the center is the center of the image.

inverse_transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Inverse transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

scale: tuple[float, float] | Literal['min', 'max'] | None

The scale of the image. If “min” or None, the scale is the minimum of the width and height. If “max”, the scale is the maximum of the width and height.

set_inverse_transform_request(*, x: bool | None | str = '$UNCHANGED$') NormalizeTransformer

Request metadata passed to the inverse_transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to inverse_transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to inverse_transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in inverse_transform.

Returns:

self – The updated object.

Return type:

object

set_transform_request(*, x: bool | None | str = '$UNCHANGED$') NormalizeTransformer

Request metadata passed to the transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in transform.

Returns:

self – The updated object.

Return type:

object

transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

class vr180_convert.transformer.PolarRollTransformer[source]

Bases: TransformerBase

Transform using polar coordinates.

inverse_transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Inverse transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

abstract inverse_transform_polar(theta: ndarray[Any, dtype[_ScalarType_co]], roll: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Inverse transform using polar coordinates.

Parameters:
  • theta (NDArray) – The distance or angle from the center (front-facing direction)

  • roll (NDArray) – The angle around the center (front-facing direction)

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

theta and roll after transformation.

Return type:

tuple[NDArray, NDArray]

set_inverse_transform_request(*, x: bool | None | str = '$UNCHANGED$') PolarRollTransformer

Request metadata passed to the inverse_transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to inverse_transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to inverse_transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in inverse_transform.

Returns:

self – The updated object.

Return type:

object

set_transform_request(*, x: bool | None | str = '$UNCHANGED$') PolarRollTransformer

Request metadata passed to the transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in transform.

Returns:

self – The updated object.

Return type:

object

transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

abstract transform_polar(theta: ndarray[Any, dtype[_ScalarType_co]], roll: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Transform using polar coordinates.

Parameters:
  • theta (NDArray) – The distance or angle from the center (front-facing direction)

  • roll (NDArray) – The angle around the center (front-facing direction)

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

theta and roll after transformation.

Return type:

tuple[NDArray, NDArray]

class vr180_convert.transformer.PolynomialScaler(coefs_reverse: Sequence[float] = [0, 1])[source]

Bases: PolarRollTransformer

Scale the polar coordinates using polynomial.

coefs_reverse: Sequence[float]

The coefficients of the polynomial in reverse order. [0, 1] means y = 0 + 1 * x.

inverse_transform_polar(theta: ndarray[Any, dtype[_ScalarType_co]], roll: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Inverse transform using polar coordinates.

Parameters:
  • theta (NDArray) – The distance or angle from the center (front-facing direction)

  • roll (NDArray) – The angle around the center (front-facing direction)

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

theta and roll after transformation.

Return type:

tuple[NDArray, NDArray]

set_inverse_transform_request(*, x: bool | None | str = '$UNCHANGED$') PolynomialScaler

Request metadata passed to the inverse_transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to inverse_transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to inverse_transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in inverse_transform.

Returns:

self – The updated object.

Return type:

object

set_transform_request(*, x: bool | None | str = '$UNCHANGED$') PolynomialScaler

Request metadata passed to the transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in transform.

Returns:

self – The updated object.

Return type:

object

transform_polar(theta: ndarray[Any, dtype[_ScalarType_co]], roll: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Transform using polar coordinates.

Parameters:
  • theta (NDArray) – The distance or angle from the center (front-facing direction)

  • roll (NDArray) – The angle around the center (front-facing direction)

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

theta and roll after transformation.

Return type:

tuple[NDArray, NDArray]

class vr180_convert.transformer.RectilinearDecoder(focal_length: float, sensor_width: Literal['35mm', 'APS-H', 'APS-C', 'APS-C-Canon', 'Foveon', 'MFT'] | str | float = '35mm')[source]

Bases: PolarRollTransformer

Encodes rectilinear image.

property factor: float

Zoom factor applied after tan.

focal_length: float

The focal length of the lens in mm.

inverse_transform_polar(theta: ndarray[Any, dtype[_ScalarType_co]], roll: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Inverse transform using polar coordinates.

Parameters:
  • theta (NDArray) – The distance or angle from the center (front-facing direction)

  • roll (NDArray) – The angle around the center (front-facing direction)

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

theta and roll after transformation.

Return type:

tuple[NDArray, NDArray]

sensor_width: Literal['35mm', 'APS-H', 'APS-C', 'APS-C-Canon', 'Foveon', 'MFT'] | str | float

The sensor width of the camera in mm if float, or in inches if str, or a standard sensor width if str.

property sensor_width_mm: float

Sensor width in mm.

set_inverse_transform_request(*, x: bool | None | str = '$UNCHANGED$') RectilinearDecoder

Request metadata passed to the inverse_transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to inverse_transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to inverse_transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in inverse_transform.

Returns:

self – The updated object.

Return type:

object

set_transform_request(*, x: bool | None | str = '$UNCHANGED$') RectilinearDecoder

Request metadata passed to the transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in transform.

Returns:

self – The updated object.

Return type:

object

transform_polar(theta: ndarray[Any, dtype[_ScalarType_co]], roll: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Transform using polar coordinates.

Parameters:
  • theta (NDArray) – The distance or angle from the center (front-facing direction)

  • roll (NDArray) – The angle around the center (front-facing direction)

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

theta and roll after transformation.

Return type:

tuple[NDArray, NDArray]

class vr180_convert.transformer.TransformerBase[source]

Bases: BaseEstimator, TransformerMixin

Base class for transformers.

abstract inverse_transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Inverse transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

set_inverse_transform_request(*, x: bool | None | str = '$UNCHANGED$') TransformerBase

Request metadata passed to the inverse_transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to inverse_transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to inverse_transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in inverse_transform.

Returns:

self – The updated object.

Return type:

object

set_transform_request(*, x: bool | None | str = '$UNCHANGED$') TransformerBase

Request metadata passed to the transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in transform.

Returns:

self – The updated object.

Return type:

object

abstract transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

class vr180_convert.transformer.ZoomTransformer(scale: float)[source]

Bases: TransformerBase

Zoom the image.

inverse_transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Inverse transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

scale: float

The zoom scale.

set_inverse_transform_request(*, x: bool | None | str = '$UNCHANGED$') ZoomTransformer

Request metadata passed to the inverse_transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to inverse_transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to inverse_transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in inverse_transform.

Returns:

self – The updated object.

Return type:

object

set_transform_request(*, x: bool | None | str = '$UNCHANGED$') ZoomTransformer

Request metadata passed to the transform method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config()). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to transform if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to transform.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Note

This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a Pipeline. Otherwise it has no effect.

Parameters:

x (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for x parameter in transform.

Returns:

self – The updated object.

Return type:

object

transform(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], **kwargs: Any) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Transform the input coordinates.

Parameters:
  • x (NDArray) – x (left-right) coordinates.

  • y (NDArray) – y (up-down) coordinates.

  • **kwargs (Any) – Any additional keyword arguments.

Returns:

x and y coordinates after transformation.

Return type:

tuple[NDArray, NDArray]

vr180_convert.transformer.equidistant_from_3d(v: ndarray[Any, dtype[_ScalarType_co]]) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Convert 3D unit vector to 2D coordinates.

Parameters:

v (NDArray) – The 3D unit vector.

Returns:

The x and y coordinates in equidistant fisheye format.

Return type:

tuple[NDArray, NDArray]

vr180_convert.transformer.equidistant_to_3d(x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]]) ndarray[Any, dtype[_ScalarType_co]][source]

Convert 2D coordinates to 3D unit vector.

z axis is forward, x axis is right, y axis is up.

Parameters:
  • x (NDArray) – The x coordinate in equidistant fisheye format.

  • y (NDArray) – The y coordinate in equidistant fisheye format.

Returns:

The 3D unit vector.

Return type:

NDArray

vr180_convert.transformer.get_radius(input: ndarray[Any, dtype[_ScalarType_co]], *, threshold: int = 10) float[source]

Estimate the radius of the circle in the image.

Parameters:
  • input (NDArray) – The input image.

  • threshold (int, optional) – The threshold to determine if a pixel is black, by default 10

Returns:

The estimated radius.

Return type:

float