nabu.stitching.overlap
source module nabu.stitching.overlap
Classes
-
ImageStichOverlapKernel — Stitch two images along Y (axis 0 in image space)
Functions
-
compute_image_minimum_divergence — Algorithm to improve treatment of high frequency.
-
compute_image_higher_signal — the higher signal will pick pixel on the image having the higher signal. A use case is that if there is some artefacts on images which creates stripes (from scintillator artefacts for example) it could be removed from this method
-
check_overlaps — check over frames if there is a single overlap other juxtaposed frames (at most and at least)
source enum OverlapStitchingStrategy(*args, **kwds)
Bases : Enum
Attributes
-
MEAN
-
COSINUS_WEIGHTS
-
LINEAR_WEIGHTS
-
CLOSEST
-
IMAGE_MINIMUM_DIVERGENCE
-
HIGHER_SIGNAL
source class OverlapKernelBase()
source class ImageStichOverlapKernel(stitching_axis: int, frame_unstitched_axis_size: tuple, stitching_strategy: OverlapStitchingStrategy = DEFAULT_OVERLAP_STRATEGY, overlap_size: int = DEFAULT_OVERLAP_SIZE, extra_params: Optional[dict] = None)
Bases : OverlapKernelBase
Stitch two images along Y (axis 0 in image space)
:param stitching_axis: axis along which stitching is operate. Must be in '0', '1' :param frame_unstitched_axis_size: according to the stitching axis the stitched framed will always have a constant size: * If stitching_axis == 0 then it will be the frame width * If stitching_axis == 1 then it will be the frame height :param stitching_strategy: stategy / algorithm to use in order to generate the stitching :param overlap_size: size (int) of the overlap (stitching) between the two images :param extra_params: possibly extra parameters to operate the stitching
Attributes
-
unstitched_axis : int — util function. The kernel is operating stitching on images along a single axis (
stitching_axis
). This property is returning the other axis.
Methods
-
stitch — Compute overlap region from the defined strategy
source property ImageStichOverlapKernel.stitched_axis: int
source property ImageStichOverlapKernel.unstitched_axis: int
util function. The kernel is operating stitching on images along a single axis (stitching_axis
).
This property is returning the other axis.
source property ImageStichOverlapKernel.overlap_size: int
source property ImageStichOverlapKernel.img_2: numpy.ndarray
source property ImageStichOverlapKernel.weights_img_1: Optional[numpy.ndarray]
source property ImageStichOverlapKernel.weights_img_2: Optional[numpy.ndarray]
source property ImageStichOverlapKernel.stitching_strategy: OverlapStitchingStrategy
source method ImageStichOverlapKernel.compute_weights()
Raises
-
ValueError
-
NotImplementedError
source method ImageStichOverlapKernel.stitch(img_1, img_2, check_input=True) → tuple
Compute overlap region from the defined strategy
Raises
-
ValueError
source compute_image_minimum_divergence(img_1: numpy.ndarray, img_2: numpy.ndarray, high_frequency_threshold, stitching_axis: int)
Algorithm to improve treatment of high frequency.
It split the two images into two parts: high frequency and low frequency.
The two low frequency part will be stitched using a 'sinusoidal' / cosinus weights approach. When the two high frequency parts will be stitched by taking the lower divergent pixels
Raises
-
ValueError
source compute_image_higher_signal(img_1: numpy.ndarray, img_2: numpy.ndarray)
the higher signal will pick pixel on the image having the higher signal. A use case is that if there is some artefacts on images which creates stripes (from scintillator artefacts for example) it could be removed from this method
source check_overlaps(frames: Union[tuple, numpy.ndarray], positions: tuple, axis: int, raise_error: bool)
check over frames if there is a single overlap other juxtaposed frames (at most and at least)
:param frames: liste of ordered / sorted frames along axis to test (from higher to lower) :param positions: positions of frames in 3D space as (position axis 0, position axis 1, position axis 2) :param axis: axis to check :param raise_error: if True then raise an error if two frames don't have at least and at most one overlap. Else log an error
Raises
-
TypeError
-
ValueError
-
NotImplementedError