[SciPy-User] point-curve distance estimation or calculation
Thu Jun 3 05:06:48 CDT 2010
Hi Eat, Jose, Robert, Zachary, Josef and Christopher,
Thanks a lot for all your messages, I needed a bit of time to ingest them
First, here are some precisions to the questions I got, since my message
was not really clear:
- I work with (x,y) coordinates
- I am looking for a leastsq fitting for y = ax² + bx +c
- I want to have the distance from each point to the curve (in this case,
the y-distance, which is fast and already implemented, is OK when the
curve is soft, but quite different to the real distance (ODR-like), when
the curve is strong)
The ODR package, that I didn't found/saw at the beginning is doing what I
want to do, but I have two problems with it :
- It seems like it is not handling masked arrays... For ax+b, I send a
compressed masked array to get the leastsq parameters fit, and afterwards
I calculate the delta on the hole masked N-d array back... Here, the ODR
is doing the leastsq fitting inside (or I misunderstood what function to
give as input)
- It needs a really long processing time. Maybe, in relation to the upper
comment, it is somehow possible to already give the function fit and to
get only the delta as a result (and not all the parameters generated by
the run), to save a bit processing time.
- My x and y are 8bits on one hand and 32 bits on the other hand, this may
slow down the process for the ODR calculation..
I let Robert especially answer on these points, but this is why I was
thinking about estimating the distance via calculating the tangent at this
As Josef, mentioned it, it would only have an acceptable processing time if
I could use a vectorized way to find the tangent or to solve the degree 3
polynomial. But I do not know how this could look like...
On Wednesday 02 June 2010 22:37:43 you wrote:
> Hi Matthieu,
> I'm sending this message first off-list because I'll like to know few
> details more.
> > First I have two sets of data.
> I'm assuming that you are talking about (x, y) co-ordinates here. Right?
> > I am doing several leastsq optimizations. for linear y=ax+b,
> Linear in what sence? Surely f(x)= ax+ b is linear _in the parameters_ a
> and b, and it represents a 'straight line', but f(x) is _not_ linear in
> a sence that for all x, a, b is true: f(x)+ f(x)= 2f(x)!
> > I know how to handle the rest, for second order or more, it is more
> But it doesen't need to be at all that more difficult!
> First I have to ask why you are doing several leastsq optimizations?
> (What follows I'll assume that you actually did it, because you needed
> to 'fit' some 'polylines' to your (x. y) data and now you encounter
> problems when trying to 'fit higher degree polycurves' to the data?).
> > In the y = ax²+bx+c case, I know have a curve.
> Yes indeed, and the parameters (a, b, c) would be estimated 'as easily'
> as with your "y=ax+b" case!!! (Because the parameters (a, b, c) are
> still linear respect to f(x)= ax²+bx+c, and could still be estimated
> with the leastsq!!!)
> > I want to calculate or estimate the distance between each point
> (combination of two data sets) and the curve.
> After this I won't quote your text anymore, because it gets quite
> convolved. However I'll just like to ask your opinion wheter it would
> more suitable (as R. Kern allready in the list suggested of the
> orthogonal distance regression a.k.a total least squares method) to
> consired your problem as a function of both x and y, i.e. your curve(s)
> would be fitted as a function like c= f(x, y)?
> If yes, then there are fast methods available (of'course limited to your
> particular hardware)!
> Please feel free to explain your specific needs in more details ;-)
RapidEye AG Tel: +49-(0)3381-89 04 331
Molkenmarkt 30 Fax: +49-(0)3381-89 04 101
14776 Brandenburg an der Havel
Follow us on Twitter! www.twitter.com/rapideye_ag
Head Office/Sitz der Gesellschaft: Brandenburg an der Havel
Management Board/Vorstand: Wolfgang G. Biedermann
Chairman of Supervisory Board/Vorsitzender des Aufsichtsrates:
Commercial Register/Handelsregister Potsdam HRB 17 796
Tax Number/Steuernummer: 048/100/00053
VAT-Ident-Number/Ust.-ID: DE 199331235
DIN EN ISO 9001 certified
Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese
E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den
Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie
die unbefugte Weitergabe dieser E-Mail ist nicht gestattet.
The information in this e-mail is intended for the named recipients
only. It may contain privileged and confidential information. If you
have received this communication in error, any use, copying or
dissemination of its contents is strictly prohibited. Please erase all
copies of the message along with any included attachments and notify
RapidEye AG or the sender immediately by telephone at the number
indicated on this page.
More information about the SciPy-User