# Projective transformation by mapping fixed points to ideal circular points

I am trying to compute a projective transformation out of four pairs of points following the procedure described in this post, namely:

• Two circular points.
• A similarity rotation center.
• An arbitrary point.

The projection applied is sources=H*destinations using the following two matrices

sources =

1.0e+002 *

0.0100             0.0100             3.4150             5.1200
0 + 0.0100i        0 - 0.0100i   0.0100             6.8300
0                  0             0.0100             0.0100


and

destinations =

1.0e+003 *

0.0061 - 1.5022i   0.0061 + 1.5022i   0.3380             0.5120
-1.1516 + 0.3142i  -1.1516 - 0.3142i   0.0016             0.6830
0.0010             0.0010             0.0010             0.0010


As result I am obtaining a complex matrix which I cannot use for transforming my input image and points. Is worth to mention that the transformation is not exact but works almost good from sources to destinations except for an imaginary part that is added and don't know where it comes from, and from destinations to sources is just not working.

I am thinking this is due to to the fact of mapping complex numbers, since from the early first step when solving for A and B I am getting complex numbers and they never get canceled out.

I would appreciate any insight on how to tackle this.

PD: this question arose from this other one

-

# Performing the computation

You start your computation with the matrix sources. After step 2 you should have

$$A=\left(\begin{array}{rrr} 85.25 - 341.0i & 85.25 + 341.0i & 341.5 \\ 341.0 + 85.25i & 341.0 - 85.25i & 1.0 \\ 0.0 & 0.0 & 1.0 \end{array}\right)$$

For destinations, step 3 gives you something like

$$B=\left(\begin{array}{rrr} -12.219 + 440.92i & -12.219 - 440.92i & 536.44 \\ 340.23 - 84.238i & 340.23 + 84.238i & 2.5394 \\ -0.29355 - 0.0069421i & -0.29355 + 0.0069421i & 1.5871 \end{array}\right)$$

which you invert in step 4 to obtain

$$B^{-1}=10^{-4}\cdot\left(\begin{array}{rrr} 2.6595 - 10.758i & 13.997 + 2.7471i & -921.31 + 3631.7i \\ 2.6595 + 10.758i & 13.997 - 2.7471i & -921.31 - 3631.7i \\ 1.0779 & 5.1535 & 5928.2 \end{array}\right)$$

and then combine in step 5 to

$$H = A\cdot B^{-1} =\left(\begin{array}{rrr} -0.651526787716 & 0.601985053784 & 434.425923576 \\ 0.36490745453 & 0.908241885512 & -124.161824524 \\ 0.00010779137833 & 0.000515353941842 & 0.592824072017 \end{array}\right)$$

which is real except for minor numeric rounding errors (on the order of $10^{-14}$ in my computation).

# Verifying the result

To check your result, apply that matrix to destinations and you will obtain

$$H\cdot\text{destinations}=\left(\begin{array}{rrrr} -262.79 + 1167.9i & -262.79 - 1167.9i & 215.17 & 512.00 \\ -1167.9 - 262.79i & -1167.9 + 262.79i & 0.63008 & 683.00 \\ 0 & 0 & 0.63008 & 1.0000 \end{array}\right)$$

The first two columns are $(-262.79+1167.9)\cdot I$ and $(-262.79-1167.9i)\cdot J$, i.e. multiples of the original representants and hence the same points. The other two columns dehomogenize to $(341.5, 1)^T$ and $(512, 683)^T$ as specified.

-

Based on the previous answer I was able to find the solution to my problem, it is rather a programming issue than a theoretical one.

The problem was on my implementation for constructing a four points projective transformation, I am using Matlab and there exists the following difference:

• a' computes the complex conjugate transpose of matrix a
• a.' computes the non-conjugate transpose of matrix a

I was using the first one in matrices with complex values while I should have been using the second one or the function transpose which is totally equivalent.

-