Skip to content

Latest commit

 

History

History
26 lines (20 loc) · 2.23 KB

Readme.md

File metadata and controls

26 lines (20 loc) · 2.23 KB

robust_smooth_2d

A simplified Python translation of Damien Garcia's MATLAB code for interpolating and smoothing data with robust outlier detection. Garcia's code works for 1D, 2D, and 3D data and can also handle multiple components (e.g., vector components at each location in a 2D field). This stripped down Python translation only handles single component 2D data, e.g., grayscale images.

A few keyword arguments are provided for testing:

  1. You can manually specify a smoothing factor, e.g., s=15, which will over-ride the built-in automated computation.
  2. You can turn off the robust outlier detection with robust=False.

If you want to simply smooth an image, there are plenty of other methods you can use that may work better. Same if you just want to interpolate missing pixels in an image. But if you have data that contains outliers and missing pixels, this appears to be a good solution.

clean and noisy data noisy with missing data and robust smooth result

As with any smoothing algorithm, you lose valid high frequency information. However, by using a robust method for downweighting outliers, the algorithm is able to apply less aggressive smoothing, which in turn retains more of the valid high frequency information.

Notes

  • The number of iterations, which is controlled by the hard-coded tolerance threshold value, impacts the smoothing (in addition to the smoothing factor s).
  • Outlier detection is influenced by the hard-coded divisor of the studentized residuals in the bisquare weight computation.

References