Symmetric nearest neighbour filter

The SNN smoothing filter is designed to preserve edges in data and is very effective at noise reduction. It compares opposite pairs of pixels in the support, and selects those that are closest in value to the central input pixel (see the figure). It then returns the mean of the selected pixels. In this way, it avoids smoothing across edges. In my experience, it is somewhere between the median and Kuwahara filters in terms of edge preservation. It is a good choice for filtering a faulted horizon, for which edge preservation is paramount. According to Hall (2007 ) it is the most versatile filter in the interpreter’s toolkit.

Example
Result h was generated from noisy b to try to recover original a. See smoothing filters for the other methods.



Implementation in Python
This is very slow, but it works.