How to find a transformation that maps given four vectors into another four given vectors?

88 Views Asked by At

I have two 2x4 matrices, A and B, each made up of four two dimensional column vectors.

For ex: $A=\begin{bmatrix} 0 & 0 & 1 & 1\\ 0 & 1 & 0 & 1 \end{bmatrix}$ $B = \begin{bmatrix} 1 & 1 & 3 & 2\\ 1 & 2 & 1 & 2 \end{bmatrix}$

What I'm looking for is a way to find a single matrix M which maps A to B, such that: MA=B or AM=B (i.e. it maps each of the four vectors in A to the coresponding ones in matrix B).

Now, I'm pretty sure that this isn't a linear transformation, but is it possible to do it by somehow converting to a higher dimensional space or using homogenous coordinates? (I don't know anything about homogenous coordinates, but I read that they might be useful here)

I want to find this because I want to know how the perspective transform tool works in image editors, mapping a rectangular or square texture/image into any four-sided polygon (or vice-versa).

Thanks in advance!

1

There are 1 best solutions below

1
On

Recall that the transformation give by the $4\times4$ matrix

$K=\begin{pmatrix} k_1 & k_2 & k_3 &k_4 \end{pmatrix}$

sends the vector $(1,0,0,0)$ to $k_1$ (This is because $(1,0,0,0)A = c_1$.

It follows that $C^{-1}$ sends the vector $k_1$ to $(1,0,0,0)$.

So one way to obtain the function you want is to take $M^{-1}N$ where $M$ is a matrix $\begin{pmatrix}m_1,m_2,m_3,m_4\end{pmatrix}$ and $N=(n_1,n_2,n_3,n_4)$

Where $m_1,m_2$ are the transposes of the rows $A$ and $n_1,n_2$ are the transposes of the rows of $B$


the case in which the first rows of $A$ are not independent is slightly trickier.