nabu.stitching.stitcher_2D
source module nabu.stitching.stitcher_2D
Functions
-
stitch_raw_frames — stitches raw frames (already shifted and flat fielded !!!) together using raw stitching (no pixel interpolation, y_overlap_in_px is expected to be a int). Sttiching depends on the kernel used.
-
get_overlap_areas — return the requested area from lower_frame and upper_frame.
source stitch_raw_frames(frames: tuple, key_lines: tuple, overlap_kernels: Union[ImageStichOverlapKernel, tuple], output_dtype: numpy.dtype = numpy.float32, check_inputs=True, raw_frames_compositions: Optional[FrameComposition] = None, overlap_frames_compositions: Optional[FrameComposition] = None, return_composition_cls=False, alignment: _Alignment = 'center', pad_mode='constant', new_unstitched_axis_size: Optional[int] = None) → numpy.ndarray
stitches raw frames (already shifted and flat fielded !!!) together using raw stitching (no pixel interpolation, y_overlap_in_px is expected to be a int). Sttiching depends on the kernel used.
It can be done:
-
vertically:
X
------------------------------------------------------------------> | -------------- | | | | | Frame 1 | -------------- | | | | Frame 1 | | -------------- | | Y | --> stitching --> |~ stitching ~| | -------------- | | | | | | Frame 2 | | | Frame 2 | -------------- | | | | -------------- \/
-
horizontally:
------------------------------------------------------------------>
| -------------- -------------- -----------------------
| | | | | | ~ ~ |
Y | | Frame 1 | | Frame 2 | --> stitching --> | Frame 1 ~ ~ Frame 2 |
| | | | | | ~ ~ |
| -------------- -------------- -----------------------
|
\/
returns stitched_projection, raw_img_1, raw_img_2, computed_overlap proj_0 and pro_1 are already expected to be in a row. Having stitching_height_in_px in common. At top of proj_0 and at bottom of proj_1
:param tuple frames: tuple of 2D numpy array. Expected to be Z up oriented at this stage :param tuple key_lines: for each jonction define the two lines to overlaid (from the upper and the lower frames). In the reference where 0 is the bottom line of the image. :param overlap_kernels: ZStichOverlapKernel overlap kernel to be used or a list of kernel (one per overlap). Define startegy and overlap heights :param numpy.dtype output_dtype: dataset dtype. For now must be provided because flat field corrcetion change data type (numpy.float32 for now) :param bool check_inputs: if True will do more test on inputs parameters like checking frame shapes, coherence of the request.. As it can be time consuming it is optional :param raw_frames_compositions: pre computed raw frame composition. If not provided will compute them. allow providing it to speed up calculation :param overlap_frames_compositions: pre computed stitched frame composition. If not provided will compute them. allow providing it to speed up calculation :param bool return_frame_compositions: if False return simply the stitched frames. Else return a tuple with stitching frame and the dictionnary with the composition frames... :param alignment: how to align frame if two frames have different size along the unstitched axis :param pad_mode: how to pad data for alignment (provided to numpy.pad function) :param new_unstitched_axis_size: size of the image along the axis not stitched. So it will be the frame width if the stitching axis is 0 and the frame height if the stitching axis is 1
Raises
-
ValueError
-
TypeError
source get_overlap_areas(upper_frame: numpy.ndarray, lower_frame: numpy.ndarray, upper_frame_key_line: int, lower_frame_key_line: int, overlap_size: int, stitching_axis: int)
return the requested area from lower_frame and upper_frame.
Lower_frame contains at the end of it the 'real overlap' with the upper_frame. Upper_frame contains the 'real overlap' at the end of it.
For some reason the user can ask the stitching height to be smaller than the real overlap
.
Here are some drawing to have a better of view of those regions:
.. image:: images/stitching/z_stitch_real_overlap.png :width: 600
.. image:: z_stitch_stitch_height.png :width: 600
Raises
-
ValueError
-
RuntimeError
-
TypeError
-
NotImplementedError