Bilinear interpolation uses a very small 4 pixel neighborhood to interpolate.
My experience is that it works pretty good at upscaling -- maybe not so good
at downscaling. Other interpolation methods work better at down scaling because
they use a larger neighborhood. Bicubic; Lanczos etc. use a 16 pixel
neighborhood and they do better at downscaling because they take a weighted
average over a larger neighborhood.
Automatically forcing multiple interpolations might not be the best thing
to do on all images. Like for example, what if the dimensions of the image
are both prime numbers. Or what if the image is really wide and not very
high -- like a 360 degree panorama? How do you automatically apply a multi-step
downscaling interpolation?
No API can be made flexible and smart enough to
handle all possible situations. That's why programmers still have jobs.
Jim Graham wrote:
[I sent this out a few days ago, but replied to the wrong address so I
don't believe it went through - sending again...jim]
The Bilinear filtering algorithm is a well known algorithm that has a
very specific definition which we follow. If we automatically applied
multiple steps based on the scaling factor then we would violate that
definition and have to call it something else.
On a more practical note, if someone has determined that the caveats of
the bilinear algorithm are sufficient for their needs and we did perform
multiple steps instead of one step then we would reduce performance
which that particular developer might not appreciate.
On another practical note, hardware accelerators do not perform
multi-step scaling so we wouldn't be able to fire the request off to the
video card and get hardware accelerated scaling (nearly free) if we
instituted such a policy behind the scenes.
If we did provide that mechanism automatically then it would have to be
under a different name so that the developer could buy into the specific
tradeoffs that it provides (better quality for >2x downscaling at the
expense of about 7x performance).
In the meantime, we publish blogs like the one you point to in order to
educate our programmers about the definitions of the graphical terms and
processes that our APIs allow them to access and how to use those well
defined industry standard mechanisms to achieve their needs...
...jim
[EMAIL PROTECTED] wrote:
There is an article that mentions that one can improve the look of
downscaling using BILINEAR by downscaling multiple times (each time by
half):
http://today.java.net/pub/a/today/2007/04/03/perils-of-image-getscaledinstance.html
The paragraph in question reads: "To combat this issue, you can use a
multi-step approach when downscaling by more than two times; this
helps prevent the information loss issue and produces a much higher
quality result that is visually quite close to that produced by
Image.SCALE_AREA_AVERAGING"
My question is, why doesn't Java do this automatically under the hood?
If I request BILINEAR or BICUBIC downscaling for a factor greater than
two, why doesn't Java either do multistep scaling on my behalf or why
doesn't the Java2D team add a new hint (to maintain backwards
compatibility) which will tell Java2D to apply these filters using the
multi-step method? I would much rather have this supported by the JDK
than having people reinvent the wheel over and over.
Thank you,
Gili
[Message sent by forum member 'cowwoc' (cowwoc)]
http://forums.java.net/jive/thread.jspa?messageID=227363
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
of the message "signoff JAVA2D-INTEREST". For general help, send
email to
[EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".