[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Anisotropic smoothing operations

Ben Tupper wrote:
> How can I smooth a 2d image with a rectangular (rather than square)
> smoothing window?

Your post presents the answer rather completely already, with demo code and all. Like you, I use
CONVOL for this. I have been wanting to write up a general routine, allowing for fractional
smoothing window widths, circular/elliptical smoothing windows, etc., but I never really got round
to it. I must have all the elements spread somewhere through my codes by now, though. I might post
it in future.

> Is there a way to make CONVOL treat missing data as SMOOTH does?

What I do is set all NaN values in the input array to zero, do the smoothing with CONVOL, and divide
the result by a similarly smoothed version of the original FINITE(InputArray). Where this division
is one by zero, the output element should be NaN, which you might want to set it to by hand to avoid
the arithmetic error thing. If you want to bother.


Jaco van Gorkom                       e-mail: gorkom@rijnh.nl
FOM-Instituut voor Plasmafysica "Rijnhuizen", The Netherlands