images_alignment.utils module
Utilities functions or Classes
- class images_alignment.utils.Terminal
Bases:
object
Class to ‘write’ into the console
- write(message)
Write message into the console
- images_alignment.utils.fnames_multiframes(fname)
Return/create fnames in the TMP_DIR if the .tif has multiple frames
- images_alignment.utils.gray_conversion(img)
Convert RGBA or RGB image to gray image
- images_alignment.utils.rescaling_factor(imgs, max_size)
Return a ‘global’ rescaling factor satisfying ‘max_size’
- images_alignment.utils.rescaling_factors(imgs, max_size)
Return the rescaling factors satisfying max_size for both item of imgs
- images_alignment.utils.imgs_rescaling(imgs, max_size)
Rescale images according to ‘max_size’
- images_alignment.utils.imgs_conversion(imgs)
Uniformize the number of dimension/channels (for images composition)
- images_alignment.utils.image_normalization(img)
Normalize image in range [0., 1.]
- images_alignment.utils.absolute_threshold(img, relative_threshold)
Return the absolute threshold to use when binarizing a ‘img’
- images_alignment.utils.resizing(img1, img2)
Resize the images to have similar shape (requested for pyStackReg)
- images_alignment.utils.cropping(img, area, verbosity=True)
Return cropped image according to the given area
- images_alignment.utils.padding(img1, img2)
Add image padding
- class images_alignment.utils.TranslationTransform
Bases:
ProjectiveTransform
- estimate(src, dst)
Estimate the transformation from a set of corresponding points
- inverse()
Return the inverse translation.
- images_alignment.utils.sift(img1, img2, model_class=None)
SIFT feature detection and descriptor extraction
- Parameters:
img1, img2 (numpy.ndarray((m, n)), numpy.ndarray((p, q))) – The input images
model_class (Objet) – ‘model_class’ used by RANSAC. If None, consider
AffineTransform
from skimage.transform.
- Returns:
tmat (numpy.ndarrays((3, 3))) – The related transformation matrix
points (list of 2 numpy.ndarray((n, 2)) – Keypoints coordinates as (row, col) related to the 2 input images.
- images_alignment.utils.concatenate_images(img1, img2, alignment='horizontal')
concatenate img1 and img2
- Parameters:
img1 ((m, n [, 3]) array) – First grayscale or color image.
img2 ((p, q [, 3]) array) – Second grayscale or color image.
alignment ({‘horizontal’, ‘vertical’}, optional) – Whether to show images side by side,
'horizontal'
, or one above the other,'vertical'
.
- images_alignment.utils.rescaling(img, rfac=0.25)
Return image with the rescaling_factor applied in the 2 dimensions