[SciPy-user] fitting mixed gaussians

Emanuele Zattin emanuelez@gmail....
Wed Jul 25 10:58:50 CDT 2007


On 7/25/07, Gael Varoquaux <gael.varoquaux@normalesup.org> wrote:
> 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

The gaussian I am interested is indeed at the center of the images,
but very often more maxima are present at the boundaries so i try to
fit more gaussians. I am aware of the cookbook page... it's really
interesting and it helped me a lot in the first steps. On the other
side a momentum approach is not as easy when more gaussians are
present.


More information about the SciPy-user mailing list