How to locate a point on an image relative to a reference point from another image?

I want to be able to find the location of M1 on the second image relative the the R line, given the R line to be the reference line from the first image, and the R line has been found on the second image but with different angles to the horizontal axis. The two images are same here for illustration but in use is going to be different images but the same fingerprint so there could be rotation of the R line in the second image from the first. Please how do I go about this?
Thanks.

4 Comments

An example of the problem is this:
I have the coordinates of the starting point of the R line on the second image and i have it's direction, i also have the distance of the m1 line and its direction relative to the R line, and i used a formula to calculate the coordinates of the endpoint of the m1 line:
x' = x + (d * cos(a))
y' = y + (d * sin(a))
where x and y are the coordinates of the R starting point and x' and y' are the calculated ending coordinates of m1 and a is the angle the m1 line makes with the horizontal axis, it works if the angle is an acute angle, that is it gives a positive coordinate, but fails if larger than an acute angle as one of the coordinates x' or y' turns up as negative because of the sin(a) or cos(a) and there is no negative pixel coordinate on an image.
Like i just want to find the line (ending coordinates) from R to M1 in the second image as it is in the first image taking into account the rotation of the Reference line.
You want to find M1 on the second image? Is it correct?
My guess is that the negative values are the angles in the opposite direction. For example, a 90 deg angle is also a 270 degree angle.

Sign in to comment.

 Accepted Answer

Use atan2 function
ar = atan2(yr,xr); % angle or R point
am = ar + m1; % angle of M point
[xm,ym] = pol2cart(am,rm); % cartesian coordinates of M point (rm - radius)

3 Comments

Thanks darova, but there's one thing I want to understand, is dealing with angles in an image different from in Cartesian coordinates?
But in images lets say with width of 387 and height of 400, pixel coordinates like A [350, 250] as [row, column], i.e. [y, x] in cartesian coordinates, A will be lower than pixel coordinates like B [200, 150] while in cartesian coordinates A will be higher B as B is closer to origin on the y axis. This is why I asked if they are the same

Sign in to comment.

More Answers (1)

I don't think there is anything built in to MATLAB for that. You'll need to search for point matching algorithm and code up one of them.

3 Comments

Thanks Image Analyst, the main issue I'm having now is to locate the ending of the m1 line in the image, i initially wrote code for that for example,
I have the coordinates of the starting point of the R line on the second image and i have it's direction, i also have the distance of the m1 line and its direction relative to the R line, and i used a formula to calculate the coordinates of the endpoint of the m1 line:
x' = x + (d * cos(a))
y' = y + (d * sin(a))
where x and y are the coordinates of the R starting point and x' and y' are the calculated ending coordinates of m1 and a is the angle the m1 line makes with the horizontal axis, it works if the angle is an acute angle, gives a positive coordinate, but fails if larger than an acute angle as one of the coordinates x' or y' turns up as negative because of the sin(a) or cos(a) and there is no negative pixel coordinate on an image.
Like i just want to find the line (ending coordinates) from R to M1 in the second image as it is in the first image taking into account the rotation of the Reference line.
Yes, but in general a solution written for a very very specific case won't work in general. In general don't you want to know if one fingerprint matches another based on a set of minutia points?
You can find way better algorithms here in VisionBib than any advise you or we can think up. I suggest you start there.
The thing is this is actually just part of the matching process, I'm already using template matching to find the location of the R line with Surf algorithm

Sign in to comment.

Asked:

on 14 Jun 2020

Commented:

on 17 Jun 2020

Community Treasure Hunt

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

Start Hunting!