Algorithm of Bicubic Interpolation

29 次查看(过去 30 天)
I am trying to recreate the matlab bicubic interpolation function in java. In matlab, I use interp2(...., 'cubic') and I am trying to write a program that does the exact same thing in java. I have basically tried to follow wikipedia's formula for it. The data that I am getting from my java program is close to matlab's, but slightly off. Does anyone know the actual formula for bicubic interpolation that is used by matlab's cubic interp2 function?

采纳的回答

Alex Taylor
Alex Taylor 2013-6-5
编辑:Alex Taylor 2013-6-5
The algorithm is described in the following reference.
% "Cubic Convolution Interpolation for Digital Image % Processing", Robert G. Keys, IEEE Trans. on Acoustics, Speech, and % Signal Processing, Vol. 29, No. 6, Dec. 1981, pp. 1153-1160.
Its convolution based interpolation. The specific cubic convolution kernel is described in terms of a piecewise equation in MATLAB code before. This will make more sense if you have access to the paper.
y = zeros(1,length(x));
reshape(y,size(x));
x(x < 0.0) = -x(x < 0.0);
q = (x <= 1); % Coefficients: 1.5, -2.5, 0.0, 1.0
y(q) = ((1.5 * x(q) - 2.5) .* x(q)) .* x(q) + 1.0;
q = (1 < x & x <= 2); % Coefficients: -0.5, 2.5, -4.0, 2.0
y(q) = ((-0.5 * x(q) + 2.5) .* x(q) - 4.0) .* x(q) + 2.0;

更多回答(2 个)

Matt J
Matt J 2013-6-5
编辑:Matt J 2013-6-5

Matt J
Matt J 2013-6-5
编辑:Matt J 2013-6-5
You can also try corroborating your/MATLAB's spline interpolation against Example1.m and Example2.m from here
It uses an entirely different approach from INTERP2, so it should be useful as an independent comparison.
  2 个评论
Alex Taylor
Alex Taylor 2013-6-5
If the data being passed to interp2 is uniformly spaced, the algorithm is bicubic interpolation based on a cubic convolution kernel, not cubic spline interpolation.
Matt J
Matt J 2013-6-5
Ah, I see. Well, the FEX file lets you choose the kernel, so you could apply it the cubic convolution kernel as an additional test as well. It wouldn't be as distinct from INTERP2 as in the case of 'spline' interpolation, but it is somewhat distinct.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Interpolation 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by