Rotate numpy 2D array(旋转 numpy 二维数组)
问题描述
我有一组灰度图像作为 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 2011-11-10 18:34 的评论:
See the comment of cgohlke Nov 10 '11 at 18:34:
考虑 scipy.ndimage.interpolation.shift() 和 rotate() 用于 2D numpy 数组的插值平移和旋转.
Consider scipy.ndimage.interpolation.shift() and rotate() for interpolated translations and rotations of 2D numpy arrays.
这篇关于旋转 numpy 二维数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:旋转 numpy 二维数组


基础教程推荐
- Dask.array.套用_沿_轴:由于额外的元素([1]),使用dask.array的每一行作为另一个函数的输入失败 2022-01-01
- 筛选NumPy数组 2022-01-01
- 如何在海运重新绘制中自定义标题和y标签 2022-01-01
- 在 Python 中,如果我在一个“with"中返回.块,文件还会关闭吗? 2022-01-01
- 何时使用 os.name、sys.platform 或 platform.system? 2022-01-01
- 使用PyInstaller后在Windows中打开可执行文件时出错 2022-01-01
- 用于分类数据的跳跃记号标签 2022-01-01
- 如何让 python 脚本监听来自另一个脚本的输入 2022-01-01
- Python kivy 入口点 inflateRest2 无法定位 libpng16-16.dll 2022-01-01
- 线程时出现 msgbox 错误,GUI 块 2022-01-01