Bicubic interpolation direct interpolation formula Matlab source code
Show older comments
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 Comments
"Also, I don't want to use 'interp2' or any other shortcut."
Inbuilt functions are not "shortcuts", they are just well tested versions of algorithms. A general rule in programming is to not write code that has already been written, so what is your need to avoid using interp2 ?
The better we can understand exactly what you are trying to achieve, the better the advice you will get.
Gobert
on 18 Jun 2018
Shubha B.
on 11 Feb 2021
Robert Sir, Have you corrected the bicubic code sir, if you corrected can you send the corrected code.
Rik
on 19 Feb 2021
The same question can be asked to you: why do you want to avoid interp2?
Shubha B.
on 23 Feb 2021
To understand the theory concept correctly. For above written code I am not getting the theory for that.
Rik
on 23 Feb 2021
If your main point is understanding the theory, does the exact implementation matter?
Answers (1)
Steven Lord
on 15 Jun 2018
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.
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!