nabu.misc.padding module

nabu.misc.padding.pad_interpolate(im, padded_img_shape_vh, translation_vh=None, padding_mode='reflect')[source]

This function produces a centered padded image and , optionally if translation_vh is set, performs a Fourier shift of the whole image. In case of translation, the image is first padded to a larger extent, that encompasses the final padded with plus a translation margin, and then translated, and final recut to the required padded width. The values are translated: if a feature appear at x in the original image it will appear at pad+translation+x in the final image.

Parameters:
  • im (np.ndaray) – the input image

  • translation_vh (a sequence of two float) – the vertical and horizontal shifts

nabu.misc.padding.recut(im, new_shape_vh)[source]

This method implements a centered cut which reverts the centered padding applied in the present class.

Parameters:
  • im (np.ndarray) – A 2D image.

  • new_shape_vh (tuple) – The shape of the cutted image.

Return type:

The image cutted to new_shape_vh.