- sunpy.image.transform.affine_transform(image, rmatrix, order=3, scale=1.0, image_center=None, recenter=False, missing=0.0, use_scipy=False)¶
Rotates, shifts and scales an image.
skimage.transform.warpunless scikit-image can’t be imported then it will use`scipy.ndimage.affine_transform`.
numpy.ndarray) – 2D image to be rotated.
numpy.ndarraythat is 2x2) – Linear transformation rotation matrix.
int0-5, optional) – Interpolation order to be used, defaults to 3. When using scikit-image this parameter is passed into
skimage.transform.warp(e.g., 3 corresponds to bi-cubic interpolation). When using scipy it is passed into
scipy.ndimage.affine_transformwhere it controls the order of the spline.
float) – A scale factor for the image with the default being no scaling.
image_center (tuple, optional) – The point in the image to rotate around (axis of rotation). Defaults to the center of the array.
float, optional) – The value to replace any missing data after the transformation.
numpy.ndarray– New rotated, scaled and translated image.
This algorithm uses an affine transformation as opposed to a polynomial geometrical transformation, which by default is
skimage.transform.warp. One can specify using
scipy.ndimage.affine_transformas an alternative affine transformation. The two transformations use different algorithms and thus do not give identical output.
skimage.transform.warpwith order >= 4 or using
scipy.ndimage.affine_transformat all, “NaN” values will be replaced with zero prior to rotation. No attempt is made to retain the “NaN” values.
Input arrays with integer data are cast to float 64 and can be re-cast using
In the case of
skimage.transform.warp, the image is normalized to [0, 1] before passing it to the function. It is later rescaled back to the original range.
Although this function is analogous to the IDL’s
rotfunction, it does not use the same algorithm as the IDL
rotcalls the POLY_2D method to calculate the inverse mapping of original to target pixel coordinates. This is a polynomial geometrical transformation. Then optionally it uses a bicubic convolution interpolation algorithm to map the original to target pixel values.