GSM

NAME
SYNOPSIS
INPUT PARAMETERS
OUTPUT PARAMETERS
DESCRIPTION
EXAMPLE
AUTHORS
AVAILABILITY
SEE ALSO

NAME

gsm - 1D gaussian smoothing

SYNOPSIS

[xsm, Xsm] = gsm(x [, sigma, delta, 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)
delta
a double number. If the input is in the time domain, this is the time between samples (delta t), and defaults to 1. If the input is in the frequency domain, this is the frequency increment between samples (delta f), and defaults to 1/N, where N is the number of samples.
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', delta=0.1)
delta f is 0.1 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 + 'images');

Img = imread('star.bmp');
xset('window',0);
xbasc()
imshow(Img,2);
[x,y] = follow(Img);  // get the parametric contour
xset('window',1)
xbasc()
t=1:size(x,'*');
plot2d(t,x,2);
plot2d(t,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://siptoolbox.sourceforge.net

SEE ALSO

gsm2d, fft