I have a program that does scaling and rotation on images, the algorithm works like this:
(pseudocode)
for (x, y) in dest
ox, oy = transform(x, y)
dest[x,y] = src[ox, oy]
I decided to implement bilinear interpolation to get better results, but I don't know how to get the four known points around x,y after the transformation.
I tried to do this:
(pseudocode)
for (x, y) in dest
ox, oy = transform(x, y)
dest[x,y] = (src[ox, oy] + src[ox + 1, oy] +
src[ox, oy + 1] + src[ox + 1, oy + 1])/4
Which gives an interpolated look, but the the pixels are still pretty sharp. By doing the same thing with 16 pixels (trying to implement bicubic) the result is even worse, a image with sharp pixels and really blurry at the same time
The final result is 512x512 (dest), but looks like it was intepolated when still 32x32 (src) and then scaled using nearest neighbour. What I'm doing wrong?