pycvcam.Transform.inverse_transform#

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

Apply the inverse transformation to the given points, mapping output space back to input space.

The input points are assumed to have shape (..., output_dim) or (output_dim, ...), depending on the transpose flag.

The output points will have shape (..., input_dim) if transpose=False, or (input_dim, ...) if transpose=True.

Note

The input points are automatically converted to a NumPy array of type float64.

Parameters:
  • points (ArrayLike) – Input points to be inverse-transformed. Shape (..., output_dim) or (output_dim, ...) if transpose=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 with respect to the input points. Default is False.

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

  • **kwargs – Additional arguments passed to the underlying _inverse_transform method.

Returns:

Contains the inverse-transformed points and the Jacobian matrices (if requested).

Return type:

TransformResult

Jacobians#

Two Jacobian matrices can optionally be computed:

  • dx: Jacobian of the inverse-transformed points with respect to the input points. Shape: (..., input_dim, output_dim) Example:

    jacobian_dx[..., 0, 0]  # ∂X_i/∂X_o
    jacobian_dx[..., 0, 1]  # ∂X_i/∂Y_o
    jacobian_dx[..., 1, 0]  # ∂Y_i/∂X_o
    jacobian_dx[..., 1, 1]  # ∂Y_i/∂Y_o
    
  • dp: Jacobian of the inverse-transformed points with respect to the transformation parameters. Shape: (..., input_dim, n_params) Example:

    jacobian_dp[..., 0, 0]  # ∂X_i/∂λ_1
    jacobian_dp[..., 0, 1]  # ∂X_i/∂λ_2
    jacobian_dp[..., 1, 0]  # ∂Y_i/∂λ_1
    jacobian_dp[..., 1, 1]  # ∂Y_i/∂λ_2
    

The Jacobians are only computed if dx or dp are True.

Developer Notes#

Subclasses must implement the _inverse_transform method. This method should:

  1. Accept a NumPy array of shape (n_points, output_dim).

  2. Return three arrays:

    • transformed_points: shape (n_points, input_dim).

    • jacobian_dx: shape (n_points, input_dim, output_dim) if dx=True, else None.

    • jacobian_dp: shape (n_points, input_dim, n_params) if dp=True, else None.