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 thetransposeflag.The output points will have shape
(..., input_dim)iftranspose=False, or(input_dim, ...)iftranspose=True.Note
The input
pointsare automatically converted to a NumPy array of typefloat64.- Parameters:
points (ArrayLike) – Input points to be inverse-transformed. Shape
(..., output_dim)or(output_dim, ...)iftranspose=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_transformmethod.
- Returns:
Contains the inverse-transformed points and the Jacobian matrices (if requested).
- Return type:
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
dxordpare True.Developer Notes#
Subclasses must implement the
_inverse_transformmethod. This method should:Accept a NumPy array of shape
(n_points, output_dim).Return three arrays:
transformed_points: shape(n_points, input_dim).jacobian_dx: shape(n_points, input_dim, output_dim)ifdx=True, else None.jacobian_dp: shape(n_points, input_dim, n_params)ifdp=True, else None.