0
$\begingroup$

I've got a set of points (currently 4, but I can increase the number for better accuracy), and I want to find the optimal transformation so that they can be mapped to another set of points.

For example, I have (2,2), (2, 4), (4, 2), (4, 4) which makes a 2x2 square if these points were connected. I have another set of points, say (2, 2), (2, 5), (3,2), (5,5) which resembles the shape of a rectangle, but clearly stretched, skewed, translated, or even possibly rotated. Using these two sets of points, how can I find the optimal skew factor, stretch factor, translation magnitudes (x and y) and rotational degree to apply to all points in set A so that they overlay as precisely as possible on set B?

Note: I'm actually trying to write a program to overlay one image onto another. I have selected points on both images that I know should be matched to each other. However, I'm having trouble calculating how to map one set onto the other. Please excuse the incorrect use of any math terms :P

  • 0
    You mention skew, stretch, translation, and rotational degree. Are you interested in any affine transformation, or are you requiring that the skew be uniform in every direction?2011-07-20

1 Answers 1

1

As such the question is not totally well posed. You shoudl specify what kind of transformation you are looking at. If you have that, this will lead to a natural parametrization of your allowed tranformation. If have yan that, you can (for example) formulate a least squares approach.

In an abstract formulation: Denote the set of allowed transformations by $F$ (that is a class of functions ${f:\mathbf{R}^2\to\mathbf{R}^2}$). Then you may solve $ \min_{f\in F} \sum_{a\in A}|F(a) - b|^2. $

A pointer: In image processing this problem is the problem of registration and a good math book is called FAIR by Modersitzki. See the website.

  • 0
    I know Matlab has a cpcorr $m$ethod, which is essentially what I'm trying to write in C++...I'm trying to figure out what algorithms they are using2019-01-17