Path: news.mathworks.com!not-for-mail 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$1@fred.mathworks.com> References: <gp1l4a$2ud$1@fred.mathworks.com> Reply-To: <HIDDEN> NNTP-Posting-Host: webapp-03-blr.mathworks.com Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Trace: fred.mathworks.com 1236561482 19418 172.30.248.38 (9 Mar 2009 01:18:02 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Mon, 9 Mar 2009 01:18:02 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1187260 Xref: news.mathworks.com comp.soft-sys.matlab:523381 "Regina " <velasquezregina@rocketmail.com> wrote in message <gp1l4a$2ud$1@fred.mathworks.com>... > 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. > > http://www.vision.cs.chubu.ac.jp/04/pdf/VSAM08.pdf > > 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