[Numpy-discussion] Blurring an Array
Sun Jun 21 03:05:06 CDT 2009
On Sun, Jun 21, 2009 at 02:04, Ian Mallett <firstname.lastname@example.org> wrote:
> 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.
"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