Measurement angle of two drawn lines on Image.
8 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Rime
2016-6-25
编辑:Rime
2016-6-25
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 个评论
更多回答(1 个)
NURUL AMIRA MHD RIZAL
2018-5-12
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 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!