Shift argument in scipy.ndimage.shift

Viewed 44

Imagine I have a 3D image in a np array. I want to shift it along x-axis, y-axis and z-axis...

What does shift represent in the function scipy.ndimage.shift? Is it a float representing a ratio? Is it the number of pixels to be shifted?

If shift=[0.5, 0, 0] is the image being shifted in the x-axis by how much?

1 Answers

Okay, I've found the answer. shift corresponds to the number of pixels being shifted.

Example 1: Imagine we have an image of shape (x, y, z), if shift=[24, 0, 0] then the image is shifted by 24 pixel in the x-axis.

Example 2: Imagine we have an image of shape (y, z, x), if shift=[0, 12, 0] then the image is shifted by 12 pixel in the z-axis.

Important: If shift is an int then no interpolation is performed, but if shit is float the image is interpolated.

Related