Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Lanczos resampling

From Wikipedia, the free encyclopedia
Technique in signal processing
Lanczos interpolation with radius 1
Lanczos interpolation with radius 2
Lanczos interpolation with radius 3
Partial plot of a discrete signal (black dots) and of its Lanczos interpolation (solid blue curve), with size parametera equal to 1 (top), 2 (middle) and 3 (bottom). Also shown are two copies of the Lanczos kernel, shifted and scaled, corresponding to samples 4 and 11 (dashed curves).

Lanczos filtering andLanczos resampling are two applications of a certain mathematical formula. It can be used as alow-pass filter or used to smoothlyinterpolate the value of adigital signal between itssamples. In the latter case, it maps each sample of the given signal to a translated and scaled copy of theLanczos kernel, which is asinc functionwindowed by the central lobe of a second, longer, sinc function. The sum of these translated and scaled kernels is then evaluated at the desired points.

Lanczos resampling is typically used to increase thesampling rate of a digital signal, or to shift it by a fraction of the sampling interval. It is often used also formultivariate interpolation, for example toresize orrotate adigital image. It has been considered the "best compromise" among several simple filters for this purpose.[1]

The filter was invented byClaude Duchon, who named it afterCornelius Lanczos due to Duchon's use of thesigma approximation in constructing the filter, a technique created by Lanczos.[2]

Definition

[edit]

Lanczos kernel

[edit]
Lanczos windows fora = 1, 2, 3.
Lanczos kernels for the casesa = 1, 2, and 3, with their frequency spectra. A sinc filter would have a cutoff at frequency 0.5.

The effect of each input sample on the interpolated values is defined by the filter'sreconstruction kernelL(x), called the Lanczos kernel. It is the normalizedsinc functionsinc(x),windowed (multiplied) by theLanczos window, orsinc window, which is the central lobe of a horizontally stretched sinc functionsinc(x/a) foraxa.

