[SciPy-user] fitting mixed gaussians

Gael Varoquaux gael.varoquaux at normalesup.org
Wed Jul 25 11:51:32 EDT 2007


On Wed, Jul 25, 2007 at 05:46:40PM +0200, Emanuele Zattin wrote:
> i'm trying to perform mixed-gaussian fitting on some small greyscale
> images (5x5 pixels, maximum 9x9). right now i'm using a leastsq
> approach but it tends to get pretty slow and unreliable when it comes
> to fit 4-5 2D gaussians even in such a small domain.

Is the gaussian spot well centered on the image ?

If so then I reckon you are interested in finding its width ? Maybe I am
wrong, byt if I am right an approach that works very well is to determine
the second momentum of the intensity/position distribution. This is not
an optimisation procedure and is very quick. Reliability depends on the
kind of data you are processing.

Some code doing this can be found on
http://scipy.org/Cookbook/FittingData#head-11870c917b101bb0d4b34900a0da1b7deb613bf7

HTH,

Gaël



More information about the SciPy-User mailing list