def _rotate_interp_builtin(array, alpha, center, mode='constant', cval=0):
'''
Rotation with the built-in rotation function.
The center of rotation is exactly ((dimx-1) / 2, (dimy-1) / 2),
whatever the odd/even-ity of the image dimensions
'''
alpha_rad = -np.deg2rad(alpha)
# center of rotation: ((dims[1]-1) / 2, (dims[0]-1) / 2)
rotated = ndimage.interpolation.rotate(array, np.rad2deg(-alpha_rad), reshape=False, order=3, mode=mode, cval=cval)
return rotated
评论列表
文章目录