How to calculate the angle between two lines from the same origin?

Please I need help on this, I have extracted severla minutia points from this fingerprint image and I have been able to calculate the angle of each minutia according to the ridge direction, which i have dipslayed in green small arrows, and i want to take one of the minutia as a reference point and calculate the distance and angle each other minutia forms with the reference minutia, that is the angles in orange color, please help me on this. thanks

8 Comments

In your image, which minutia is the reference point? Is it the one toward the bottom-left at the vertex of the angles? If so, that would be the center of your axes (0,0) as shown in the image below. Is that correct? Under this coordinate system, to get the orange angles you can rotate minutia coordinates so that the black line between the origin and minutia2 is horizontal and then it would easier to compute the angles of all minutia to that reference line.
Yes the reference is the one to the bottom left, please i don't understand what you mean by rotating the coordinates
Do you mean i should rotate the red line to the horizontal? because the reference minutia has an angle already, I'm just confused about this, I want to use the reference point to convert all other points to polar coordinate, this is my aim
Angles are generally in reference to the x-axis as shown in this lesson.
Angles require 2 lines. If the line between (0,0) and minutia2 is the reference line, all points should be rotated so that this line lays on the x-axis. The image below shows you the concept but you wouldn't need to rotate the image. You would just apply a rotation matrix to the (x,y) coordinates of each minutea so that if you plot the rotated versions they would appear in the same positions as the image below, assuming you've already shifted them so that the reference dot is at (0,0). To determine the amount of rotation to apply, you would just compute the angle between the black line that extends from (0,0) to Minutia2 and the x-axis in the image from my previous comment.
Thanks Adam, but the reference line is the red line, which is a line in the direction of the minutia angle, i computed this angle from doing a gradient calculation on the pixels, and i now want to get the angle of other minutiae to this angle i have computed for the reference minutiae, so does that mean i will rotate this red line instead and then calculate the angle to the red line which is now the horizontal axis? If so, please how do i go about the rotation?
Is gradient direction measured to the horizontal axis?
is it possible to take this approach where i don't rotate the image but i calculatethe angles of all the lines from reference minutia to other minutiae according to the horizontal axis and then subtract the referene minutia angle from the results, instead of rotating? I saw this and i think it's saying something like that, but will it be correct?
Yes, that's also possible. Good idea.
Thanks Adam, please I also want to ask, I used gradient direction estimation woth block processing to get the angle of the reference minutia, from a gray scale image, that is to get the angle of the ridges, does this method calculate the angle to the x-axis?
Also i want to find the angle of the white valley in a bifurcation, that is the white space in between the two ridges of a bifurcation, please how can i go about it? I saw on that paper that i need to calculate the angle of the bifurcation on the negative image of the fingeprint but i don't know how it'll work since I calculated it on a gray image not a binary image

Sign in to comment.

 Accepted Answer

O = [0. 0.] ; % origin
% Two points
A = rand(1,2) ;
B = rand(1,2) ;
u = O-A ;
v = O-B ;
CosTheta = (dot(u,v) / (norm(u)*norm(v)));

8 Comments

Thank you KSSV but please can you explain the code to me, I don't understand it
What does [0. 0.] do? I mean why the dot?
I have taken One point as origin..for demo....the angle here is AOB.
Don't be annoyed, but i still don't understand, let me provide you with the type of values i am seeing in my project, because i saw from the random function it was providing with decimal values.
Lets say O has [60, 70] which are the pixel coordinates on the image and has an angle of 1.75 radians which is the ridge angle of the minutia gotten from gradient calculation but there is no magnitude for it
and A is a minutiae with pixel coordinates [100, 30] and i want to get the angle it is making with the minutiae O.
This is what the problem is like
No problem....what ever be the values, it will work.
But it does it take into account the angle of the origin minutiae, because the orgin has its own angle, by origin i mean reference point and i want to calculate the angle of another point from that refernce point anlge but i am not seeing anywhere where the angle was used in the code
You need three points to define an angle.....define the three points, use the above you will get the angle.
So i should like draw a line for the origin minutiae and use an arbitrary maginitude and the coordinates at the end of the line?
It need not to be origin....any three non colliniear points.

Sign in to comment.

More Answers (1)

Seems like just a math problem. If you have two vectors A and B, then angle between them is:
angle = acos(dot(A,B)/norm(A)/norm(B));

4 Comments

But the thing is that I dont have the magnitude for the reference minutia, just the angle alone and it's coordinate on the image, and i guess vectors should have magnitude and direction
The vectors can be generated by using the coordinates of the image.
Please look at the example i gave on KSSV's answer, it highlights what I'm facing better, the minutiae O has no magnitude but has an angle from the gradient calculation and i want to find the angle minutia A is making with miunutiae O
You need four pixel points, to generate the three vectors from the origin. It does not matter what the magnitudes are since they get divided out to compute the angle.

Sign in to comment.

Asked:

on 9 Jun 2020

Edited:

on 9 Jun 2020

Community Treasure Hunt

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

Start Hunting!