s-news
[Top] [All Lists]

Gaussian kernel

To: S-news list <s-news@lists.biostat.wustl.edu>
Subject: Gaussian kernel
From: Catalina Mesina <cmesina@cs.vu.nl>
Date: Thu, 24 Oct 2002 13:00:09 +0200
Hello Dear S+ users:


I would like to make a Gaussian kernel to smooth(convolv) some 2D-images
something that in matlab cab be wrote:

% 2d Gaussian kernel 
Dim = [20 20];
fineness = 0.1;
[x2d,y2d] = meshgrid(-(Dim(2)-1)/2:fineness:(Dim(2)-1)/2,...
                 -(Dim(1)-1)/2:fineness:(Dim(1)-1)/2);
gf    = exp(-(x2d.*x2d + y2d.*y2d)/(2*sig*sig));
gf    = gf/sum(sum(gf))/(fineness^2);


How can I make this grid of points and the matrix of results without using 
"for"? 

Thanks for any help,

Catalina Mesina

<Prev in Thread] Current Thread [Next in Thread>