Gaussian smoothing kernel with different sigma values

1.6k Views Asked by At

I am not a mathematician by training, so excuse my lack of vocabulary or the imprecision in my question.

I have a 1D distribution that I need to convolute, using a Gaussian kernel. However, all the functions that are out there, be it MATLAB, python, mathematica or R are dedicated to image blurring and have a single scalar value for the sigma of the Gaussian distribution. For example:

[Python gaussian filter function][1]

However, the distribution I have, has different sigma along the x-axis, if that makes sense.

Is there a way to create a Gaussian kernel used for smoothing that has different sigma values along the x-axis?

Thanks is advance.

1

There are 1 best solutions below

1
On

Suppose you have a linear combination of Gaussians:

$$k(x)=a_1N_1(x)+\cdots+a_n N_n(x),$$

where each gaussian $N_i(x):=\frac{1}{\sqrt{2\pi \sigma_i^2}}e^{-(x-\mu_i)^2/2\sigma_i^2}.$ Then if your function is $f(x)$ then

$$[f\star k](t)=\sum_{i=1}^n a_i [f\star N_i](t).$$

It sounds like your program knows how to calculate $[f\star N_i](t)$, so the answer will be the sum of convolutions for each $N_i$.