• site home
  • blog home
  • galleries
  • contact
  • underwater
  • the bleeding edge

the last word

Photography meets digital computer technology. Photography wins -- most of the time.

You are here: Home / The Last Word / Noise performance of downsampling with eliptical weighted averaging

Noise performance of downsampling with eliptical weighted averaging

September 29, 2014 JimK Leave a Comment

Over on the Luminous Landscape forum, Nicolas Robidoux, Bart van der Wolf, Alan Gibson, and others have been working on developing downsampling algorithms. They’re using the command-line image editor ImageMagick as the engine to do the work, so their methodology is to write scripts that call ImageMagick. Some of their algorithms are producing impressive results, some of which you’ve seen in the last few posts.

I took one of Bart’s scripts, version 1.2.2, and ran it on a Gaussian noise image. I’ll report the results in this post, but first I’d like to let Bart tell you something about the algorithm. If digital filter design isn’t your thing, fee free to skip ahead.

On my occasional perusals on the ImageMagick discourse server, I read about some of Nicolas Robidoux’s ideas about halo suppression, in which he suggested temporarily adjusting the tone curve before resampling and restoring the original tone curve after resampling. Having tested those ideas when Nicolas was still experimenting with sigmoidal contrast, I saw some benefits, but also lack of control over shadows and highlights with a single parameter. Now that he declared that round-trip to Sigmoidal contrast dead, and introduced separate gamma corrected resampling with blending, I was convinced about the usefulness of the principle.

When Nicolas suggested to investigate further, and with no takers, I volunteered to create a tool that allowed to test the concept a bit further and in a more structured manner.

All resampling methods that are used in the script, are based on Elliptical Weighted Averaging or EWA (therefore in two dimensions) instead of a two pass orthogonal tensor approach. This has the benefit of producing more ‘organic looking’ resizing because the resulting resolution is circularly symmetric, rather than having a higher diagonal resolution that is possible in a square pixel grid. BTW, EWA resampling also has benefits for other types of (asymmetrical or variable) distortion.

A drawback of EWA resampling, besides the higher computational cost of having to process more samples, is that a (nearly) No-Op (scale close to 1.0) resampling will be slightly blurry, instead of having no effect on sharpness. Therefore, and for adaptability to different subject matter and viewing conditions, a sharpening parameter is added which allows to modify the behavior of the resampling and windowing filter used.

There are different filter methods available for upsampling and for down-sampling, and they are chosen because they perform better (less artifacting) for the intended scaling. The script is set up to allow choosing either filter method regardless of the fact of upsampling or down-sampling, but that’s more for experimentation purposes.

The actual resampling results are a linear gamma space blend between two resampling operations. The resampling operations are performed in two different gamma spaces in order to cope with the different halo under-/overshoot amplitudes. The blending of those in linear gamma space is luminance driven which allows to address the different halo tendencies in darker and lighter tones, and it reduces the risk of clipping.

This is all based on a proposal by Nicolas Robidoux, after experimenting with other temporary contrast adjustment functions based on sigmoidal tone curves. The approach with resampling in separate gamma spaces allows to better target the suppression of halo under/overshoots in different luminance ranges.

The upsampling operation (labeled as ‘generic’, because it also does pretty decent down-sampling) is implemented by using the EWA version of ‘Lanczos’ filtering, also known as ‘Jinc’ filtering, to make it circularly symmetric when simply scaling both dimensions by the same factor. Some ‘deblur’ is used, the amount is user adjustable. The deblur is controlled by modification of the filter support and window size.

The down-sampling operation is implemented by using the EWA version of ‘Cubic’ filtering, with an adjusted parameter choice to use a relatively soft filter version (from the family of Keys filter parameters), which is achieved with the following ‘-define filter:c=0.1601886205085204 -filter Cubic’. That defines a somewhat blurry filter, but also relatively halo and ringing free, which helps because down-sampling needs to actively avoid aliasing and ringing artifacts. It also blends the results of two resampling operations that were done in different gamma spaces, to allow and control halo generation.

To compensate for the softness/blur of the Cubic filter version, deconvolution sharpening is added. The deconvolution uses a Gaussian blur based weighting, and is implemented as a Unity kernel subtracted by a Gaussian blur, with the ImageMagick DoG (difference of Gaussians) function, which produces a 2-D convolution filter kernel.

There is a different down-sampling operation that is used when the choice is made to eliminate all sharpening, e.g. because one wants to use a separate utility for that. That operation only uses the EWA version of the ‘Quadratic’ filter in linear gamma space, without blending with other gamma space results. That filter produces very clean, essentially halo free, results (thus the possibility to skip blending with non-linear gamma space resampling) with very little aliasing but it’s a bit blurry, and will therefore allow significant (e.g. local) sharpening without risk of enhancing existing halos. As a bonus, an experimental option is added to the script to add a simple separate deconvolution sharpening operation, when zero or ‘negative sharpening’ (i.e. blur) was used.

