在Matlab的imresize函数中进行插值的算法是什么? [英] What is the algorithm used to interpolate in Matlab's imresize function?

查看:751
本文介绍了在Matlab的imresize函数中进行插值的算法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Matlab/Octave imresize()函数,该函数对给定的2D数组重新采样.我想了解imresize中使用的特定插值算法的工作原理.

I am using the Matlab/Octave imresize() function which resamples a given 2D array. I want to understand how a particular interpolation algorithm used in imresize works.

(我在Windows上使用八度)

(I am using octave on windows)

例如

A =  1 2 
     3 4

是2D数组.然后我使用命令

is a 2D array. Then I use the command

b=imresize(a,2,'linear'); 

基本上对行和列进行2倍采样.

basically upsampling row and columns by 2.

输出为

1.0000   1.3333   1.6667   2.0000
1.6667   2.0000   2.3333   2.6667
2.3333   2.6667   3.0000   3.3333
3.0000   3.3333   3.6667   4.0000

我不明白这种线性插值是如何工作的.据说使用 bi 线性插值法,但是它如何在边界填充数据,以及如何获得所得到的输出?

I don't understand how this linear interpolation is working. It is said to use bilinear interpolation, but how does it pad the data at boundaries and how does it get the output that it is getting?

第二个例子: 对于

A = 

1   2   3   4
5   6   7   8
0   1   2   3
1   2   3   4

imresize(a,1.5,'linear')如何提供以下输出?

1.00000   1.60000   2.20000   2.80000   3.40000   4.00000
3.40000   4.00000   4.60000   5.20000   5.80000   6.40000
4.00000   4.60000   5.20000   5.80000   6.40000   7.00000
1.00000   1.60000   2.20000   2.80000   3.40000   4.00000
0.40000   1.00000   1.60000   2.20000   2.80000   3.40000
1.00000   1.60000   2.20000   2.80000   3.40000   4.00000

推荐答案

如您所见,在示例中,每个角点都是原始输入值之一.

As you can see, in your example, each corner point is one of your original input values.

中间值是通过 线性插值 得出的.例如,要计算b(3,2):

  • b(1,2)b(1,1)b(1,4)之间距离的1/3.所以:

  • b(1,2) is 1/3 of the way between b(1,1) and b(1,4). So:

b(1,2) = (1/3)*b(1,4) + (2/3)*b(1,1)

  • b(4,2)b(4,1)b(4,4)之间距离的1/3.所以:

  • b(4,2) is 1/3 of the way between b(4,1) and b(4,4). So:

    b(4,2) = (1/3)*b(4,4) + (2/3)*b(4,1)
    

  • b(3,2)b(1,2)b(4,2)之间方式的2/3.所以:

  • b(3,2) is 2/3 of the way between b(1,2) and b(4,2). So:

    b(3,2) = (2/3)*b(4,2) + (1/3)*b(1,2)
    

  • 这篇关于在Matlab的imresize函数中进行插值的算法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