pycvcam.core.Transform.inverse_transform#

Transform.inverse_transform(points, *, transpose=False, dx=False, dp=False, **kwargs)[source]#

Apply the inverse transformation to the given points using the transformation from \(\mathbb{R}^{\text{output_dim}}\) to \(\mathbb{R}^{\text{input_dim}}\).

The given points points are assumed to be with shape (…, output_dim) or (output_dim, …), depending on the value of transpose.

The output transformed_points will have shape (…, input_dim) if transpose is False, or (input_dim, …) if transpose is True.

Note

The points is converted to a numpy array of dtype=numpy.float64.

The method also computes 2 Jacobian matrices if requested:

  • dx: Jacobian of the transformed points with respect to the input points.

  • dp: Jacobian of the transformed points with respect to the parameters of the transformation.

The jacobian matrice with respect to the input points is a (…, input_dim, output_dim) matrix where:

jacobian_dx[..., 0, 0]  # ∂X_i/∂X_o -> Jacobian of the coordinates X_i with respect to the coordinates X_o.
jacobian_dx[..., 0, 1]  # ∂X_i/∂Y_o
...

jacobian_dx[..., 1, 0]  # ∂Y_i/∂X_o -> Jacobian of the coordinates Y_i with respect to the coordinates X_o.
jacobian_dx[..., 1, 1]  # ∂Y_i/∂Y_o
...

The Jacobian matrice with respect to the parameters is a (…, input_dim, n_params) matrix where:

jacobian_dp[..., 0, 0]  # ∂X_i/∂λ_1 -> Jacobian of the coordinates X_i with respect to the first parameter λ_1.
jacobian_dp[..., 0, 1]  # ∂X_i/∂λ_2
...

jacobian_dp[..., 1, 0]  # ∂Y_i/∂λ_1 -> Jacobian of the coordinates Y_i with respect to the first parameter λ_1.
jacobian_dp[..., 1, 1]  # ∂Y_i/∂λ_2
...

The Jacobian matrices are computed only if dx or dp are set to True, respectively.

The output will be a TransformResult object containing the transformed points and the Jacobian matrices if requested.

Parameters:
  • points (ArrayLike) – The input points to be transformed. Shape (…, output_dim) (or (output_dim, …) if transpose is True).

  • transpose (bool, optional) – If True, the input points are transposed to shape (output_dim, …). Default is False.

  • dx (bool, optional) – If True, compute the Jacobian of the transformed points with respect to the input points. Default is False.

  • dp (bool, optional) – If True, compute the Jacobian of the transformed points with respect to the parameters of the transformation. Default is False.

  • **kwargs – Additional keyword arguments for the transformation.

Returns:

An object containing the transformed points and the Jacobian matrices if requested.

Return type:

TransformResult

Developer Notes#

The subclasses must implement the _inverse_transform method to apply the inverse transformation to the input points.

The _inverse_transform method should:

  • take the input points as a numpy array of shape (n_points, output_dim)

  • return 3 numpy arrays:

    • transformed_points: The transformed points of shape (n_points, input_dim).

    • jacobian_dx: The Jacobian matrix with respect to the input points of shape (n_points, input_dim, output_dim) if dx is True, otherwise None.

    • jacobian_dp: The Jacobian matrix with respect to the parameters of the transformation of shape (n_points, input_dim, n_params) if dp is True, otherwise None.