I have pattern image with set of points
and second tested image also with set of points. I know the coordinates x,y of points.
The points have their names (numbers), I know the numbers of all points in pattern image and in tested sample I know numbers of two points. I want to rotate tested image according to these two known points to fit tested image on the pattern image (I don´t want to scale it).
Then I want to calculate distances of pattern points to the tested points. I want to write the algorithm in Java, any idea how to do that?
Asked
Active
Viewed 231 times
2

cernover
- 163
- 2
- 10
-
Is there a fixed mapping of points between the two point sets? Or is the map adjusted continuously? – peter.murray.rust May 18 '13 at 19:47
-
From your diagram, it's unclear what the purpose of 1,0 are. It looks like you just want to find the closest match for 2,3. Is there some rotation/scaling thing you're supposed to figure out from points 0 and 1? – BraveNewCurrency May 18 '13 at 19:48
-
1Possible duplicate of http://stackoverflow.com/questions/7077409/align-one-set-of-2d-points-with-another-using-only-translation-and-rotation – peter.murray.rust May 18 '13 at 19:52
-
Blue points 0 and 1 are important for rotation and translation of tested image. Blue point 0 is for translation of tested image and blue point 1 I need to know for rotation of tested image. – cernover May 18 '13 at 20:30
1 Answers
1
hava look at java.awt.geom.AffineTransform, you'll find tutorials for that, too. it seems you want to map the blue 0 onto the red 0, so I'd start by translating both groups such that their 0 is in the origin of the coordinate system. see AffineTransform.getTranslateInstance.
next I'd inspect the vectors to points 1 in the blue and the red group. you can find their angle with respect to the x axis (arctan(y/x)). the difference of the two angles is the angle by which you want to rotate the blue group so that points 1 point into the same direction. see AffineTransform.getRotateInstance. matching pairs of points seems the most difficult part...

user829755
- 1,489
- 13
- 27