Skip to content

nabu.misc.padding

source module nabu.misc.padding

Functions

  • pad_interpolate 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.

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

source pad_interpolate(im, padded_img_shape_vh, translation_vh=None, padding_mode='reflect')

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

Raises

  • ValueError

source recut(im, new_shape_vh)

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.

Returns

  • The image cutted to new_shape_vh.