comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: fitting contours with ellipse
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: fitting contours with ellipse [message #69338] Tue, 05 January 2010 07:55 Go to next message
fburton is currently offline  fburton
Messages: 19
Registered: June 2003
Junior Member
In article <MPG.25ace65126e824569896c7@news.giganews.com>,
David Fanning <news@dfanning.com> wrote:
> Alas, the problem with the contours that come from
> the contour command is that some of the time they
> are NOT "well spaced". In fact, they are vectors.
> So, if a contour segment is straight (say along an edge)
> there will be no points at all between the ends
> of the straight segment.

Good point - but for a complete set of edge points to fit
an ellipse well would require it to be exceedingly eccentric.
A likely alternative is that part of the ellipse lies outside
the contoured area, in which case not having any points along
the straight edge would give a better fit.

> It was to get around this problem (among others) that
> I wrote ArcSample, which samples a closed curve at
> approximately equal intervals. It essentially
> digitizes a contour line so you can do something
> useful with it later. (I used it in my ActiveContour
> program.)
>
> http://www.dfanning.com/programs/arcsample.pro

That's neat!

Francis
Re: fitting contours with ellipse [message #69341 is a reply to message #69338] Tue, 05 January 2010 05:02 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Francis Burton writes:

> One requirement for a 'good fit' in this case is to have as
> much of the ellipse represented by data points as possible
> (i.e. no big gaps). The set of coordinates returned by CONTOUR
> using the PATH_INFO keyword should be well-spaced at least;
> whether there are enough coordinates will depend on the size
> of the contour path in relation to the grid spacing. I would
> simply feed the coordinates to the ellipse-fitting routine
> and see if it produces sensible results for your data.

Alas, the problem with the contours that come from
the contour command is that some of the time they
are NOT "well spaced". In fact, they are vectors.
So, if a contour segment is straight (say along an edge)
there will be no points at all between the ends
of the straight segment.

It was to get around this problem (among others) that
I wrote ArcSample, which samples a closed curve at
approximately equal intervals. It essentially
digitizes a contour line so you can do something
useful with it later. (I used it in my ActiveContour
program.)

http://www.dfanning.com/programs/arcsample.pro

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: fitting contours with ellipse [message #69343 is a reply to message #69341] Tue, 05 January 2010 03:22 Go to previous messageGo to next message
fburton is currently offline  fburton
Messages: 19
Registered: June 2003
Junior Member
In article <2219a304-4c24-4d4d-ab33-4e8c2dce92de@m25g2000yqc.googlegroups.com>,
collinritzinger <b0burk02@gmail.com> wrote:
> I have several contour maps and I'd like to have a more quantitative
> way of describing how 'peaked' or 'boxy/circular' they are. I was
> thinking of doing this by fitting an ellipse to the contours and
> examining best fit parameters. People have done this for blobs before
> (see http://www.dfanning.com/ip_tips/fit_ellipse.html) but I'm not so
> sure how to go about it for contours. Do you all have any ideas?
> Thanks!

One requirement for a 'good fit' in this case is to have as
much of the ellipse represented by data points as possible
(i.e. no big gaps). The set of coordinates returned by CONTOUR
using the PATH_INFO keyword should be well-spaced at least;
whether there are enough coordinates will depend on the size
of the contour path in relation to the grid spacing. I would
simply feed the coordinates to the ellipse-fitting routine
and see if it produces sensible results for your data.

Francis
Re: fitting contours with ellipse [message #69432 is a reply to message #69338] Fri, 08 January 2010 10:24 Go to previous message
natha is currently offline  natha
Messages: 482
Registered: October 2007
Senior Member
Hi,

I use mpfit and mpfitellipse from NASA/GSFC.http://
cow.physics.wisc.edu/~craigm/idl/idl.html
Maybe it can helps you!

Happy new year,
nata
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: How to get IDL 6.3 to create TIFF file using signed 16-bit integers.
Next Topic: Re: envi_title_bar.ico missing and null pointer dereferenced error when using .sav file in ENVI

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 20:01:39 PDT 2025

Total time taken to generate the page: 0.04394 seconds