Lanczos resampling

Lanczos resampling

Lanczos resampling ("Lanzosh") is a multivariate interpolation method used to compute new values for any digitally sampled data. It is often used to resize digital images, but could be used for any other digital signal. In the case of digital image resizing, the Lanczos function indicates which pixels in the original image, and in what proportion, make up each pixel of the final image.

Lanczos filtering gives very high quality results compared to more commonly used but faster techniques such as linear or cubic interpolation because it more closely approximates the optimal resampling filter, the sinc function.

static void Test(const double* signal, size_t origlen, size_t newlen){ std::vector newsig(newlen); Resample(signal, origlen, &newsig [0] , newlen); size_t maxlen = std::max(origlen, newlen); std::printf("Original signal: "); size_t bpos = 0; for (size_t a=0; aint main(void){ /* Test resampling into a smaller size */ double smp1 [] = { 0,9,0,0,9,0,0,0,9,0,0,0,9,9,9,9,9,9,9 }; Test(smp1, sizeof(smp1)/sizeof(*smp1), 6); /* Test resampling into a larger size */ double smp2 [] = {9,0,3,0,9,6,9}; Test(smp2, sizeof(smp2)/sizeof(*smp2), 26);}

Example output:

Original signal: 0 90 0 0 90 0 0 0 90 0 0 0 90 90 90 90 90 90 90Resampled signal: 33 .. .. 24 .. .. .. 20 .. .. 25 .. .. .. 91 .. .. .. 89-----Original signal: 90 .. .. .. 0 .. .. .. 30 .. .. .. 0 .. .. .. 90 .. .. .. 60 .. .. .. .. 90Resampled signal:107 95 77 52 23 1 -3 9 25 29 19 4 -2 7 33 65 87 92 83 68 59 63 74 84 92 96-----

As can be observed from the results, the values given by the algorithm are not exact copies of the source values ― they even extend beyond the original range of the samples ― but the general outline is retained when resampled to smaller size, and predicted when resampled to larged size. Among many uses, the algorithm can be applied to audio signal and image data.

Two-dimensional lanczos resampling of images can be performed by first scaling each scanline horizontally, then scaling each resulting column vertically. Such action can be optimized by handling each scanline/column in the inner loop, reusing the same contribution array.


The Lanczos resampling kernel is known to be used in:Fact|date=September 2008
* FastStone Image Viewer
* [ FreeImage] (Open Source image encoding/decoding library)
* IrfanView
* AviSynth
* ffdshow
* ImageMagick
* MPlayer
* Shake (software)
* Mac OS X - Quartz (graphics layer) and vImage
* Avidemux
* Lightwave
* Pixel image editor (1.0 Beta 8 and above)
* GIMP (2.3 and above)
* Panorama Tools (as "sinc interpolation")
* XnView
* Opera (web browser) - for zooming images
* Google Picasa
* Python Imaging Library (as 'ANTIALIAS' in Image.resize())
* ACDSee
* XBMC (as "sinc" and "Lanczos" for video scaling)

ee also

*Bicubic interpolation
*Bilinear interpolation
*Spline interpolation
*Nearest-neighbor interpolation

External links

* [ Testing Interpolator Quality]
* [ PDF from Apple Computer]
* [ Resampling Kernels]
* [ Anti-Grain Geometry examples] image_transforms.cpp shows comparisons of repeatedly resampling an image with various kernels.

Wikimedia Foundation. 2010.

Игры ⚽ Поможем решить контрольную работу

Look at other dictionaries:

  • Resampling — is the digital process of changing the sample rate or dimensions of digital imagery or audio by temporally or areally analysing and sampling the original data.AudioAudio resampling is also called sample rate conversion. This operation in digital… …   Wikipedia

  • Cornelius Lanczos — Lanczos redirects here. For resampling method, see Lanczos resampling. Cornelius Lanczos Born February 2, 1893(1893 02 02) Székesfehérvár Died …   Wikipedia

  • Lanczos-Filter — Graph des Lanczos Filters für a=3 Der Lanczos Filter ist ein häufig in der Computergrafik eingesetzter Rekonstruktionsfilter. Er wurde 1979 vom Meteorologen Claude E. Duchon entwickelt und ist nach dem ungarischen Mathematiker Cornelius Lanczos… …   Deutsch Wikipedia

  • Window function — For the term used in SQL statements, see Window function (SQL) In signal processing, a window function (also known as an apodization function or tapering function[1]) is a mathematical function that is zero valued outside of some chosen interval …   Wikipedia

  • List of numerical analysis topics — This is a list of numerical analysis topics, by Wikipedia page. Contents 1 General 2 Error 3 Elementary and special functions 4 Numerical linear algebra …   Wikipedia

  • List of mathematics articles (L) — NOTOC L L (complexity) L BFGS L² cohomology L function L game L notation L system L theory L Analyse des Infiniment Petits pour l Intelligence des Lignes Courbes L Hôpital s rule L(R) La Géométrie Labeled graph Labelled enumeration theorem Lack… …   Wikipedia

  • Bicubic interpolation — In mathematics, bicubic interpolation is an extension of cubic interpolation for interpolating data points on a two dimensional regular grid. The interpolated surface is smoother than corresponding surfaces obtained by bilinear interpolation or… …   Wikipedia

  • Multivariate interpolation — In numerical analysis, multivariate interpolation or spatial interpolation is interpolation on functions of more than one variable. The function to be interpolated is known at given points and the interpolation problem consist of yielding values… …   Wikipedia

  • Bilinear interpolation — In mathematics, bilinear interpolation is an extension of linear interpolation for interpolating functions of two variables on a regular grid. The key idea is to perform linear interpolation first in one direction, and then again in the other… …   Wikipedia

  • Anti-aliasing — In digital signal processing, anti aliasing is the technique of minimizing the distortion artifacts known as aliasing when representing a high resolution signal at a lower resolution. Anti aliasing is used in digital photography, computer… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”