Author Topic: Resizing images with AA in realtime?  (Read 4194 times)

0 Members and 1 Guest are viewing this topic.

Offline va!n

  • Pentium
  • *****
  • Posts: 1435
  • Karma: 109
    • View Profile
    • http://www.secretly.de
Resizing images with AA in realtime?
« on: December 18, 2008 »
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:

Offline Hezad

  • Sponsor
  • Pentium
  • *******
  • Posts: 613
  • Karma: 44
  • I believe .. in Patrick.
    • View Profile
    • Hezad.com Web hosting
Re: Resizing images with AA in realtime?
« Reply #1 on: December 18, 2008 »
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

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: Resizing images with AA in realtime?
« Reply #2 on: December 18, 2008 »
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:

Offline va!n

  • Pentium
  • *****
  • Posts: 1435
  • Karma: 109
    • View Profile
    • http://www.secretly.de
Re: Resizing images with AA in realtime?
« Reply #3 on: December 18, 2008 »
@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
« Last Edit: December 18, 2008 by va!n »
- 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:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: Resizing images with AA in realtime?
« Reply #4 on: December 18, 2008 »
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.

Quote
I 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:

Offline va!n

  • Pentium
  • *****
  • Posts: 1435
  • Karma: 109
    • View Profile
    • http://www.secretly.de
Re: Resizing images with AA in realtime?
« Reply #5 on: December 18, 2008 »
@hellfire:
also when having 400x400 and want to scale down to 100x100 for eaxmple, i have to do following, right?

Code: [Select]
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...:

Code: [Select]
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:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: Resizing images with AA in realtime?
« Reply #6 on: December 18, 2008 »
Quote
i have to do following, right?
right.

Quote
Wonder 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.
« Last Edit: December 18, 2008 by hellfire »
Challenge Trophies Won:

Offline va!n

  • Pentium
  • *****
  • Posts: 1435
  • Karma: 109
    • View Profile
    • http://www.secretly.de
Re: Resizing images with AA in realtime?
« Reply #7 on: December 19, 2008 »
@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: