Re: 2D gaussian fit



Thanks, this does help... assuming it is a mathematically strict
statement. My understanding is that in 3D linear regression
based on least squares Euclidean norm the bound is O(n^3/2).
So at least for some models of data (linear) one _can_ give an
upper bound for complexity.
See e.g. G. H. Golub and C. F. Van Loan, "An analysis of the
total least squares problem.", SIAM. J. Num. Anal. v.17, no. 6,
pp. 883-893, 1980.

Peter Spellucci wrote:
In article <1158780284.774952.305050@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
verm25@xxxxxxxxxxx writes:
>I have an array with data and I want to fit it to a 2D gaussian.
>I am aware of two choices:
>
>1. Find statistical mean and variance and use those as a fit.
>2. Use non-linear least square fit to extract these parameters.
>
>Method #1 fails miserably when the data is from the tail of the
>Gaussian, i.e. when the actual center of the Gaussian is
>outside of the field of view.
>
>Method #2 may work but takes an ill-defined time to converge to
>an answer, such that the number of computations depends on
>the shape of the data.
>
>Thus my question: what is the lowest O(f(n)) algorithm for fitting
>data to 2D Gaussian (without assuming that the field of view
>contains the mean).
>

with no information on the quality of your data and the quality of your
initial guess no method with fixed upper bound complexity can exist for this.
what you could do: combine a good initial guess with some fast and robust
nonlinear least squares code , e.g. one from
http://www.netlib.org/port/n2g.f
a good intial guess could be obtained either by linearizing first taking
logarithms on the positive part of the data (for _one_ gaussian)
with an transformation of variables

log(y_i) = d - (a*x_i^2 + b*x_i*y_i + c*y_i^2 +e*x_i + f*y_i)

from which you can recover the original coefficients if you assume expectation
and variance computed as before. might be you also might use
a expanding subset approach as porposed from some other poster, but because
of the nonlinearity you need a resonable initial guess also for this.
hth
peter

.



Relevant Pages


Loading