resize algorithms ion
TRANSCRIPT
8/6/2019 Resize Algorithms ion
http://slidepdf.com/reader/full/resize-algorithms-ion 1/12
//web.archive.org/web/20060827184031/http://www.path.unimelb.edu.au/~dersch/interpolator/interpolator.html[10.02.2010 14:20:02]
Testing Interpolator QualityHelmut Dersch
Technical University Furtwangen
Revised June 30, 1999
Manipulation of digital images often requires resampling of the pixel data. Usually, the pixel positions
he transformed image do not coincide with grid positions. Therefore, an interpolation algorithm has to
e applied to somehow derive the pixel data for these in-between positions. The effort spent for this
nterpolation is crucial for the image quality of the result image.
Most common in computer graphics applications is bilinear interpolation. As the name suggests, off-g
oints are linearly interpolated between their four neighboring grid-pixels. Some professional package
ke Photoshop offer cubic interpolation using higher order polynomials and more data points. The mo
ata points are used, and the more sophisticated the interpolation function is, the better is the result an
he slower is the program.
The following is a test performed on a variety of Graphics programs which were available to me. This
est is biased since I used it explicitely to test my own program (the Photoshop/Gimp plug-in Panoram
Tools ) against other solutions.
everal authors have judged interpolator quality by testing enlargements. However, there are quite a fe
roblems associated with that, the most important being that there is no mathematically unique solutio
or digital image enlargements, and, hence, no really objective test. A more practical test is a rotation
n image by some arbitrary angle, which can be easily tested against the original image. The more such
otations the image survives intact, the better is the algorithm. This test is also readily available, sincelmost any Graphics-program has a rotate function.
Two images were used: One real-world photograph shown to the left below, and one line drawing sho
o the right. The images are shown in original size; they are 200x200pixels each.
Both images were rotated in 5 degree steps until a total of 180 degrees was reached. This amounts to
esampling steps. Then the image is flipped back, which is a lossless transformation. To judge and
8/6/2019 Resize Algorithms ion
http://slidepdf.com/reader/full/resize-algorithms-ion 2/12
//web.archive.org/web/20060827184031/http://www.path.unimelb.edu.au/~dersch/interpolator/interpolator.html[10.02.2010 14:20:02]
ompare image quality, one part of each image is enlarged three times (photo) or six times (line drawi
without any filtering and interpolation, so each source pixel appears as 3x3 (6x6) block in the result
mage. For this publication, the photos were compressed using high-quality JPEG, and the line-drawin
sing GIF-compression. The source images (without being rotated) then look like this:
Ken Turkowski has suggested another test image which gives a more quantitative
estimate of the image sharpness. It is shown below. In this case it was determined how many
of the concentric rings survived the 36 rotations. The count of clearly visible white rings is
indidcated for each image.
Results:
Photoshop Bicubic Interpolation:
8/6/2019 Resize Algorithms ion
http://slidepdf.com/reader/full/resize-algorithms-ion 3/12
//web.archive.org/web/20060827184031/http://www.path.unimelb.edu.au/~dersch/interpolator/interpolator.html[10.02.2010 14:20:02]
Number of visible bright rings : 8,5
Photoshop Bilinear Interpolation:
8/6/2019 Resize Algorithms ion
http://slidepdf.com/reader/full/resize-algorithms-ion 4/12
//web.archive.org/web/20060827184031/http://www.path.unimelb.edu.au/~dersch/interpolator/interpolator.html[10.02.2010 14:20:02]
Number of visible bright rings : 2
Color It (Macintosh):
8/6/2019 Resize Algorithms ion
http://slidepdf.com/reader/full/resize-algorithms-ion 5/12
//web.archive.org/web/20060827184031/http://www.path.unimelb.edu.au/~dersch/interpolator/interpolator.html[10.02.2010 14:20:02]
Number of visible bright rings : 1
GraphicConverter with Error Correction (Macintosh):
8/6/2019 Resize Algorithms ion
http://slidepdf.com/reader/full/resize-algorithms-ion 6/12
//web.archive.org/web/20060827184031/http://www.path.unimelb.edu.au/~dersch/interpolator/interpolator.html[10.02.2010 14:20:02]
Picture Publisher (Windows 95)
8/6/2019 Resize Algorithms ion
http://slidepdf.com/reader/full/resize-algorithms-ion 7/12
//web.archive.org/web/20060827184031/http://www.path.unimelb.edu.au/~dersch/interpolator/interpolator.html[10.02.2010 14:20:02]
Panorama Tools: Cubic Interpolator 'Poly 3'
Number of visible bright rings : 8,5
Panorama Tools: Spline 16 Pixels
8/6/2019 Resize Algorithms ion
http://slidepdf.com/reader/full/resize-algorithms-ion 8/12
//web.archive.org/web/20060827184031/http://www.path.unimelb.edu.au/~dersch/interpolator/interpolator.html[10.02.2010 14:20:02]
Number of visible bright rings : 7
Panorama Tools: Spline 36 Pixels
8/6/2019 Resize Algorithms ion
http://slidepdf.com/reader/full/resize-algorithms-ion 9/12
//web.archive.org/web/20060827184031/http://www.path.unimelb.edu.au/~dersch/interpolator/interpolator.html[10.02.2010 14:20:02]
Number of visible bright rings : 10
Panorama Tools: Sinc 256 Pixels
8/6/2019 Resize Algorithms ion
http://slidepdf.com/reader/full/resize-algorithms-ion 10/12
//web.archive.org/web/20060827184031/http://www.path.unimelb.edu.au/~dersch/interpolator/interpolator.html[10.02.2010 14:20:02]
Number of visible bright rings : 20
The Interpolators in Panorama Tools are available from version 1.8b1. Earlier versions had the two
pline Interpolators, but the other two were different.
Some Comments:
The worst image quality is obtained with nearest neighbor sampling which obviously is implemented i
icture Publisher. Bilinear interpolation leads to significant losses, but is usually acceptable if only onr two sampling steps are involved. The bicubic schemes vary depending on the number of input pixel
Usually 16 pixels are used. Depending on the choosen polynomial, either a very sharp image with som
rtefacts, or a somewhat softer, but more homogeneous image is obtained. The Photoshop polynomial
as a distinct sharpening effect, as can be seen in the brightened edges of dark features. This leads to
rtefacts most pronounced in the structures of the line drawing. The interpolator 'poly 3' of Panorama
Tools has been tuned to closely resemble that of Photoshop.It sharpens slightly more. 'Spline16' is
qually fast, but much smoother, as can be seen in the line drawing. It is also somewhat softer, as judg
rom the rating using Ken's image. Spline36 is identical to Spline16, but uses 36 pixels instead of 16.
8/6/2019 Resize Algorithms ion
http://slidepdf.com/reader/full/resize-algorithms-ion 11/12
//web.archive.org/web/20060827184031/http://www.path.unimelb.edu.au/~dersch/interpolator/interpolator.html[10.02.2010 14:20:02]
This results in better resolution (see the 1pixel wide line in the line drwaing) without significant
rtefacts. The best results are obtained using the sinc-function. This not only is more involved than the
ubic polynomials, but in the present case also requires 256 pixels to interpolate for each input pixel.
inc-function is the theoretical optimum, and can only be improved by using even more pixels.
The Math:
n calculating the pixel value of a particular position in the result image, the interpolator combines
everal pixels of the source image. The closer these pixels are to this position, the more weight the pix
arries. However, this is not just a simple falling function of pixel distance x, but there are certain
ptimum weights.
Linear InterpolationThe weight of the source pixel is calculated by
weight = 1-x
=0 then corresponds to matching source and result pixels. Two pixels are used for 1-dimensionalnterpolation, 4 for 2-dimensional calculations.
Cubic Interpolation
Poly3 of Panorama Tools is a single parameter cubic polynomial with weights
weight = (( A + 2.0 )*x - ( A + 3.0 ))*x*x +1.0; 0<x<1
weight = (( A * x - 5.0 * A ) * x + 8.0 * A ) * x - 4.0 * A; 1<x<2
t uses 4 pixels in one, and 16 pixels in 2 dimensions. The parameter 'A' determines the behavious of t
unction. It is set to -0.75, which makes it very similar to Photoshop's bicubic interpolator.
pline16 of Panorama Tools is a cubic-spline, with derivative set to 0 at the edges (4x4 pixels). The
weight function thus becomes:
weight = ( ( x - 9.0/5.0 ) * x - 1.0/5.0 ) * x + 1.0; 0<x<1
weight = ( ( -1.0/3.0 * (x-1) + 4.0/5.0 ) * (x-1) - 7.0/15.0 ) * (x-1) ; 1<x<2
t also uses 16 pixels in 2 dimensions.
pline36 is like Spline16, except that it uses 6x6=36 pixels. The weight function becomes
weight = ( ( 13.0/11.0 * x - 453.0/ 209.0 ) * x - 3.0/ 209.0 ) * x + 1.0; 0<x<1
weight = ( ( - 6.0/11.0 * (x-1) + 270.0/ 209.0 ) * (x-1) - 156.0/ 209.0 ) *(x-1); 1<x<2
weight = ( ( 1.0/11.0 * (x-2) - 45.0/ 209.0 ) * (x-2) + 26.0/ 209.0 ) *(x-2); 2<x<3
Sinc Interpolation
inc256 of Panorama Tools is a sinc() function windowed to 8 pixels (Lanczos-function). The weights
re calculated
8/6/2019 Resize Algorithms ion
http://slidepdf.com/reader/full/resize-algorithms-ion 12/12
weight = [ sin(x*¼) / (x*¼) ] * [ sin(x*¼ / 8) / (x*¼/8) ]
This interpolator uses 16*16 = 256 pixels.
Copyright ©; H. Dersch 1999