All operations are executed in the spatial domain, to circumvent potential issues with limited 16-bit precision calculations that will create artifacts in the (Fourier converted) frequency domain. The future versions of ImageMagick will apparently also be available as already complied binaries that allow floating point Fourier transforms, which may help with faster and more precise calculations. It may also generate some other resampling options.

The deblur = 50 setting produces a fairly flat lowpass curve when fed a white noise signal, and it does not vary materially with downsizing ratio:

Bartp5sharp50

That deblur setting produces somewhat greater then the ideal noise reduction upon downsizing.

rmsnoiseBartsharp50

With deblur set to 100, there is a mild peak in the transfor function:

Bartp5sharp100

And the noise reduction is precisely on the ideal line:

rmsnoiseBartsharp100wpergect

 

 

 

The Last Word

← Comparing downsampling algorithms, Fuji still life Noise reduction with nonlinear tools and downsampling →

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

May 2025
S M T W T F S
 123
45678910
11121314151617
18192021222324
25262728293031
« Apr    

Articles

  • About
    • Patents and papers about color
    • Who am I?
  • How to…
    • Backing up photographic images
    • How to change email providers
    • How to shoot slanted edge images for me
  • Lens screening testing
    • Equipment and Software
    • Examples
      • Bad and OK 200-600 at 600
      • Excellent 180-400 zoom
      • Fair 14-30mm zoom
      • Good 100-200 mm MF zoom
      • Good 100-400 zoom
      • Good 100mm lens on P1 P45+
      • Good 120mm MF lens
      • Good 18mm FF lens
      • Good 24-105 mm FF lens
      • Good 24-70 FF zoom
      • Good 35 mm FF lens
      • Good 35-70 MF lens
      • Good 60 mm lens on IQ3-100
      • Good 63 mm MF lens
      • Good 65 mm FF lens
      • Good 85 mm FF lens
      • Good and bad 25mm FF lenses
      • Good zoom at 24 mm
      • Marginal 18mm lens
      • Marginal 35mm FF lens
      • Mildly problematic 55 mm FF lens
      • OK 16-35mm zoom
      • OK 60mm lens on P1 P45+
      • OK Sony 600mm f/4
      • Pretty good 16-35 FF zoom
      • Pretty good 90mm FF lens
      • Problematic 400 mm FF lens
      • Tilted 20 mm f/1.8 FF lens
      • Tilted 30 mm MF lens
      • Tilted 50 mm FF lens
      • Two 15mm FF lenses
    • Found a problem – now what?
    • Goals for this test
    • Minimum target distances
      • MFT
      • APS-C
      • Full frame
      • Small medium format
    • Printable Siemens Star targets
    • Target size on sensor
      • MFT
      • APS-C
      • Full frame
      • Small medium format
    • Test instructions — postproduction
    • Test instructions — reading the images
    • Test instructions – capture
    • Theory of the test
    • What’s wrong with conventional lens screening?
  • Previsualization heresy
  • Privacy Policy
  • Recommended photographic web sites
  • Using in-camera histograms for ETTR
    • Acknowledgments
    • Why ETTR?
    • Normal in-camera histograms
    • Image processing for in-camera histograms
    • Making the in-camera histogram closely represent the raw histogram
    • Shortcuts to UniWB
    • Preparing for monitor-based UniWB
    • A one-step UniWB procedure
    • The math behind the one-step method
    • Iteration using Newton’s Method

Category List

Recent Comments

  • JimK on Goldilocks and the three flashes
  • DC Wedding Photographer on Goldilocks and the three flashes
  • Wedding Photographer in DC on The 16-Bit Fallacy: Why More Isn’t Always Better in Medium Format Cameras
  • JimK on Fujifilm GFX 100S II precision
  • Renjie Zhu on Fujifilm GFX 100S II precision
  • JimK on Fuji 20-35/4 landscape field curvature at 23mm vs 23/4 GF
  • Ivo de Man on Fuji 20-35/4 landscape field curvature at 23mm vs 23/4 GF
  • JimK on Fuji 20-35/4 landscape field curvature at 23mm vs 23/4 GF
  • JimK on Fuji 20-35/4 landscape field curvature at 23mm vs 23/4 GF
  • Ivo de Man on Fuji 20-35/4 landscape field curvature at 23mm vs 23/4 GF

Archives

Copyright © 2025 · Daily Dish Pro On Genesis Framework · WordPress · Log in

Unless otherwise noted, all images copyright Jim Kasson.