skshapes.morphing.extrinsic_deformation.ExtrinsicDeformation
- class skshapes.morphing.extrinsic_deformation.ExtrinsicDeformation(n_steps=1, kernel='gaussian', scale=0.1, normalization=None, control_points=False, solver='euler')
Bases:
BaseModel
Kernel deformation morphing algorithm.
- Parameters:
n_steps (
int
) – Number of integration steps.kernel (
Literal
['gaussian'
,'uniform'
]) – Type of kernel.scale (
int
|float
) – Scale of the kernel.normalization (
Optional
[Literal
['rows'
,'columns'
,'both'
]]) – Normalization of the kernel matrix.control_points (
bool
) – If True, the control points are the control points of the shape (accessible with shape.control_points). If False, the control points are the points of the shape. If shape.control_points is None, the control points are the points of the shape.solver (
Literal
['euler'
,'midpoint'
,'rk4'
]) – The solver to use for the integration. Can be “euler”, “midpoint” or “rk4”.
- __init__(n_steps=1, kernel='gaussian', scale=0.1, normalization=None, control_points=False, solver='euler')
Class constructor.
Methods
H
(p, q)Hamiltonian function.
K
(q0[, q1, weights0, weights1])__init__
([n_steps, kernel, scale, ...])Class constructor.
copy
()Return a copy of the model.
inital_parameter
(shape)Return the initial parameters of the model.
morph
(shape, parameter[, return_path, ...])Morph a shape using the kernel deformation algorithm.
ode_func
(t, y)ODE function.
parameter_shape
(shape)Return the shape of the parameter.
- H(p, q)
Hamiltonian function.
- Return type:
Float32[Tensor, '']
- morph(shape, parameter, return_path=False, return_regularization=False, final_time=1.0)
Morph a shape using the kernel deformation algorithm.
- Parameters:
shape (
polydata_type
) – The shape to morph.parameter (
Float32[Tensor, '_ 2']
|Float32[Tensor, '_ 3']
) – The momentum.return_path (
bool
) – True if you want to have access to the sequence of polydatas.return_regularization (
bool
) – True to have access to the regularization.final_time (
float
) – The final time of the integration. Default is 1.0, it can be set to a different value for extrapolation.
- Returns:
A named tuple containing the morphed shape, the regularization and the path if needed.
- Return type:
- ode_func(t, y)
ODE function.
- Return type:
tuple
[Float32[Tensor, '_ 2']
|Float32[Tensor, '_ 3']
,Float32[Tensor, '_ 2']
|Float32[Tensor, '_ 3']
] |tuple
[Float32[Tensor, '_ 2']
|Float32[Tensor, '_ 3']
,Float32[Tensor, '_ 2']
|Float32[Tensor, '_ 3']
,Float32[Tensor, '_ 2']
|Float32[Tensor, '_ 3']
]
- parameter_shape(shape)
Return the shape of the parameter.
- Parameters:
shape (
polydata_type
) – The shape to morph.- Returns:
The shape of the parameter.
- Return type:
tuple[int, int]