# Bicubic Image Interpolation

This topic is 4784 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Apprently it goes like this 1. Get a 4x4 grid from your original image 2. Use those 4x4 known points to calculate the coeffiencients of the 2 variable cubic equation. 3. Solve Ax^3 + By^3 + Cx^2y + Dxy^2 + ... for any new point you wish to find. How do you do Step 2? What good is knowing the entire 16 term function is Step 3 if you don't know how to find A,B,C, etc? The above is all Ive been able to find on usenet (lots of "Look at this link it'll tell you"... 404!) google, or WikiPedia has any more useful info then that.

##### Share on other sites
those a,b,c's can vary and are functions of the surrounding 16 points. lookup bezier surfaces and you'll see what they mean geometrically. it's just a weighed average of the surrounding pixels. lookup the bezier surface, and rewrite it in long form(ie without the summation symbols) and factor everything to make it nice and you got your funciton. in terms of just s and t. the corresponding coefficents are your stuff. bezier/hermite bla bla bla all names for the same thing. cubic equations they only differ in how you build them up. anyone can be transformed into anohter.

Tim

##### Share on other sites
Hi,

That might not be the answer you expect but I remember that there is a great article about bicubic interpolation on the GPU in the book GPU Gems II. You might find your answer at your local barnes and nobels.

Phil

##### Share on other sites
You will need 16 samples from image (4x4 grid), let fij be the image data.
It can look like this:

Then the value of f(a,b) is:
f(a,b) = SUM(i,j=0..3){ci(a) * cj(b) * fij}

where ci are cubic polynomial functions and a, b are coordinates of pixel you want to calculate. Both are in range (0..1).

For example you can use B-spline function to get B-spline interpolation. For B-spline the polynomials are:
c0(t) = 1/6 * (1 - t)3c1(t) = 1/6 * (3t3 - 6t2 + 4)c2(t) = 1/6 * (-3t3 + 3t2 + 3t + 1)c3(t) = 1/6 * t3

HTH

##### Share on other sites
You can also click here and go to the convolutions tutorial (in left)... it explains this kind of stuff.

##### Share on other sites
Quote:
 those a,b,c's can vary and are functions of the surrounding 16 points.

Actually, the coefficients are fixed. You just plug the 16 values into a formula, and out comes the result. It's most easily expressed as two separable 1D formulas.

I have a simple article with code on my page (and it's not a 404 :-)

##### Share on other sites
I was assuming he wanted something of the form where just s and t are the variables. that is a cubic equation in terms of s and t and some constants, sorry if I confused.

one thing that I find interesting is how good the results are for this. considering cubics don't interpolate their control points, it's just interesting to me at least, how nice it looks.

Tim

##### Share on other sites
Sorry if I wasn't clear. I know the coefficients depended on the original points. But I figured somewhere there would be equations to determine them the original points.

Anyway. I tried b2b3's solution. And it mostly works, except at any boundry. It creates weird shapes on the edges. B-Splines don't actually go through the control points, just near by, right?

##### Share on other sites
these cubics only interpolate the corners. (interpolates = go through)

that is it only goes through the X's

XYYX
YYYY
YYYY
XYYX

Tim

##### Share on other sites
I used to loves Aramini's technique a lot. While it is not a real bicubic interpolation (it interpolates along 2 bicubic splines, while a true bicubic will interpolate along a bicubic patch) it gives very good results. The spline parameter 'a' can be changed to whatever value you want (it haves to be in the [-1,0] range). A good 'a' value may gives you better, sharper results than Photoshop's bicubic magnification. Moreover, it is rather easy to code a simple, non-optimized version. I believe it is worth a try.

Regards,

1. 1
Rutin
40
2. 2
3. 3
4. 4
5. 5

• 18
• 20
• 12
• 14
• 9
• ### Forum Statistics

• Total Topics
633363
• Total Posts
3011514
• ### Who's Online (See full list)

There are no registered users currently online

×