From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: can someone help me with this
Date: Mon, 9 Mar 2009 01:18:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 39
Message-ID: <gp1qoa$iuq$>
References: <gp1l4a$2ud$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: 1236561482 19418 (9 Mar 2009 01:18:02 GMT)
NNTP-Posting-Date: Mon, 9 Mar 2009 01:18:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:523381

"Regina " <> wrote in message <gp1l4a$2ud$>...
> hi!
> i really have a difficulty in analyzing the star skeleton of a given image.
> i need to get the angle and i don't seem to get how to do it.
> i hope someone will help me with this.
> the pdf above explains how to get the angle and i dont get how.
> i have already the extremal points of the skeleton and my problem is to get the angle.
> if someone is willing to help me with this. 
> i will post my codes here as well as my sample images
> thanks

  In the paper you mentioned they give equation (7):

 theta = arctan((lx-xc)/(ly-yc))

where fig. 5a shows theta being measured counterclockwise from the downward-pointing positive y-axis toward the right-pointing positive x-axis.  You could do this computation in matlab with:

 theta = atan((lx-xc)/(ly-yc));

However I would recommend using

 theta = atan2(lx-xc),ly-yc);

instead since its results remain valid even for "legs" that have been raised more than pi/2 (90 degrees) above horizontal.  Also 'atan2' is more accurate for angles that are near pi/2 where 'atan' would have accuracy difficulties.

  Note that both functions give angles in radians, not degrees.  To get degrees with 'atan2', multiply by 180/pi.

  The angle phi as shown in fig. 5b seems to be defined differently.  If the x and y axes are defined the same, phi would be measured clockwise from the vertical negative y-axis toward the right-pointing positive x-axis, so you could find it with

 phi = atan2(lx-xc,yc-ly);

  It seems a shame to introduce confusion by these two different definitions of angles.  Perhaps that is the reason you had trouble with this, Regina.

Roger Stafford