• Welcome to Dark Bit Factory & Gravity.
 

Resizing images with AA in realtime?

Started by va!n, December 18, 2008

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

va!n

is there any way to resize an image (for example 800x600) down to 200x150 where the resized image looks smooth (like AA) in realtime? I saw that there are different algos for doing this. What about Bicubic or does someone has another faster way for doing this?) thx.
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

Hezad

imho, even with a simple box filter, the reduction would smooth the image anyway :)

I don't have any idea about the real-time consideration though :S
Music + Coding :
http://Hezad.no-ip.org

Hosting / Hébergement :
www.hezad.com

benny!

Have a look at this video which explains a very clever
algo:

http://www.youtube.com/watch?v=qadw0BRKeMk
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

va!n

#3
@benny:
thanks! i know this video and its really awesome!
I am just searching for a fast source that i can use ;)


The document has been removed or still no longer exist... mhhh..
http://www.faculty.idc.ac.il/arik/SCWeb/imret/index.html
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

hellfire

Which filter is "best" for you depends very much on your input-material and what you want to achieve.
Since you're oversampling and using some sort of lowpass-filter you'll inevitably get something "smooth (like AA)".
However, digital filter-design is a large field and requires some serious knowledge of signal processing.
So just do what Hezad said and try a simple box-filter first.

QuoteI am just searching for a fast source that i can use
I'm sure you won't need a source to add 4x4 numbers...
Challenge Trophies Won:

va!n

@hellfire:
also when having 400x400 and want to scale down to 100x100 for eaxmple, i have to do following, right?


A B C D x x x x x x
E F G H x x x x x x
I J K L x x x x x x
M N O P x x x x x x
x x x x x x x x x x
x x x x x x x x x x


each char is representing one pixel (RGB)... to resize it down with something like AA, the math would be...:


newpixel = (( A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P ) / 16 )


Btw, i think i have to do this for each R G B channel ^^
Instead using Div16 i could speed it up by using shift >>4...  Wonder if this would be really be fast enought... i will try this out...
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

hellfire

#6
Quotei have to do following, right?
right.

QuoteWonder if this would be really be fast enought
You're reading each pixel of your input-image exactly once and do a single addition (okay, and some bit-fiddling to extract rgb). Can't get much cheaper than that...
If you really need it to be faster, I probably have some mmx-stuff somehwere to do it.

However, if you're processing rather high-resolution images in software, it was very likely a lot of more work to generate the image than to downscale it; you also might want to consider if you can't generate the image in a way that does not (or less) require downsampling.
Challenge Trophies Won:

va!n

@hellfire:
thanks for your offer... i managed it to get it work with a good looking result i think and the speed it ok for the stuff where i need it for ;)
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won: