4

Is there a name for the following type of filter?

I want to filter a noisy signal $f(x) = f_0(x) + noise(x)$ (where $f_0$ is a noiseless signal), to get a filtered signal $f_\text{F}(x)$ while preserving edges and first derivatives. If all I wanted to do was to preserve edges, I could use a median filter, but if there is a wedge in the signal (the derivative of $f_0$ changes discontinuously from a positive value to a negative value or vice versa), the median filter is going to flatten out that wedge close to the wedge point.

But all the median filter does, effectively, is to fit a constant function $g_x(x')$ by minimizing the mean absolute error between $g_x(x')$ and $f(x')$ for all $x'$ in a small window around $x$ and use $f_\text{F}(x) = g_x(x)$, and the reason why it doesn't preserve first order derivatives close to edges is because it fits a zeroth order polynomial. If $g_x$ could instead be any first-order polynomial, I wouldn't have the median filter anymore, but the filter I would have would then be able to preserve first order derivatives close to edges. And if $g_x$ was an $n$th order polynomial, I presume I would be able to preserve $n$th order derivatives close to edges. I know that the Savitzky–Golay filter and the generalization moving least squares do essentially this, only that they minimize the mean squared error instead of the mean absolute error instead of the mean absolute error.

So, is there some variant of the Savitzky–Golay filter or of moving least squares that minimizes the mean absolute error, the Huber loss, or some other loss function with bounded derivative? I know that I can just define such a filter myself, but I'm looking for a name for such a filter, so that I can read more about it and also reference it.

Edit: this question was closed because it “needs details or clarity.” So I’m asking the people who might want to close it for that reason, or who voted to close it for that reason (so I can improve the question): What details is it that you think are missing? In which way should the question be clarified?

HelloGoodbye
  • 645
  • 3
  • 14
  • Since two people have voted to close the question, can I improve it in some way? – HelloGoodbye Oct 24 '23 at 16:46
  • There is something called a bilateral-filter which may be what you are looking for – user619894 Nov 05 '23 at 19:00
  • @user619894 Thanks for your suggestion, but the bilateral filter is not what I’m after. I’m specifically looking for a robust version of Savitzky–Golay filter or of moving least squares, that is, a filter that fits a polynomial locally in each point. Besides, the bilateral filter also flattens out wedges close to the wedge point. – HelloGoodbye Nov 06 '23 at 09:26
  • wiki says it is edge preserving, so with some tweaking (eg, applying to the derivative) it may be also "wedge preserving". – user619894 Nov 06 '23 at 09:28
  • @user619894 If you filter based on the derivative, the bilateral filter will still reduce the derivative to about 50% of its initial value close to a wedge. This is because it will still calculate a weighted average of points will lower values (for an upward directed wedge) that the point that is currently being filtered, which will result in a lower value, and therefore a dampened wedge as a result. – HelloGoodbye Nov 06 '23 at 16:57
  • Now when I think about it though, a robust version of the Savitzky–Golay filter or the moving least squares are probably not able to preserve wedges either, even if it minimizes the mean absolute error... I think using l1 trend filtering may be my best bet at preserving wedges. – HelloGoodbye Nov 06 '23 at 17:02

0 Answers0