[HN Gopher] Lanczos Interpolation Explained (2022)
       ___________________________________________________________________
        
       Lanczos Interpolation Explained (2022)
        
       Author : tobr
       Score  : 160 points
       Date   : 2025-10-05 07:49 UTC (6 days ago)
        
 (HTM) web link (mazzo.li)
 (TXT) w3m dump (mazzo.li)
        
       | jeffreygoesto wrote:
       | Kind of related: https://johncostella.com/magic/ and its
       | discussion https://news.ycombinator.com/item?id=41756205
        
       | magicalhippo wrote:
       | That was a very nice and detailed description of the Laczos
       | filter. It gave some new perspectives that were not covered by
       | the sources I've read earlier.
        
       | wartywhoa23 wrote:
       | Not only a very nice explanation, but it's also presented in such
       | an aesthetically pleasing way! The layout, the typography, the
       | colors..
       | 
       | The blog is a thing of beauty.
        
       | trhway wrote:
       | Difference with Gabors kernels (that are in our visual cortex and
       | what the first level CNN kernels look to converge to) is the
       | scaling factor 1/t instead of e^(-t)
        
       | adzm wrote:
       | I know bicubic is similar to lanczos with less ringing and less
       | sharp but still felt like a glaring omission not comparing it
       | with lanczos. That said, great article and great details, I
       | learned a lot.
        
         | magicalhippo wrote:
         | Author does explain why it in a footnote:
         | 
         |  _Cubic interpolation is not included in the showcase since it
         | is a family of filters rather than a single filter -- most
         | cubic filters used in practice end up looking similar to
         | Lanczos, although probably a bit less sharp but with less
         | ringing._
        
           | jgalt212 wrote:
           | So just one method with common paramters and display those.
        
         | jgalt212 wrote:
         | I came to say just that. Why are there no pictures comparing
         | the two? A competent high school student could write a method
         | that beats linear and nearest.
        
       | nasretdinov wrote:
       | It's fascinating how the "ringing" around the edges looks so much
       | like JPEG compression that it took me around 10 minutes to stop
       | ignoring it and actually start looking at the images properly
        
         | Sesse__ wrote:
         | It's the exact same phenomenon. :-) The high frequencies are
         | abruptly cut off in both cases.
        
       | zozbot234 wrote:
       | The claim that the best interpolation kernel for 2d images is
       | just a product of two Lanczos kernels in the X and Y directions
       | seems wrong to me. Rather, there is a proper 2D analog to the
       | sinc function known as the jinc, or "Sombrero" function
       | https://en.wikipedia.org/wiki/Sombrero_function . (This function
       | is mathematically related to the "Airy" ringing patterns found in
       | the optics of lenses.) Resampling with a jinc-based circular-
       | window kernel should show a far lower intensity of ringing
       | artifacts compared to the simple composition of two 1D Lanczos
       | filters.
       | 
       | On a different point, when approximating a "brickwall" frequency
       | spectrum an 'equiripple' pattern is generally considered
       | desirable, and this will lead to a different kernel than the
       | Lanczos approach does.
        
         | rostayob wrote:
         | (I'm the author)
         | 
         | I don't really claim that Lanczos interpolation as presented is
         | the "best" 2D interpolation there is. It is definitely popular
         | though, and I couldn't find a source explaining how it is
         | derived, so I thought it'd be an interesting topic for a blog
         | post.
        
           | petermcneeley wrote:
           | Thank you for this article. Are the graphs images? and how
           | were they generated?
        
       | hilbert42 wrote:
       | An interesting article, especially given the links to the YouTube
       | interview of Cornelius Lanczos. I've used the Lanczos algorithm
       | for years for interpolation but until now I'd not put a face and
       | voice to his work.
       | 
       | It's interesting to compare Lanczos (and other) resampling
       | algorithms in digital imaging with what's known as K-factor (aka
       | K-rating)--a measurement in analog television for rating image
       | quality. There are interesting similarities between the two.
       | 
       | An image is an image whether it's generated digitally or by
       | analog means, so it's only to be expected that ways of measuring
       | image quality between these two systems would have some things in
       | common. That's done by comparing the output signal with the
       | original image but it's not as straightforward as it seems as
       | human perception and subjectivity get in the way.
       | 
       | As per article we've seen Lanczos, (sync, (sin x)/x) resampling
       | quality is better than say nearest neighbour, Mitchell, triangle,
       | etc. but the problem of human subjectivity remains as it's often
       | difficult to compare image quality visually and or consistently.
       | Analog television has long had methods of objectively evaluating
       | images without the human factor and again the solution is
       | mathematical, and as I'll show it has some interesting parallels
       | with Lanczos resampling.
       | 
       | To determine image quality/K-factor of a television transmission
       | system an electronic test signal replaces the subjective image
       | and it's measured for distortion products after it exits the
       | system. The mathematical parameters of this test signal are
       | carefully defined to detect distortions and artifacts that are
       | most noticeable to the human eye.
       | 
       | The test signal consists of a sine-squared pulse of specified
       | duration followed by bar (a square wave with a transient response
       | the same as the pulse). The K-factor is determined by measuring
       | the deviation in the pulse and bar risetimes together with
       | generated artifacts such as ringing and under and or overshoot.
       | As the Pulse & Bar is a precision test signal input/output
       | comparisons aren't necessary, thus a single measurement
       | simplifies testing.
       | 
       | For those interested see BBC Monograph 58 'Sine-squared Pulse and
       | Bar Testing in Colour Television'. 1965. PDF
       | https://www.bbc.co.uk/rd/publications/bbc_monograph_58
       | 
       | Unfortunately, this ref. is behind a firewall: Macdiarmid, I.F.
       | and Phillips, B. 'A Pulse & Bar Waveform Generator for Testing
       | Television Links.' Proc I.E.E. Vol. 105, Part B, p.) 440. 1958.
        
       | sfpotter wrote:
       | One way to think of the sinc function is as the reproducing
       | kernel (the point evaluation functional) for the space of
       | bandlimited functions, thought of as a reproducing kernel Hilbert
       | space. I guess the Shannon/Nyquist theorem just kind of falls out
       | of this.
        
       ___________________________________________________________________
       (page generated 2025-10-11 23:01 UTC)