L(x)={sinc(x)sinc(x/a)if a<x<a,0otherwise.{\displaystyle L(x)={\begin{cases}\operatorname {sinc} (x)\operatorname {sinc} (x/a)&{\text{if}}\ -a<x<a,\\0&{\text{otherwise}}.\end{cases}}}

Equivalently,

L(x)={1if x=0,asin(πx)sin(πx/a)π2x2if ax<a and x0,0otherwise.{\displaystyle L(x)={\begin{cases}1&{\text{if}}\ x=0,\\{\dfrac {a\sin(\pi x)\sin(\pi x/a)}{\pi ^{2}x^{2}}}&{\text{if}}\ -a\leq x<a\ {\text{and}}\ x\neq 0,\\0&{\text{otherwise}}.\end{cases}}}

The parametera is a positive integer, typically 2 or 3, which determines the size of the kernel. The Lanczos kernel has2a − 1 lobes: a positive one at the center, anda − 1 alternating negative and positive lobes on each side.

Interpolation formula

[edit]

Given a one-dimensional signal with samplessi, for integer values ofi, the valueS(x) interpolated at an arbitrary real argumentx is obtained by the discreteconvolution of those samples with the Lanczos kernel:[3]

S(x)=i=xa+1x+asiL(xi),{\displaystyle S(x)=\sum _{i=\lfloor x\rfloor -a+1}^{\lfloor x\rfloor +a}s_{i}L(x-i),}

wherea is the filter size parameter, andx{\displaystyle \lfloor x\rfloor } is thefloor function. The bounds of this sum are such that the kernel is zero outside of them.

Properties

[edit]

As long as the parametera is a positive integer, the Lanczos kernel iscontinuous everywhere, and itsderivative is defined and continuous everywhere (even atx = ±a, where both sinc functions go to zero). Therefore, the reconstructed signalS(x) too will be continuous, with continuous derivative.

The Lanczos kernel is zero at every integer argumentx, except atx = 0, where it has value 1. Therefore, the reconstructed signal exactly interpolates the given samples: we will haveS(x) =si for every integer argumentx =i.

Lanczos resampling is one form of a general method developed by Lanczos to counteract theGibbs phenomenon by multiplying coefficients of a truncatedFourier series bysinc(πk/m){\displaystyle \mathrm {sinc} (\pi k/m)}, wherek{\displaystyle k} is the coefficient index andm{\displaystyle m} is how many coefficients we're keeping.[4][5] The same reasoning applies in the case of truncated functions if we wish to remove Gibbs oscillations in their spectrum.

Multidimensional interpolation

[edit]
Theincipit of a black-and-white image. Original, low-quality expansion with JPEG artifacts.
The same image resampled to five times as many samples in each direction, using Lanczos resampling. Pixelation artifacts were removed changing the image's transfer function.

Lanczos filter's kernel in two dimensions is

L(x,y)=L(x)L(y).{\displaystyle L(x,y)=L(x)L(y).}

Evaluation

[edit]

Advantages

[edit]
A discrete Lanczos window and itsfrequency response; seeWindow function for comparison with other windows.

The theoretically optimal reconstruction filter forband-limited signals is thesinc filter, which has infinitesupport. The Lanczos filter is one of many practical (finitely supported) approximations of the sinc filter. Each interpolated value is the weighted sum of2a consecutive input samples. Thus, by varying the2a parameter one may trade computation speed for improved frequency response. The parameter also allows one to choose between a smoother interpolation or a preservation of sharp transients in the data. For image processing, the trade-off is between the reduction ofaliasing artefacts and the preservation of sharp edges. Also as with any such processing, there are no results for the borders of the image. Increasing the length of the kernel increases the cropping of the edges of the image.

The Lanczos filter has been compared with other interpolation methods for discrete signals, particularly other windowed versions of the sinc filter.Turkowski andGabriel claimed that the Lanczos filter (witha = 2) is the "best compromise in terms of reduction of aliasing, sharpness, and minimal ringing", compared with truncated sinc and theBartlett,cosine-, andHann-windowed sinc, for decimation and interpolation of 2-dimensional image data.[1] According toJim Blinn, the Lanczos kernel (witha = 3) "keeps low frequencies and rejects high frequencies better than any (achievable) filter we've seen so far."[6]

Lanczos interpolation is a popular filter for "upscaling" videos in various media utilities, such asAviSynth[7] andFFmpeg.[8]

Limitations

[edit]

Since the kernel assumes negative values fora > 1, the interpolated signal can be negative even if all samples are positive. More generally, the range of values of the interpolated signal may be wider than the range spanned by the discrete sample values. In particular, there may beringing artifacts just before and after abrupt changes in the sample values, which may lead toclipping artifacts. However, these effects are reduced compared to the (non-windowed) sinc filter. Fora = 2 (a three-lobed kernel) the ringing is < 1%.

When using the Lanczos filter for image resampling, the ringing effect will create light and dark halos along any strong edges. While these bands may be visually annoying, they help increase theperceived sharpness, and therefore provide a form ofedge enhancement. This may improve the subjective quality of the image, given the special role of edge sharpness invision.[9]

In some applications, the low-end clipping artifacts can be ameliorated by transforming the data to a logarithmic domain prior to filtering. In this case the interpolated values will be a weighted geometric mean, rather than an arithmetic mean, of the input samples.

The Lanczos kernel does not have thepartition of unity property. That is, the sumU(x)=iZL(xi){\textstyle U(x)=\sum _{i\in \mathbb {Z} }L(x-i)} of all integer-translated copies of the kernel is not always 1. Therefore, the Lanczos interpolation of a discrete signal with constant samples does not yield a constant function. This defect is most evident when a = 1. Also, fora = 1 the interpolated signal has zero derivative at every integer argument. This is rather academic, since using a single-lobe kernel (a = 1) loses all the benefits of the Lanczos approach and provides a poor filter. There are many better single-lobe, bell-shaped windowing functions.

The partition of unity can be introduced by a normalization,

L(xi)=L(xi)j=1aaL(xj){\displaystyle L'(x-i)={\frac {L(x-i)}{\sum _{j=1-a}^{a}L(x-j)}}}

for0x<1{\displaystyle 0\leq x<1}.

See also

[edit]

References

[edit]
  1. ^abTurkowski, Ken; Gabriel, Steve (1990). "Filters for Common Resampling Tasks". In Glassner, Andrew S. (ed.).Graphics Gems I. Academic Press. pp. 147–165.CiteSeerX 10.1.1.116.7898.ISBN 978-0-12-286165-9.
  2. ^Claude, Duchon (1979-08-01)."Lanczos Filtering in One and Two Dimensions".Journal of Applied Meteorology.18 (8):1016–1022.Bibcode:1979JApMe..18.1016D.doi:10.1175/1520-0450(1979)018<1016:LFIOAT>2.0.CO;2.
  3. ^Burger, Wilhelm; Burge, Mark J. (2009).Principles of digital image processing: core algorithms. Springer. pp. 231–232.ISBN 978-1-84800-194-7.
  4. ^Lanczos, Cornelius (1988).Applied analysis. New York: Dover Publications. pp. 219–221.ISBN 0-486-65656-X.OCLC 17650089.
  5. ^Mazzoli, Francesco."Lánczos interpolation explained".mazzo.li. Retrieved2025-04-21.
  6. ^Blinn, Jim (1998).Jim Blinn's corner: dirty pixels. Morgan Kaufmann. pp. 26–27.ISBN 978-1-55860-455-1.
  7. ^"Resize". Avisynth. 2015-01-01. Retrieved2015-07-27.
  8. ^"A How To guide: Upconverting video using FFDShow - Neowin Forums". Neowin.net. 2006-04-18. Retrieved2012-07-31.
  9. ^"IPOL: Linear Methods for Image Interpolation". Ipol.im. 2011-09-27. Retrieved2012-07-31.

External links

[edit]
  • Anti-Grain Geometry examples:image_filters.cpp shows comparisons of repeatedly resampling an image with various kernels.
  • imageresampler: A public domain image resampling class in C++ with support for several windowed Lanczos filter kernels.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Lanczos_resampling&oldid=1301103050"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp