Measurement angle of two drawn lines on Image.
8 views (last 30 days)
Show older comments
metin atilgan
on 21 Jun 2016
Answered: NURUL AMIRA MHD RIZAL
on 12 May 2018
I need to measure angle between two lines that I drawed. Actually I want to measure angles on face image for example eyes angle. I will draw two lines on image and I want to know angle between them. I'm creating gui that includes distance and angle measurement.
Is it possible that measure angles between drawn lines by me?
0 Comments
Accepted Answer
Rime
on 25 Jun 2016
Edited: Rime
on 25 Jun 2016
Do you detect the eye and draw the lines manually? If so, Let's forget the application and generalize the question as "measure the angle between two lines".
We will first figure out how to measure the angle of a line. When you draw the line, actually you defines its two endpoints. Let's say point 1 with location (x1,y1) and point 2 with location (x2,y2). The angle of this line in cartesian coordinate (your image) can be calculated by its tangent.
theta1 = atan((y1-y2)/(x1-x2));
The angle of second line can be calculated in the same way. Let's say line 2 has two points (x3,y3) and (x4,y4).
theta2 = atan((y3-y4)/(x3-x4));
Then, the angle between this two lines are the difference of theta1 and theta 2.
theta = theta1-theta2
Please remember the result is with unit radians. If you want degree, multiple the result by 180/pi.
Let me know, if I didn't make it clear.
0 Comments
More Answers (1)
NURUL AMIRA MHD RIZAL
on 12 May 2018
How to draw the straight lines automatically on image? For example I am using a cyclist image on a bike. I want to draw lines at his outer body to get intersection lines.
0 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!