Morphisms (Transformations + Parametrizations)#

A transformation is a mathematical operation that maps points from one space \(\mathbb{R}^{n_i}\) to another space \(\mathbb{R}^{n_o}\). In the context of Stereo Digital Image Correlation (SDIC), transformations are used to describe the relationship between 3D coordinates in the physical space and their corresponding 2D coordinates in the image space.

Transformations#

All transformation models derive from the abstract base class pysdic.Transformation, which defines a common interface for applying and inverting transformations.

\[\vec{x_o} = T(\vec{x_i}; \vec{p}) \quad \vec{x_i} \in \mathbb{R}^{n_i}, \vec{x_o} \in \mathbb{R}^{n_o}, \vec{p} \in \mathbb{R}^{n_p}\]
  • Transformation: Abstract base class for all transformations in pysdic.

  • TransformationResult: Data class for storing the results of applying or inverting a transformation, including transformed points and Jacobians.

  • IdentityTransformation: A transformation that maps input points to output points without any change (or the canonical projection or embedding if \(n_i \neq n_o\)).

Each transformation \(T\) defines a consistent interface composed of:

Parameters

  • parameters (property): Optimisable parameters \(\vec{p}\) of the transformation. Jacobians are computed with respect to these parameters. They are set with the property or with set_parameters.

  • is_locked and locked_message (properties): a transformation owned by another object of the package (e.g. the transformation of a pysdic.ReparametrizedTransformation) is locked by its owner: setting its parameters raises a RuntimeError explaining why, unless set_parameters(..., override_lock=True). There is no public method to lock or unlock a transformation, and a copy (copy) is always unlocked (see Core Tools).

Core methods

  • apply: Applies the transformation \(T\) to input points. Returns a pysdic.TransformationResult containing transformed points and associated Jacobians.

  • invert: Applies the inverse map \(T^{-1}\). Returns a pysdic.TransformationResult containing inverse-mapped points and corresponding Jacobians.

Capability flags

  • has_apply, has_apply_dx, has_apply_dp, has_invert, has_invert_dx, has_invert_dp: whether the methods and their Jacobians are available.

  • is_left_invertible, is_right_invertible, is_invertible: whether invert is a left and/or right inverse of apply.

The Jacobians and the inverse map can be verified numerically with the check_* methods.

Parametrizations#

Parametrizations allow to change the parametric representation of the parameters of a transformation, without changing the underlying transformation itself.

\[\vec{p_o} = P(\vec{p_i}) \quad \vec{p_i} \in \mathbb{R}^{n_i}, \vec{p_o} \in \mathbb{R}^{n_o}\]

such that the transformation is expressed with the new parameters \(\vec{p_i}\):

\[\tilde{T}(\vec{x_i}; \vec{p_i}) = T(\vec{x_i}; P(\vec{p_i}))\]
  • Parametrization: Abstract base class for all parametrizations in pysdic.

  • ParametrizationResult: Data class for storing the results of encoding or decoding parameters, including transformed parameters and Jacobians.

Each parametrization \(P\) defines a consistent interface composed of:

Core methods

  • encode: Applies the parametrization \(P\) to input parameters. Returns a pysdic.ParametrizationResult containing transformed parameters and associated Jacobians.

  • decode: Applies the decoding map \(P^{-1}\). Returns a pysdic.ParametrizationResult containing inverse-mapped parameters and corresponding Jacobians.

Capability flags

  • has_encode, has_encode_dp, has_decode, has_decode_dp: whether the methods and their Jacobians are available.

  • is_left_invertible, is_right_invertible, is_invertible: whether decode is a left and/or right inverse of encode.

Composing transformations and parametrizations#

To facilitate the construction of complex transformation models, the package provides classes for:

  • ComposedTransformation: Composing multiple transformations \([T_1, T_2, \dots, T_k]\) into a single transformation \(T = T_k \circ \dots \circ T_2 \circ T_1\) (\(T_1\) is applied first). The syntax T2 @ T1 is equivalent to ComposedTransformation([T1, T2]).

  • ComposedParametrization: Composing multiple parametrizations \([P_1, P_2, \dots, P_k]\) into a single parametrization \(P = P_k \circ \dots \circ P_2 \circ P_1\) (\(P_1\) is applied first). The syntax P2 @ P1 is equivalent to ComposedParametrization([P1, P2]).

  • ReparametrizedTransformation: Applying a parametrization to the parameters of a transformation \(\tilde{T}(\vec{x_i}; \vec{q}) = T(\vec{x_i}; P(\vec{q}))\).