SIP Toolbox

gsm - 1D gaussian smoothing

Calling Sequence

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

Input Parameters

Output Parameters

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')
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.

Examples

       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
       t=1:size(x,'*');
       xset('window',1)
       xbasc()
       subplot(121)
       plot2d(t,x,2);
       subplot(122)
       plot2d(t,y,1);

       xsm = gsm(x,15);    // gaussian-smooth the contour
       ysm = gsm(y,15);
       subplot(121)
       plot2d(t,xsm,2);
       subplot(122)
       plot2d(t,ysm,1);

       // 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 <ricardofabbri (AT) users DOT sf DOT net>

Availability

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

http://siptoolbox.sourceforge.net

See Also

gsm2d,  fft,