Re: the length of line [message #31044] |
Tue, 04 June 2002 11:02 |
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  |
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  |
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
|
|
|
|