# Choice of Gaussian kernel parameters when lowpass filtering before image resampling?

I need to decimate a signal by a factor of q.

More specifically my signal is a 3D "image": $\ I(x_i,y_j,z_k)$, which I need to downsample by a factor of two in the z direction.

I want to do lowpass filtering before decimation by convolving with a Gaussian kernel of size n.

I create my Gaussian kernels 2 standard deviations below and above 0 since this accounts for 95 % of the distribution.

I am looking for a rule of thumb that tells me how large n should be.

Am I right in thinking that the Gaussian should filter out all frequencies above fN/q, where fN: Nyquist frequency of original signal?

I know that the Fourier of a Gaussian with standard deviation $\ \sigma$ is another Gaussian with standard deviation $\ \sigma^* =1/\sigma$. I am not sure how strict my lowpass filter should be. Should the cut frequency, fc, be at 2 or 3 standard deviations?

What is then the equation for the cut frequency, fc, of a Gaussian kernel with size n: fc(n)=?

Below is the frequency response of some Gaussian kernels calculated in Matlab:

My actual problem involves q = 2, and from this figure I see that n=5 should work nicely. It would have been good to have a rule of thumb do, so I did not have to do this for each q I encounter.

-
Is there any particular reason why you're using a Gaussian filter? There are other filter types that give more freedom in choosing your passband/stopband characteristics. I probably would not use a Gaussian filter as an antialiasing (i.e. pre-decimation) filter. –  Jason R Nov 1 '12 at 12:50
There's not really a "next step up", but the window method is also a very simple filter design method that might suit your needs a bit better. Digital approximations to classic analog filter families like Butterworth, Chebyshev, and elliptic filters are also an option. For more control over the filter's response, you could use the Parks-McClellan algorithm‌​, which aim for specifyable equiripple behavior in both the stopband and passband. –  Jason R Nov 1 '12 at 13:27
I would say since you seem new to this to use 'fdatool' in MATLAB. If you insist upon using a Gaussian window, then look at the well established Fourier transform pair for Gaussian signals (hint: it's another Gaussian!). –  Bryan Nov 1 '12 at 13:51
@Andy: I've heard of that (Lanczos) method being used in image processing before (not my area of expertise). Just my two cents, but I think you'll find that in general, many image processing approaches are less based upon strict signal-processing guidelines and more upon what has been judged to work well and look nice. Specifically, I don't think it's typical to rigorously design a pre-decimation antialiasing filter with specific passband and stopband spatial frequencies. Instead, there are some resampling/blurring approaches that have been found to be good choices. –  Jason R Nov 2 '12 at 2:38
@Andy: You might edit the question to indicate specifically that you're doing image resampling. A better way to couch it might be to ask "when applying a Gaussian blur before downsampling an image, what's a good way to choose appropriate parameters for the Gaussian kernel?" –  Jason R Nov 2 '12 at 2:39