[SciPy-user] fitting mixed gaussians

Stefan van der Walt stefan@sun.ac...
Wed Jul 25 10:55:48 CDT 2007

Hi Emanuele

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.
> I've noticed PyEM and i have the feeling it might be useful for me,
> but here i'm dealing with pixel intensities, not distributions. Any
> hint is welcome!

Expectation maximisation should work well for your needs.  Take a look
at the lecture notes at


You can view your MxN image as an MN-dimensional vector and follow the
same process as you would for other types of features.  If the
dimensionality becomes a problem, you'll have to look at feature
extraction or dimension reduction (using methods like the
Karhunen-Loeve transform or linear discriminant analysis).


More information about the SciPy-user mailing list