# Find 2D affine transform matrix given a pair of points

I have the coordinates of two points in an initial 2d coordinate system and the corresponding coordinates in a target system. Is is possible to determine the affine transform matrix from these values?

Since there are 6 unknowns, I would assume 2 points are not enough.

$\begin{bmatrix}x' & y' & 1\end{bmatrix} = \begin{bmatrix}x & y & 1\end{bmatrix} \begin{bmatrix}a & b & 0 \\ c & d & 0 \\ t_x & t_y & 1\end{bmatrix}$

But intuitively I don't quite understand why 2 points would not be enough.

Consider the 2 finger "pinch to zoom" gesture you can use on touch screens. Isn't that exactly this case? You have the coordinates of the fingers when they first touched the screen and you have their current coordinates. And seemingly it's possible to transform the content in a way that always maps the originally touched locations to the current finger positions and scales, translates, rotates the rest accordingly.

• What you really need here are two vectors and a single point. That will give you your $6$ unknowns. Mar 17, 2014 at 23:17