Bicubic interpolation direct interpolation formula Matlab source code
65 次查看(过去 30 天)
显示 更早的评论
Can anyone help by sharing the source code of the bicubic image interpolation algorithm using/involving 'direct interpolation formula'? See the figure below?
Also, here's an incomplete (and possibly erroneous) example showing the 'direct interpolation formula' -- V(m',n'):
a = y2-y;
b = x2-x;
d1 = -a*((1-a)^2)*(-b*((1-b)^2))*img(x0,y0); %%(m-1,n-1)
d2 = (1-2*(b^2) + (b^3))*img(x0,y1); %%(m,n-1)
d3 = b*(1+b-(b^2))*img(x0,y2); %%(m+1,n-1)
d4 = -(b^2)*(1-b)*img(x0,y3); %%(m+2,n-1)
d5 = (1-2*(a^2)+(a^3))*(-b*((1-b)^2))*img(x1,y0); %%(m-1,n)
d6 = (1-2*(b^2)+(b^3))*img(x1,y1); %%(m,n)
d7 = b*(1+b-(b^2))*img(x1,y2); %%(m+1,n)
d8 = -(b^2)*(1-b)*img(x1,y3); %%(m+2,n)
d9 = a*(1+a-(a^2))*(-b*((1-b)^2))*img(x2,y0); %%(m-1,n+1)
d10 =(1-2*(b^2)+(b^3))*img(x2,y1); %%(m,n+1)
d11 = b*(1+b-(b^2))*img(x2,y2); %%(m+1,n+1)
d12 = -(b^2)*(1-b)*img(x2,y3); %%(m+2,n+1)
d13 = -(a^2)*(1-a)*(-b*((1-b)^2))*img(x3,y0); %%(m-1,n+2)
d14 =(1-2*(b^2) + (b^3))*img(x3,y1); %%(m,n+2)
d15 = b*(1+b-(b^2))*img(x3,y2); %%(m+1,n+2)
d16 = -(b^2)*(1-b)*img(x3,y3); %%(m+2,n+2)
V(m',n') = (d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10 + d11 + d12 + d13 + d14 + d15 + d16);
PS: I don't want the source code shown here: https://thilinasameera.wordpress.com/2010/12/24/digital-image-zooming-sample-codes-on-matlab/. Also, I don't want to use 'interp2' or any other shortcut.
8 个评论
Shubha B.
2021-2-23
To understand the theory concept correctly. For above written code I am not getting the theory for that.
回答(1 个)
Steven Lord
2018-6-15
Why not just use interp2? The help for the 'cubic' method states:
'cubic' - bicubic interpolation as long as the data is
uniformly spaced, otherwise the same as 'spline'
If you're not allowed to use interp2 because this is homework, tell us what's blocking you from completing the implementation and we may be able to offer guidance.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!