webbpsf_ext.image_manip.cv_shift

webbpsf_ext.image_manip.cv_shift(image, xshift, yshift, pad=False, cval=0.0, interp='lanczos', **kwargs)[source]

Use OpenCV library for image shifting

Requires opencv-python package. Produces fewer artifacts that fourier_imshift. Faster than fshift.

Parameters:
  • image (ndarray) – 2D image or 3D image cube [nz,ny,nx].

  • xshift (float) – Number of pixels to shift image in the x direction

  • yshift (float) – Number of pixels to shift image in the y direction

  • pad (bool) – Should we pad the array before shifting, then truncate? Otherwise, the image is wrapped.

  • cval (sequence or float, optional) – The values to set the padded values for each axis. Default is 0. ((before_1, after_1), … (before_N, after_N)) unique pad constants for each axis. ((before, after),) yields same before and after constants for each axis. (constant,) or int is a shortcut for before = after = constant for all axes.

  • interp (str) – Type of interpolation to use during the sub-pixel shift. Valid values are ‘linear’, ‘cubic’, and ‘lanczos’.

Returns:

ndarray – Shifted image