I know this is signal dependent, but when facing a new noisy signal what is your bag of tricks for trying to denoise a signal while maintaining sharp transitions (e.g. so any sort of simple averaging, i.e. convolving with a gaussian, is out). I often find myself facing this question and don't feel like I know what I ought to be trying (besides splines, but they can seriously knock down the right kind of sharp transition as well).

P.S. As a side note, if you know some good methods using wavelets, let me know what it is. Seems like they have a lot of potential in this area, but while there are some papers in the 90s with enough citations to suggest the paper's method turned out well, I can't find anything about what methods ended up winning out as top candidates in the intervening years. Surely some methods turned out to be generally "first things to try" since then.


migrated from stackoverflow.com Aug 8 '12 at 12:13

This question came from our site for professional and enthusiast programmers.


L1 norm minimization (compressed sensing) can do a relative better job than conventional Fourier denoising in terms of preserving edges.

The procedure is to minimize an objective function

$$ |x-y|^2 + b|f(y)| $$

where $x$ is the noisy signal, $y$ is the denoised signal, $b$ is the regularziation parameter, and $|f(y)|$ is some L1 norm penalty. Denoising is accomplished by finding the solution $y$ to this optimization problem, and $b$ depends on the noise level.

To preserve edges, depending on the signal $y$, you can choose different penalties such that $f(y)$ is sparse (the spirit of compressed sensing):

  • if $y$ is piece-wise, $f(y)$ can be total variation (TV) penalty;

  • if $y$ is curve-like (e.g. Sinogram), $f(y)$ can be the expansion coefficients of $y$ with respect to curvelets. (This is for 2D/3D signals, not 1D);

  • if $y$ has isotropic singularities (edges), $f(y)$ can be the expansion coefficients of $y$ with respect to wavelets.

When $f(y)$ is the the expansion coefficients with respect to some basis functions (like curvelet/wavelet above), solving the optimization problem is equivalent to thresholding the expansion coefficients.

Note this approach can also be applied to deconvolution in which the objective function becomes to $|x-Hy|+ b|f(y)|$, where $H$ is the convolution operator.

  • $\begingroup$ Good summary chaohuang, however can you please expand on: 1) In the first equation, we are solving for $y$, how does it then exist in the objective function?... Is the objective function being minimized across the entire space of $y$? (Example, if $y$ is an N-dimensional vector, is the convex/non-convex adaptive algorithm moving across THIS N-dimensional space? $\endgroup$ – Spacey Aug 8 '12 at 12:19
  • 1
    $\begingroup$ I would also mention LASSO regularization for $L_1$ norm. $\endgroup$ – Phonon Aug 8 '12 at 15:21
  • $\begingroup$ What methods do you like for solving for f, especially if the signal is long. $\endgroup$ – John Robertson Sep 20 '12 at 20:08
  • $\begingroup$ What is the name of this method? If I use it in my research, what should I cite? $\endgroup$ – bayer Oct 24 '12 at 19:09
  • $\begingroup$ @bayer It depends on what regularization you use, it could be curvelet denoising or wavelet denoising, for example. In general, they all belong to the family of L1 norm minimization. $\endgroup$ – chaohuang Oct 25 '12 at 1:11

Chaohuang has a good answer, but I will also add that one other method that you can use would be via the Haar Wavelet Transform, followed by wavelet co-efficient shrinkage, and an Inverse Haar Transform back to the time-domain.

The Haar wavelet transform decomposes your signal into co-efficients of square and difference functions, albeit at different scales. The idea here is that you 'force' the new square signal representation to best match your original signal, and thus one that best represents where your edges lie.

When you perform a co-efficient shrinkage, all that means is that you are setting specific co-efficients of the Haar transformed function to zero. (There are other more involved methods, but that is the simplest). The Haar transformed wavelet co-efficients are scores associated with different square/difference functions at different scales. The RHS of the Haar transformed signal represents square/difference bases at the lowest scale, and thus, can be interpreted, at the 'highest frequency'. Most of the noise energy will thus lie here, VS most of the signal's energy that would lie on the LHS. Is is those bases co-efficients that are nulled out and the result then inverse transformed back to the time-domain.

Attached is an example of a sinusoid corrupted by heavy AWGN noise. The objective is to figure out where the 'start' and 'stop' of the pulse lie. Traditional filtering will smear the high-frequency (and highly localized in time) edges, since at its heart, filtering is an L-2 technique. In contrast, the following iterative process will denoise as well as preserve edges:

(I thought one could attach movies here, but I do not seem to be able to. You can download movie I made of the process here). (Right click and 'save link as').

I wrote the process 'by hand' in MATLAB, and it goes like this:

  • Create a sinusoid pulse corrupted by heavy AWGN.
  • Compute the envelope of the above. (The 'signal').
  • Calculate the Haar Wavelet Transform of your signal at all scales.
  • Denoise by iterative co-efficient thresholding.
  • Inverse Haar Transform the shrunk co-efficient vector.

You can clearly see how the co-efficients are being shrunk, and the resulting Inverse Haar Transform resulting from it.

One drawback of this method however, is that the edges need to lie in or around the square/difference bases at a given scale. If not, the transform is forced to jump to the next higher level, and thus one loses an exact placement for the edge. There are multi-resolution methods used to counter act this, but they are more involved.


You can consider anisotropic diffusion. There are many methods based on this technique. Generally spoken, it is for images. It is an adaptive denoising method which aims to smooth non-edge parts of an image, and preserve edges.

Also, for Total variation minimization, you can use this tutorial. Authors provide MATLAB code also. They recognize the problem as an analysis prior problem, it is somehow similar to using a linear mapping (such as time-frequency representations). But, they use a difference matrix rather than a transform.

Just another interesting approach is provided by Boyd, appears as Trend Filtering. This is also very similar to the TV regularization, but I guess Boyd use a different $D$ matrix in the problem formulation.


A simple method that often works is to apply a median filter.


Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.