python - 为什么 skimage 旋转函数接收插值方法作为参数?

标签 python rotation scikit-image

使用skimage rotate函数我注意到它有一个可选的插值(顺序)参数但我不明白为什么。
文档没有说明它是如何使用的,我认为旋转图像以简单的索引移位结束。
这是一张图片,使用双线插值和神经网络插值旋转了 30 度,我当然无法说出区别。
enter image description here enter image description here

最佳答案

要将图像旋转角度 theta,需要将每个像素 P = (x, y) 映射到新点 P' = (x', y')。 P 如何映射到 P' 取决于旋转轴以及 theta 的单位是度数还是弧度,但它会类似于:

  • x' = x * cos(theta) - y * sin(theta)
  • y'= x * sin(theta) + y * cos(theta)

问题是这会导致非整数值,这就是插值的用武之地。 要填充旋转图像中的像素(x,y),需要使用原始图像的非整数坐标的像素,插值使用附近的点来近似该非整数点。

关于python - 为什么 skimage 旋转函数接收插值方法作为参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53196267/

相关文章:

php - 在 ubuntu :error The 'awsebcli==3.10.0' distribution was not found and is required by the application 安装 AWS elasticbeanstalk 命令行工具

python - 为什么在两个列表之间使用 "and"会给出第二个列表(而不是错误)?

r - 10 行 block 中 p 值的循环改组

rotation - 如何在 Unity 4.3 中旋转 Sprite ?

python - 禁用 slider 中的箭头键

python - 如何在 Pandas DataFrame 中存储具有单个顶点和每行轮廓数的 scikit 图像轮廓

python - 查找图像中颜色方 block 的轮廓和中点

python - 如何在pygame中处理移动对象而不必不断重绘背景

python - 在Python中将一系列颜色更改为白色

opencv - 图像 3D 旋转 OpenCV