GSM(1)

NAME
gsm - 1D gaussian smoothing

SYNOPSIS
[xsm, Xsm] = gsm(x [, sigma, in, out])
[xsm, Xsm] = gsm(x, <named_args>)

INPUT PARAMETERS

x   the vector to be smoothed (row or column vector), real or complex.

sigma
    the standard deviation of the gaussian kernel. If sigma is zero, gsm returns the input vector unaltered in xsm. (Defaults to 5)

in  indicates if the input, x, is a function of time (no FFT has been applied) or frequency (FFT has already been applied). Can be 'time' or 'frequency'. (Defaults to 'time')

out indicates if the output, xsm, is a function of time (inverse FFT will be applied) or frequency (inverse FFT will not be applied). Can be 'time' or 'frequency'. (Defaults to 'time')

<named_args>
    This is a sequence of statements key1=value1, key2=value2,... where key1, key2,... can be any of the optional arguments above (sigma, in, out), in any order.

OUTPUT PARAMETERS

xsm the smoothed vector in "time" or "frequency" domain.

Xsm the smoothed vector in "frequency" domain.

DESCRIPTION
Function gsm performs gaussian smoothing of the vector x, with standard deviation sigma, using FFT. The optional arguments in and out enables the user to reuse previously done FFTs. Here are some possible uses of gsm:

xsm = gsm(x)
    sigma defaults to 5, in and out both defaults to 'time'.

xsm = gsm(x,15)
    sigma equals 15, in and out both defaults to 'time'.

xsm = gsm(x,15, out='frequency')
    x in time domain. xsm in frequency domain (inverse fft is NOT done by gsm)

xsm = gsm(x,15,in='frequency', out='frequency')
    x in frequency domain (fft has already been done). xsm in frequency domain (inverse fft is NOT done by gsm)

xsm = gsm(x, 'frequency')
    sigma defaults to 5 x in frequency domain. xsm in time domain (inverse fft is done by gsm)

In all above examples, Xsm is in the frequency domain. It is the second output parameter, and thus it was discarded in the above examples.

EXAMPLE
initial_dir = PWD;
chdir (SIPDIR + 'examples');
Img = imread('star.bmp');
xset('window',0);
xbasc()
imshow(Img,2);
[x,y] = follow(Img);  // get the parametric contour
xset('window',1)
xbasc()
plot2d(1:size(x,'*'),x,2);
plot2d(1:size(y,'*'),y,1);
xsm = gsm(x,15);  // gaussian-smooth the contour
ysm = gsm(y,15);
// builds an image from parametric contour:
Img2=unfollow(xsm,ysm,size(Img));
xset('window',0);
xbasc()
imshow(Img2,2);
chdir(initial_dir);

AUTHORS
Ricardo Fabbri <rfabbri@if.sc.usp.br>

AVAILABILITY
The latest version of the Scilab Image Processing toolbox can be found at

    http://cyvision.if.sc.usp.br/~rfabbri/sip/

SEE ALSO
gsm2d, fft