[Numpy-discussion] Blurring an Array

Robert Kern robert.kern at gmail.com
Sun Jun 21 04:05:06 EDT 2009

On Sun, Jun 21, 2009 at 02:04, Ian Mallett <geometrian at gmail.com> wrote:
> Hello,
> I'm working on a program that will draw me a metallic 3D texture.  I successfully made a Perlin noise implementation and found that when the result is blurred in one direction, the result actually looks somewhat like brushed aluminum.  The plan is to do this for every n*m*3 layer (2D texture) in the 3D texture.
> My solution to this anisotropic blurring looks like:
> soften = layerarray.copy()
> total = 1
> for bluriter in xrange(1,5,1):
>     soften[:,bluriter:]  += layerarray[:,:-bluriter]
>     soften[:,:-bluriter] += layerarray[:,bluriter:]
>     total += 2
> soften /= total

Use scipy.ndimage.convolve() and an appropriate convolution kernel.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco

More information about the NumPy-Discussion mailing list