Find angle between dots

82 ビュー (過去 30 日間)
M
M 2013 年 12 月 15 日
コメント済み: Walter Roberson 2015 年 9 月 20 日
Hi all,
I need to calculate the angle between (imaginary lines) connecting dots on an image.
Below is an example of the bw image that I have:
And I want to calculate the angle as shown below:
Thank you

回答 (3 件)

Image Analyst
Image Analyst 2013 年 12 月 15 日
How about using atan(), atand(), or atan2d()?

Roger Stafford
Roger Stafford 2013 年 12 月 15 日
The matlab function 'atan2' can be used to accomplish this. It is more accurate for this purpose than 'acos'. Let P0 = [x0;y0] be a vector of x,y coordinates for the vertex of the angle to be measured and P1 = [x1;y1] and P2 = [x2;y2] be vectors for points on the two lines connecting them to P0.
x10 = x1-x0;
y10 = y1-y0;
x20 = x2-x0;
y20 = y2-y0;
ang = atan2(abs(x10*y20-x20*y10),x10*y10+x20*y20);
The angle 'ang' will be in radians.

Youssef  Khmou
Youssef Khmou 2013 年 12 月 15 日
hi, Computing the angle require the scalar product between the points, so you need to know the coordinate of the white dots, here is an example
the image above is generated by :
T=zeros(200);
T(10,10)=1;
T(40,50)=1;
T(60,30)=1;
imshow(T)
Let us compute the Euclidean norm of the vectors :
ab=sqrt((50-10)^2+(40-10)^2)
ac=sqrt((30-10)^2+(60-10)^2)
You can obtain the angle by :
acos(dot([10 60],[10 40])/(ac*ab))*180/pi
  1 件のコメント
Walter Roberson
Walter Roberson 2015 年 9 月 20 日
TAEYUN commented
if i want to find angle of btween kneejoint and hipjoint, how can i do? just i knew only x,y,z values of joints... help me plz..

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGeometric Transformation and Image Registration についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by