eolearn.coregistration.coregistration
This module implements the co-registration transformers.
- class eolearn.coregistration.coregistration.ECCRegistrationTask(registration_feature, reference_feature, channel, valid_mask_feature=None, apply_to_features=Ellipsis, interpolation_mode=1, warp_mode=0, max_iter=100, gauss_kernel_size=1, border_mode=1, border_value=0, num_threads=1, max_translation=5.0)[source]
Bases:
EOTask
Multi-temporal image co-registration using OpenCV Enhanced Cross-Correlation method
The task uses a temporal stack of images of the same location (i.e. a temporal-spatial feature in EOPatch) and a reference timeless feature to estimate a transformation that aligns each frame of the temporal stack to the reference feature.
Each transformation is calculated using only a single channel of the images. If feature which contains masks of valid pixels is specified it is used during the estimation of the transformation. The estimated transformations are applied to each of the specified features.
- Parameters:
registration_feature (Feature) – Feature in EOPatch holding the multi-temporal stack to register to the reference. Needs to be of FeatureType.DATA.
reference_feature (Feature) – Feature in EOPatch used as reference frame for registration.
channel (int) – Defines the index of the stack and reference feature to use during registration.
valid_mask_feature (Feature | None) – Optional feature in EOPatch that defines which pixels should be used for registration.
apply_to_features (FeaturesSpecification) – List of temporal features in EOPatch to which applied the estimated transformation.
interpolation_mode (int) – Interpolation type used when transforming the stack of images.
warp_mode (int) – Defines the transformation model used to match the stack and the reference. Examples include TRANSLATION, RIGID_MOTION, AFFINE.
max_iter (int) – Maximum number of iterations used during optimization of algorithm.
gauss_kernel_size (int) – Size of Gaussian kernel used to smooth images prior to registration.
border_mode (int) – Defines the padding strategy when transforming the images with estimated transformation.
border_value (float) – Value used for padding when border mode is set to CONSTANT.
num_threads (int) – Number of threads used for optimization of the algorithm.
max_translation (float) – Estimated transformations are considered incorrect when the norm of the translation component is larger than this parameter.
- register(src, trg, valid_mask=None, warp_mode=0)[source]
Method that estimates the transformation between source and target image
- Parameters:
src (ndarray) –
trg (ndarray) –
valid_mask (ndarray | None) –
warp_mode (int) –
- Return type:
ndarray
- warp(img, warp_matrix, shape, flags)[source]
Transform the target image with the estimated transformation matrix
- Parameters:
img (ndarray) –
warp_matrix (ndarray) –
shape (tuple[int, int]) –
flags (int) –
- Return type:
ndarray