commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [math] Re: 2D Gaussian Fit
Date Mon, 17 Aug 2009 12:53:29 GMT
Hi Jean-François,

First, please use a [math] marker in the subject line when asking something about
commons-math. This mailing list is shared by all commons components so these markers
help filtering messages.

----- "Jean-Francois Daune" <> a écrit :

> Is it possible to perform a 2D Gaussian fit (giving center_x,
> center_y, sigma_x, sigma_y, theta) with Commons Math?

Yes it is possible. You will have to use the optimization package, and most probably
the LevenbergMarquardtOptimizer class from the general subpackage. This will be the main
algorithm that will perform the fit. You should implement your problem as your own class
implementing the DifferentiableMultivariateVectorialFunction interface (i.e. a class
that provides a "double[] value(double[] point)" method and a "MultivariateMatrixFunction
jacobian()" method (which itself wraps another value function). In your case, the point[]
parameters for both value functions will be the parameters of your fit, i.e. center_x, center_y,
sigma_x, sigma_y and theta. You can look in the junit tests of the library. In the
LevenbergMarquardtOptimizerTest class there is a Circle internal class that implements a fitting
problems for observed points that should lie on a circle. You can use this as an example to
implement your own Gauss2D class.

If this information is not sufficient, do not hesitate to ask and I'll try to provide more.


> Any help is appreciated.
> J-F
> The contents of this e-mail message and any attachments are intended
> solely for 
> the recipient (s) named above. This communication is intended to be
> and to 
> remain confidential and may be protected by intellectual property
> rights. Any 
> use of the information contained herein (including but not limited to,
> total or 
> partial reproduction, communication or distribution of any form) by
> persons 
> other than the designated recipient(s) is prohibited. Please notify
> the sender 
> immediately by e-mail if you have received this e-mail by mistake and
> delete 
> this e-mail from your system. E-mail transmission cannot be guaranteed
> to be 
> secure or error-free. Ion Beam Applications does not accept liability
> for any 
> such errors. Thank you for your cooperation.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message