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

Home » Public Forums » archive » Re: Following a ridgeline
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: Following a ridgeline [message #60862] Wed, 18 June 2008 11:10 Go to next message
Jelle is currently offline  Jelle
Messages: 19
Registered: May 2008
Junior Member
On Jun 18, 4:55 pm, Jean H <jghas...@DELTHIS.ucalgary.ANDTHIS.ca>
wrote:

> I like the "why programmers are lazy and dumb" link on your page.. it is
> indeed hard to solve a problem that can not be defined :-)
>
> Jean

hehe, me too. For those who might like it but are not keen to see my
personal site; it points to this site: http://blogoscoped.com/archive/2005-08-24-n14.html
Re: Following a ridgeline [message #60863 is a reply to message #60862] Wed, 18 June 2008 11:02 Go to previous messageGo to next message
Jelle is currently offline  Jelle
Messages: 19
Registered: May 2008
Junior Member
On Jun 18, 5:14 pm, Juggernaut <juggernau...@gmail.com> wrote:
> As far as I can tell it seems that a ridge is normally if not always
> the tallest point in its local environment. If you scan the image on
> a going from the top row to the bottom row and get the maximum value
> in that row and report that back and then do the same from the first
> column to the last column and report those values back you have a
> decent outline of the ridge (meaning haven't tried it). It would be
> even more robust if you went through the image on 45 degree diagonals
> as well and report those back so that completely horizontal. Seems
> like it would work to me.

problem is of course.. the ridge in general is the tallest ponts in
the local area. Except for trenches and local dips :). Tha is why I
suggested looking at mean levels a bit further away. hm.. getting to
the point that a piece of paper and a pencil come out :)
Re: Following a ridgeline [message #60864 is a reply to message #60863] Wed, 18 June 2008 09:14 Go to previous messageGo to next message
Juggernaut is currently offline  Juggernaut
Messages: 83
Registered: June 2008
Member
As far as I can tell it seems that a ridge is normally if not always
the tallest point in its local environment. If you scan the image on
a going from the top row to the bottom row and get the maximum value
in that row and report that back and then do the same from the first
column to the last column and report those values back you have a
decent outline of the ridge (meaning haven't tried it). It would be
even more robust if you went through the image on 45 degree diagonals
as well and report those back so that completely horizontal. Seems
like it would work to me.
Re: Following a ridgeline [message #60865 is a reply to message #60864] Wed, 18 June 2008 08:55 Go to previous messageGo to next message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
Jelle wrote:
> On Jun 17, 6:14 pm, Jean H <jghas...@DELTHIS.ucalgary.ANDTHIS.ca>
> wrote:
>> Hum... an edge is not necessarily the lowest slope...
>
> Agreed, but a ridge would be, wouldn't it?

hum....
let's think of a prism laying on the kitchen table: the top edge is a
ridge, the slope of the ridge is zero and 2 "steep" plan lay on each
side. Now let's put the prism on one of its triangle (and add a small
angle). The same ridge is now almost vertical and the slope of the plans
on each side is now smaller...

> But possibly that is exactly the problem: When is a ridge a ridge.
> When that can be define propely, one can model a solution.

agreed...
I like the "why programmers are lazy and dumb" link on your page.. it is
indeed hard to solve a problem that can not be defined :-)

Jean
Re: Following a ridgeline [message #60874 is a reply to message #60865] Wed, 18 June 2008 01:52 Go to previous messageGo to next message
Jelle is currently offline  Jelle
Messages: 19
Registered: May 2008
Junior Member
On Jun 17, 6:14 pm, Jean H <jghas...@DELTHIS.ucalgary.ANDTHIS.ca>
wrote:
> Hum... an edge is not necessarily the lowest slope...

Agreed, but a ridge would be, wouldn't it?
But possibly that is exactly the problem: When is a ridge a ridge.
When that can be define propely, one can model a solution.
Re: Following a ridgeline [message #60884 is a reply to message #60874] Tue, 17 June 2008 10:14 Go to previous messageGo to next message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
Jelle wrote:
>
> How about finding the maximum pixelvalue in the image, and then
> looking at the slope to a 4 pixel (or 6; 9) mean value for all the
> points at a specific distance (e.g., 30 pixels) away? Select the
> location with the lowest slope (Or maximum mean) and continue from
> there.
> Jelle

Hum... an edge is not necessarily the lowest slope...


What about edge detection filters? ... the Canny edge detector seems to
be fairly good (I haven't used it myself though)
http://en.wikipedia.org/wiki/Canny_edge_detector
http://www.isprs.org/istanbul2004/comm3/papers/376.pdf fig 6A

Jean
Re: Following a ridgeline [message #60890 is a reply to message #60884] Tue, 17 June 2008 02:20 Go to previous messageGo to next message
RJA is currently offline  RJA
Messages: 2
Registered: May 2006
Junior Member
On 16 Jun, 20:24, "mzagu...@gmail.com" <mzagu...@gmail.com> wrote:
> Hi,
>
> I've got a 2d map (let's say it's a contour map of a mountain).  I
> need to be able to 'detect' and 'follow' the ridgeline across the
> whole mountain (which does about a 180 degree turn as well, it's U
> shaped).  Anyone know any way to accomplish this?
>
> So far, i've attempted to start at the maximum point, and then look
> for surrounding points that minimizes the downward slope, this
> process, however, creates switchbacks at peaks and doesnt follow the
> peak down along a ridge.  Any ideas?
>
> Thanks!

Have you tried to find the medial axis? The thin() function calculates
this for you.

Cheers, Richard.
Re: Following a ridgeline [message #60891 is a reply to message #60890] Tue, 17 June 2008 02:01 Go to previous messageGo to next message
Peter Clinch is currently offline  Peter Clinch
Messages: 98
Registered: April 1996
Member
Kenneth P. Bowman wrote:

> You could look for the maximum curvature of the contour lines.
> It might be necessary to add some non-artificial intelligence to
> get the final result the way you want.

As a keen hillwalker, orienteer and skier who often needs to do this it
got me thinking... I think Ken's idea is probably a good way.

One thing the nAI will particularly have to look for is gullies right
next to the ridges which may have sharp contour curves too, but the
other way. Perhaps check the direction of successive "arrowheads"
against one another and make sure they haven't spun through too big an
arc (180 degrees would certainly suggest you've Got It Wrong...). That
might also be a way to decide which side of a bifurcation you'd follow.

But I haven't got anything as useful as an algorithm that actually tells
you /how/ :-(

Pete.
--
Peter Clinch Medical Physics IT Officer
Tel 44 1382 660111 ext. 33637 Univ. of Dundee, Ninewells Hospital
Fax 44 1382 640177 Dundee DD1 9SY Scotland UK
net p.j.clinch@dundee.ac.uk http://www.dundee.ac.uk/~pjclinch/
Re: Following a ridgeline [message #60892 is a reply to message #60891] Mon, 16 June 2008 16:14 Go to previous messageGo to next message
Jelle is currently offline  Jelle
Messages: 19
Registered: May 2008
Junior Member
How about finding the maximum pixelvalue in the image, and then
looking at the slope to a 4 pixel (or 6; 9) mean value for all the
points at a specific distance (e.g., 30 pixels) away? Select the
location with the lowest slope (Or maximum mean) and continue from
there. That should give you a reasonable indication of the path that
the ridge follows? Once you have the crude outline you can improve by
searching within the interpixel path in a region of a few pixels wide
for the best path to follow?

You will need to allow for some maximum curvature in the slope (e.g.
90 deg lef / right) from the direction of the last two consecutive
points to allow curving of the ridge, without backtracking. Also:
Going uphill after N steps should be allowed, to allow for undulating
ridgelines. But again: only within the curvature parameters?

Jelle
Re: Following a ridgeline [message #60893 is a reply to message #60892] Mon, 16 June 2008 12:37 Go to previous messageGo to next message
Kenneth P. Bowman is currently offline  Kenneth P. Bowman
Messages: 585
Registered: May 2000
Senior Member
In article
<9b50eb9a-33ea-40a2-8e0a-5e7e92bf52a8@x35g2000hsb.googlegroups.com>,
"mzagursk@gmail.com" <mzagursk@gmail.com> wrote:

> Hi,
>
> I've got a 2d map (let's say it's a contour map of a mountain). I
> need to be able to 'detect' and 'follow' the ridgeline across the
> whole mountain (which does about a 180 degree turn as well, it's U
> shaped). Anyone know any way to accomplish this?
>
> So far, i've attempted to start at the maximum point, and then look
> for surrounding points that minimizes the downward slope, this
> process, however, creates switchbacks at peaks and doesnt follow the
> peak down along a ridge. Any ideas?
>
> Thanks!

You could look for the maximum curvature of the contour lines.
It might be necessary to add some non-artificial intelligence to
get the final result the way you want.

Ken Bowman
Re: Following a ridgeline [message #60894 is a reply to message #60893] Mon, 16 June 2008 13:34 Go to previous messageGo to next message
mzagursk@gmail.com is currently offline  mzagursk@gmail.com
Messages: 9
Registered: June 2008
Junior Member
On Jun 16, 1:15 pm, "mzagu...@gmail.com" <mzagu...@gmail.com> wrote:
> On Jun 16, 12:49 pm, David Fanning <n...@dfanning.com> wrote:
>
>
>
>> mzagu...@gmail.com writes:
>>> I've got a 2d map (let's say it's a contour map of a mountain). I
>>> need to be able to 'detect' and 'follow' the ridgeline across the
>>> whole mountain (which does about a 180 degree turn as well, it's U
>>> shaped). Anyone know any way to accomplish this?
>
>>> So far, i've attempted to start at the maximum point, and then look
>>> for surrounding points that minimizes the downward slope, this
>>> process, however, creates switchbacks at peaks and doesnt follow the
>>> peak down along a ridge. Any ideas?
>
>> The obvious idea is the WATERSHED function. Have you
>> tried that?
>
>> 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.")
>
> Yes, but I'm not sure how to implement it in such a way to output the
> ridge. This 'image' is simply a background of 0's with a single
> ridgeline rising out of it. When I use watershed, it give me bogus
> answers, lines that make no sense at all.

Here's an image of what I'm talking about: http://www.mattzag.com/mountain_example.tiff
I need to follow the long ridgeline and output those points. Thanks a
bunch.
Re: Following a ridgeline [message #60895 is a reply to message #60893] Mon, 16 June 2008 13:15 Go to previous messageGo to next message
mzagursk@gmail.com is currently offline  mzagursk@gmail.com
Messages: 9
Registered: June 2008
Junior Member
On Jun 16, 12:49 pm, David Fanning <n...@dfanning.com> wrote:
> mzagu...@gmail.com writes:
>> I've got a 2d map (let's say it's a contour map of a mountain). I
>> need to be able to 'detect' and 'follow' the ridgeline across the
>> whole mountain (which does about a 180 degree turn as well, it's U
>> shaped). Anyone know any way to accomplish this?
>
>> So far, i've attempted to start at the maximum point, and then look
>> for surrounding points that minimizes the downward slope, this
>> process, however, creates switchbacks at peaks and doesnt follow the
>> peak down along a ridge. Any ideas?
>
> The obvious idea is the WATERSHED function. Have you
> tried that?
>
> 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.")



Yes, but I'm not sure how to implement it in such a way to output the
ridge. This 'image' is simply a background of 0's with a single
ridgeline rising out of it. When I use watershed, it give me bogus
answers, lines that make no sense at all.
Re: Following a ridgeline [message #60896 is a reply to message #60893] Mon, 16 June 2008 12:49 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
mzagursk@gmail.com writes:

> I've got a 2d map (let's say it's a contour map of a mountain). I
> need to be able to 'detect' and 'follow' the ridgeline across the
> whole mountain (which does about a 180 degree turn as well, it's U
> shaped). Anyone know any way to accomplish this?
>
> So far, i've attempted to start at the maximum point, and then look
> for surrounding points that minimizes the downward slope, this
> process, however, creates switchbacks at peaks and doesnt follow the
> peak down along a ridge. Any ideas?

The obvious idea is the WATERSHED function. Have you
tried that?

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: Following a ridgeline [message #60934 is a reply to message #60884] Tue, 24 June 2008 08:53 Go to previous message
Mike[2] is currently offline  Mike[2]
Messages: 99
Registered: December 2005
Member
On Jun 17, 1:14 pm, Jean H <jghas...@DELTHIS.ucalgary.ANDTHIS.ca>
wrote:
> What about edge detection filters? ... the Canny edge detector seems
> to be fairly good

The first part of the Canny edge detector is the calculation of a
gradient image. Then it follows gradient contours. With appropriate
choice of the smoothing parameter, it aught to do fairly well.

Mike
Re: Following a ridgeline [message #60969 is a reply to message #60894] Mon, 23 June 2008 00:50 Go to previous message
karo03de is currently offline  karo03de
Messages: 21
Registered: March 2007
Junior Member
Have a look at http://picasaweb.google.de/karo03de/Idl

Left you see a distance transformed binary image a with the result of
thin(a) in red, unluckily not exact and not connected, an error existant
since the beginnings of idl. In fact thin is working on the binary image.
The skeleton should correspond with the ridge lines of the distance
transformed binary image!
tvscl,a,0
tvscl,thin(a),0,chan=1

Right a possible result performed by my program, which is not easily to be
transfered (dll and a bunch of software). mm_skeleton is a "real" grey
scale skeleton, performed by succeeding hit-or-miss transformations.
tvscl,a,1
tvscl,mm_skelton(a),0,chan=1,1

Mathematical morphology is the keyword for this! Watershed delivers just
the contrary of what you are looking for! watershed borders are some sort
of saddle points in the distance map.

Regards
Karsten

Am Mon, 16 Jun 2008 22:34:20 +0200 schrieb mzagursk@gmail.com
<mzagursk@gmail.com>:

> On Jun 16, 1:15 pm, "mzagu...@gmail.com" <mzagu...@gmail.com> wrote:
>> On Jun 16, 12:49 pm, David Fanning <n...@dfanning.com> wrote:
>>
>>
>>
>>> mzagu...@gmail.com writes:
>>>> I've got a 2d map (let's say it's a contour map of a mountain). I
>>>> need to be able to 'detect' and 'follow' the ridgeline across the
>>>> whole mountain (which does about a 180 degree turn as well, it's U
>>>> shaped). Anyone know any way to accomplish this?
>>
>>>> So far, i've attempted to start at the maximum point, and then look
>>>> for surrounding points that minimizes the downward slope, this
>>>> process, however, creates switchbacks at peaks and doesnt follow the
>>>> peak down along a ridge. Any ideas?
>>
>>> The obvious idea is the WATERSHED function. Have you
>>> tried that?
>>
>>> 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.")
>>
>> Yes, but I'm not sure how to implement it in such a way to output the
>> ridge. This 'image' is simply a background of 0's with a single
>> ridgeline rising out of it. When I use watershed, it give me bogus
>> answers, lines that make no sense at all.
>
> Here's an image of what I'm talking about:
> http://www.mattzag.com/mountain_example.tiff
> I need to follow the long ridgeline and output those points. Thanks a
> bunch.



--
Erstellt mit Operas revolutionᅵrem E-Mail-Modul: http://www.opera.com/m2/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Workbench startup errors on OSX 10.5.3
Next Topic: Re: workbench eclipse 3.3.2 patch

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

Current Time: Wed Oct 08 18:14:02 PDT 2025

Total time taken to generate the page: 0.00753 seconds