[SciPy-user] Ignoring pixels with gaussian_filter

alex argriffi@ncsu....
Fri Apr 24 22:51:03 CDT 2009

Thomas Robitaille wrote:
> ...
> # define gaussian function
> def gaussian(cx, cy, w):
>      return lambda x,y: np.exp(-(((cx-x)/w)**2+((cy-y)/w)**2)/2)
 > ...

A neat mathematical property of gaussian blur that is not true of 2d 
kernels in general is that it can be applied to the x and y axes 
separately.  That is, it can be implemented as two 1d passes instead of 
one 2d pass.  This could speed up your code a lot if you aren't already 
doing it.


More information about the SciPy-user mailing list