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

Home » Public Forums » archive » Re: the length of line
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: the length of line [message #31044] Tue, 04 June 2002 11:02
Kenneth P. Bowman is currently offline  Kenneth P. Bowman
Messages: 585
Registered: May 2000
Senior Member
In article <adilps$hdb$1@dipsy.missouri.edu>,
"Xiaoying Jin" <xje4e@mizzou.edu> wrote:

> In that case, you still need to trace the line and order the points on the
> line. That's my question.
> And in my case, there are a lot of branchs on the line, we still need to sum
> the length of these branchs up.

Sorry, I misunderstood. What are the pixel coordinates coming from?
CONTOUR, for example, will return the coordinates of contour lines.

Ken
Re: the length of line [message #31046 is a reply to message #31044] Tue, 04 June 2002 10:22 Go to previous message
Eric Vella is currently offline  Eric Vella
Messages: 8
Registered: April 1999
Junior Member
To really solve this problem as you have outlined it, you probably need some
clever recursive algorithm for traversing the line and following all
branches, summing the length as you go. You might want to separate the
"line" into blocks connected purely by straight segments, separated from
other blocks by diagonal connections. The "length" of each block is then
the number of pixels, and each extra block extends the length of the line by
an additional diagonal. If you only need an approximate length, why not
ignore the diagonals and simply count pixels?

"Xiaoying Jin" <xje4e@mizzou.edu> wrote in message
news:adgr20$5r5$1@dipsy.missouri.edu...
> Hi, there,
>
> I have an image having a line on it. The line has one-pixel width. The
> approxiamate method to calculate the length of the line is like this:
> the length is calculated as the sum of distances between adjacent pixels
on
> the line, where 1 is the vertical or horizontal distance between adjacent
> pixels and sqrt(2) is the distance between pixels on diagonals.
>
> My question is:
> How can I trace this line and get the length of the line?
>
> Any suggestion will be appreciated.
>
> Regards,
>
> Xiaoying Jin
>
>
Re: the length of line [message #31051 is a reply to message #31046] Tue, 04 June 2002 08:25 Go to previous message
Xiaoying Jin is currently offline  Xiaoying Jin
Messages: 20
Registered: May 2002
Junior Member
"Kenneth P. Bowman" <kpb@null.com> wrote in message
news:kpb-232A7A.07172004062002@corp.supernews.com...
> In article <adgr20$5r5$1@dipsy.missouri.edu>,
> "Xiaoying Jin" <xje4e@mizzou.edu> wrote:
>
>> How can I trace this line and get the length of the line?
>
> With n pixels at coordinates (i,j)
>
> length = TOTAL(SQRT((i[0:n-2]-i[1:n-1])^2 + (j[0:n-2]-j[1:n-1])^2))

In that case, you still need to trace the line and order the points on the
line. That's my question.
And in my case, there are a lot of branchs on the line, we still need to sum
the length of these branchs up.

Xiaoying Jin
Re: the length of line [message #31056 is a reply to message #31051] Tue, 04 June 2002 05:17 Go to previous message
Kenneth P. Bowman is currently offline  Kenneth P. Bowman
Messages: 585
Registered: May 2000
Senior Member
In article <adgr20$5r5$1@dipsy.missouri.edu>,
"Xiaoying Jin" <xje4e@mizzou.edu> wrote:

> How can I trace this line and get the length of the line?

With n pixels at coordinates (i,j)

length = TOTAL(SQRT((i[0:n-2]-i[1:n-1])^2 + (j[0:n-2]-j[1:n-1])^2))

Ken
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: how to modify the default 'printf' format
Next Topic: segmentation of more channel images

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

Current Time: Wed Oct 08 13:40:14 PDT 2025

Total time taken to generate the page: 0.00680 seconds