Bicubic interpolation direct interpolation formula Matlab source code

65 Ansichten (letzte 30 Tage)
Gobert
Gobert am 15 Jun. 2018
Kommentiert: Rik am 23 Feb. 2021
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 Kommentare
Shubha B.
Shubha B. am 23 Feb. 2021
To understand the theory concept correctly. For above written code I am not getting the theory for that.
Rik
Rik am 23 Feb. 2021
If your main point is understanding the theory, does the exact implementation matter?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Steven Lord
Steven Lord am 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.
  1 Kommentar
Gobert
Gobert am 15 Jun. 2018
I didn't want to use 'interp2' or any other short-cut. What is intriguing to me is simply the 'geometric transformation' that will enable accessing (x0, y0), etc., at the edges of an image, without generating errors (even if it requires padding that image, first).

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Interpolation finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by