I would like to add interpolation to my programs, but I don't have the background in math necessary to understand the Wikipedia entries on the various methods. Has anyone else like me here found a good website for reference?
Most algorithms also interpolate in 2D when I only want to interpolate 1D scanlines to just approximately achieve the correct pixel aspect ratio. What would be the easiest method for me to implement in this respect?
I know I don't want nearest neighbor, but I think I've come up with an algorithm for it. Could someone confirm this to be correct:
In the meantime I've come up with a "common sense" algorithm which just weighs pixels against their subpixel "bias" which I split between the previous and next pixels:
Anything like conventional linear interpolation?
Most algorithms also interpolate in 2D when I only want to interpolate 1D scanlines to just approximately achieve the correct pixel aspect ratio. What would be the easiest method for me to implement in this respect?
I know I don't want nearest neighbor, but I think I've come up with an algorithm for it. Could someone confirm this to be correct:
Code:
outpixel[i] = inpixel[round(numofpixin/numofpixout*i)]
In the meantime I've come up with a "common sense" algorithm which just weighs pixels against their subpixel "bias" which I split between the previous and next pixels:
Code:
scalefactor = numofpixout / numofpixin
pixelout[i] =
(pixelin[((int)(i / scalefactor) - 1) & numofpixin] * ((i / scalefactor) % 1) / 2)) +
(pixelin[(int)(i / scalefactor) ] * (1 - ((i / scalefactor) % 1))) +
(pixelin[((int)(i / scalefactor)+ 1) & numofpixin] * ((i / scalefactor) % 1) / 2))
pixelout[i] =
(pixelin[((int)(i / scalefactor) - 1) & numofpixin] * ((i / scalefactor) % 1) / 2)) +
(pixelin[(int)(i / scalefactor) ] * (1 - ((i / scalefactor) % 1))) +
(pixelin[((int)(i / scalefactor)+ 1) & numofpixin] * ((i / scalefactor) % 1) / 2))
Anything like conventional linear interpolation?