旋转numpy的二维数组 [英] Rotate numpy 2D array
问题描述
我有一组灰度图像作为2D numpy的数组。
I have a set of greyscale images as a 2D numpy arrays.
我需要围绕不同,浮动角中的一个点(在他们里面)的图像。旋转并不需要在地方,我将让(当然,如果我解释好到目前为止)进行插补。
I need to rotate the images about one point (inside them) of different, float angles. The rotation doesn't need to be in place, and I will allow (of course, if I explained well so far) for interpolation.
我想留在numpy的,因为我需要对结果进行数值运算,但我也能(如果那是不可能的)允许进/出一步;例如,我试着用PIL,即Image.rotate(THETA),但不知道如何适用于我的阵列,以及如何获得一个数组回来。
I'd like to remain in numpy, as I need to perform numerical operations on the result, but I can also (if that's impossible) allow for step in/out; for example I tried using PIL, namely Image.rotate(theta) but don't understand how to apply that to my arrays, and how to get an array back.
感谢您的输入。
推荐答案
请参阅cgohlke的11月10日'11评论在18:34:
See the comment of cgohlke Nov 10 '11 at 18:34:
scipy.ndimage.interpolation 一> .shift()和旋转()用于2D numpy的阵列插值平移和旋转。
Consider scipy.ndimage.interpolation.shift() and rotate() for interpolated translations and rotations of 2D numpy arrays.
这篇关于旋转numpy的二维数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!