[SciPy-User] Gaussian filter on an angle
Fri Jun 4 05:38:17 CDT 2010
On 4 June 2010 06:00, Matthieu Brucher <email@example.com> wrote:
> I'm trying to blur an angle field, but it's not easy ;)
> Applying gaussian_filter (from ndimage) on the sinus and the cos is
> not enough to have a smooth angle field, and of course applying
> gaussian_filter directly on the angle field does not yeild
> satisfactiry results.
> Does anyone know of a function (even if it not in Python yet) that
> could gaussian filter an angle field? Something like a Riemanian
> filter (instead of an Euclidian one)...
This isn't my field, but I suspect you will have problems with this.
In particular, there is a *topological* obstacle to blurring angle
fields. In the blurred field, you want each angle to be close to that
of nearby pixels. But imagine following the angle around the image in
a circle: the angle changes by one full turn as you go around this
loop. Any smoothing mechanism must either introduce a discontinuity in
this loop or retain one full turn around the loop. The former is
unlikely to be desirable, and the latter is asking rather a lot of a
smoothing method, and in any case still results in rapidly-changing
angles around small loops. You could look into "phase unwrapping",
techniques to reconstruct a function from its values modulo 2 pi;
obviously once you had an unwrapped function blurring would work
normally. In this setting unwrapping simply fails when there are
topological obstacles. The alternative I would suggest is what you
already tried, converting your angles to a vector field and smoothing
that. You'll still get defects where the angles change rapidly, but I
don't think that can be avoided, and the length of the resulting
vectors will tell you something about the degree of defectiveness.
The key to making any of this work is having original angles that are
not too noisy. If you're extracting the angles from some underlying
data, say by calculating an average direction over squares of an
image, I recommend using enough averaging to get the noise on the
angle quite small, so that defects will be rare. You may find yourself
needing to resolve defects manually if you can't just live with them.
P.S. This sort of topological obstruction is the origin for
hypothetical "cosmic strings" as well as some of the neat dynamics of
vortices in inviscid fluids and magnetic fields in type II
> Information System Engineer, Ph.D.
> Blog: http://matt.eifelle.com
> LinkedIn: http://www.linkedin.com/in/matthieubrucher
> SciPy-User mailing list
More information about the SciPy-User