Theory of Bicubic interpolation

Réponses (1)

Bruno Luong
Bruno Luong le 24 Fév 2021
Modifié(e) : Bruno Luong le 24 Fév 2021

0 votes

It has been answered here
In 2D you do in one direction followedred by another.
%%
x = [-1:2];
y = [-1:2];
[X,Y] = meshgrid(x,y);
xq = rand;
yq = rand;
Z = rand(size(X));
Zq = interp2(x,y,Z,xq,yq,'bicubic')
% Check bicubic formula
Pl = [1.5,-2.5,0,1];
Pr = [-0.5,2.5,-4,2];
cubicp = @(x) (x<=1).*polyval(Pl,x) + (x>1 & x<2).*polyval(Pr,x);
cubic = @(x) cubicp(abs(x));
Zq = 0;
[~,i0] = histc(xq,x);
[~,j0] = histc(yq,y);
for i = i0-1:i0+2
for j = j0-1:j0+2
k = sub2ind(size(Z),j,i);
Zq = Zq + cubic(X(k)-xq)*cubic(Y(k)-yq)*Z(k);
end
end
Zq

3 commentaires

Shubha B.
Shubha B. le 25 Fév 2021
where is the theory for this? how to find the coefficeients. we get here single value for Zq. Is that correct?
Bruno Luong
Bruno Luong le 25 Fév 2021
Modifié(e) : Bruno Luong le 25 Fév 2021
The theory is in the Key's paper on the reference of the document of interp1 and interp2 and in the link II provide (coeffcient in eqt 4 do you read it?).
Apparently it's free access here
Mostly coefficients are computed to provide a smooth convolution kernel and compact support.
The example I give is formula for interpolation at a singe point (xq,yq).
For more points just loop on it. No relevant if you want to understand the formula.
Shubha B.
Shubha B. le 25 Fév 2021
thank you sir.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Matrices and Arrays dans Centre d'aide et File Exchange

Question posée :

le 23 Fév 2021

Commenté :

le 25 Fév 2021

Community Treasure Hunt

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

Start Hunting!

Translated by