nabu.stitching.stitcher_2D module

nabu.stitching.stitcher_2D.stitch_raw_frames(frames: tuple, key_lines: tuple, overlap_kernels: ~nabu.stitching.overlap.ImageStichOverlapKernel | tuple, output_dtype: ~numpy.dtype = <class 'numpy.float32'>, check_inputs=True, raw_frames_compositions: ~nabu.stitching.frame_composition.FrameComposition | None = None, overlap_frames_compositions: ~nabu.stitching.frame_composition.FrameComposition | None = None, return_composition_cls=False, alignment: ~nabu.stitching.alignment._Alignment = 'center', pad_mode='constant', new_unstitched_axis_size: int | None = None) ndarray[source]

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

Parameters:
  • frames (tuple) – tuple of 2D numpy array. Expected to be Z up oriented at this stage

  • key_lines (tuple) – 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.

  • overlap_kernels – ZStichOverlapKernel overlap kernel to be used or a list of kernel (one per overlap). Define startegy and overlap heights

  • output_dtype (numpy.dtype) – dataset dtype. For now must be provided because flat field corrcetion change data type (numpy.float32 for now)

  • check_inputs (bool) – 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

  • raw_frames_compositions – pre computed raw frame composition. If not provided will compute them. allow providing it to speed up calculation

  • overlap_frames_compositions – pre computed stitched frame composition. If not provided will compute them. allow providing it to speed up calculation

  • return_frame_compositions (bool) – if False return simply the stitched frames. Else return a tuple with stitching frame and the dictionnary with the composition frames…

  • alignment – how to align frame if two frames have different size along the unstitched axis

  • pad_mode – how to pad data for alignment (provided to numpy.pad function)

  • 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

nabu.stitching.stitcher_2D.get_overlap_areas(upper_frame: ndarray, lower_frame: ndarray, upper_frame_key_line: int, lower_frame_key_line: int, overlap_size: int, stitching_axis: int)[source]

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:

apidoc/images/stitching/z_stitch_real_overlap.png apidoc/z_stitch_stitch_height.png