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.
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 withset_parameters.is_lockedandlocked_message(properties): a transformation owned by another object of the package (e.g. the transformation of apysdic.ReparametrizedTransformation) is locked by its owner: setting its parameters raises aRuntimeErrorexplaining why, unlessset_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 apysdic.TransformationResultcontaining transformed points and associated Jacobians.invert: Applies the inverse map \(T^{-1}\). Returns apysdic.TransformationResultcontaining 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: whetherinvertis a left and/or right inverse ofapply.
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.
such that the transformation is expressed with the new parameters \(\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 apysdic.ParametrizationResultcontaining transformed parameters and associated Jacobians.decode: Applies the decoding map \(P^{-1}\). Returns apysdic.ParametrizationResultcontaining 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: whetherdecodeis a left and/or right inverse ofencode.
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 @ T1is equivalent toComposedTransformation([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 @ P1is equivalent toComposedParametrization([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}))\).