bicubic interpolating zoom

Michael Thaler michael.thaler at ph.tum.de
Sun Aug 15 22:45:56 CEST 2004


Hello,

I just came back from my trip to Vienna. I read the chapters about bilinear 
interpolation and bicubic interpolation in "Numerical Recipes". Bilinear 
interpolation is actually quite easy to code and it should improve scaling of 
an image quite a lot. I won't have time tomorrow because some of my friends 
desperately wanted to play Starcraft, but I hope I can code somthing on 
tuesday. If bilinear scaling works, I will try to code bicubic scaling.

Actually I thought a lot about the whole scaling issue on my trip to Vienna. 
Enlarging an image is really not that hard and you can easily get 
anti-aliasing working. But scaling an image down is much harder. Just imagine 
to scale an image down to 25% of its original size. This means that each 4x4 
pixel block becomes a single pixel. Now there are many strategies how to do 
that: you could just average over them which would probably work nicely for 
photos. But this will fail for e.g. a page of scanned text because you would 
end up with a grey page. I think scaling images down is really hard and I 
will try to look at the Gimp's source code and try to figure out how they do 
it.

I have a simple question: in the scaling code the function (or maybe it is a 
macro) qRound is used. Where is this function documented. I could not find it 
in the Qt documentation. I need a function that always rounds down a floating 
point number (a double) to an integer, e.g. 6.8->6. Is there a Qt function to 
do that? (I know there is a function like that in libm).

Greetings,
Michael


More information about the kimageshop mailing list