darsia.TranslationEstimator#
- class TranslationEstimator(max_features=200, tol=0.05, keep_percent=0.1)[source]#
Bases:
objectEstimator of translation to align images based on feature detection.
Estimation is performed by restriction to ROIs.
Setup of user-defined tuning parameters.
- Parameters:
Methods
find_effective_translation(img_src, img_dst)Find a translation aligning two images through feature matching.
match_roi(img_src, img_dst[, roi_src, ...])Align two images through feature matching in provided ROIs.
- find_effective_translation(img_src, img_dst, roi_src=None, roi_dst=None, mask_src=None, mask_dst=None, plot_matches=False)[source]#
Find a translation aligning two images through feature matching.
All lengths are in pixels.
- Parameters:
- img_src, img_dst
numpy.ndarray Source and destination images.
- roi_src, roi_dst
tupleofslices,optional Regions of interest in the source and destination images.
- mask_src, mask_dst
numpy.ndarray,optional Boolean masks of the pixels considered; None means all pixels.
- plot_matchesbool,
optional Plot the matched features (debugging). Default False.
- img_src, img_dst
- Returns:
- matrix
numpy.ndarray Transformation matrix on pixel coordinates (reverse matrix indexing).
- successbool
Whether the procedure succeeded.
- matrix
- match_roi(img_src, img_dst, roi_src=None, roi_dst=None, plot_matches=False)[source]#
Align two images through feature matching in provided ROIs.
- Parameters:
- img_src
np.ndarrayordarsia.Image Source image.
- img_dst
np.ndarrayordarsia.Image Destination image.
- roi_src
tupleofslices Region of interested associated to the source image.
- roi_dst
tupleofslices Region of interested associated to the destination image translation.
- plot_matchesbool
Flag controlling whether the matching features are plotted; useful for debugging; default value is False.
- img_src
- Returns:
np.ndarray,optionalAligned source image, if input of type array.