I am writing this post to introduce you to the Hampel filter library I just finished writing and posted here: http://github.com/flrs/HampelFilter.
The Hampel filter library uses a Hampel filter to identify outliers in data. The library is optimized for speed and comes with an example sketch.
Hampel filters are known to perform better for outlier detection than median filters. This is because, other than median filters, Hampel filters also take the distribution of data into account. While median filters often work with a fixed threshold for outlier detection, Hampel filters use a scaling factor which takes the distribution of the data into account. In other words: If all recorded values are really close to the median, the Hampel filter adjusts to find the values that are not so close to the median. When later in the process recorded values are generally farther away from the median, the Hampel filter automatically adjusts to this and identifies outliers as points that are even farther away from the median. With usual Median filters with a fixed threshold this behavior is difficult to achieve.
- Changed original bubble sort algorithm to comb sort algorithm as it performs faster.
- Allow only floating point numbers in the range from -255.00 to 255.00 as inputs to the buffer to be able to perform integer-only calculations internally. This improves performance.
- Added functions to determine the median absolute deviation.
I am looking forward to your feedback and comments!