0

This question has been bothering me for some time, help would be appreciated! Suppose we have an image of a building facade with vanishing points at Vx = (x,0) and Vy = (0,y) which are horizontal and vertical respectively. We know two points P = (0,0) and Q = (1,1). We want to find a transform that maps this facade onto a rectangle that keeps P and Q fixed.

Since this is a homogenous coordinate system I set P = (0,0,1) and Q = (1,1,1), Vx = (x,0,0) and Vy = (0,y,0). Then I tried to find a transform that maps this onto the following: (0,0,1), (1,1,1,), (1,0,1), (0,1,1). However when I tried this I was wrong according to the answers. The answer ending up being:

$\begin{bmatrix}y-x+xy & 0 & 0\\ 0 & y-x+xy & 0 \\ y & -x & xy\end{bmatrix}$

I feel like I'm approaching this question wrongly so any bit of advice that can help me understand how to tackle this question would be much appreciated!

  • 1
    Are Vx, Vy points in the image where horizontal, vertical lines of the building meet? If so, they are finite points in the image which should map to points at infinity; ie your transform should map (x,0,1) to (1,0,0) and (0,y,1) to (0,1,0). – stewbasic Jul 04 '16 at 04:40
  • Besides the error that @stewbasic pointed out, the given solution seems to be off somehow. The matrix you have does map $(0,y,1)$ to the appropriate point at infinity, but does not do the same for $(x,0,1)$ gets mapped to a finite point. It does, however map $(-x,0,1)$ to a point at infinity. – amd Jul 04 '16 at 05:41

1 Answers1

0

I'd use this computation to find the transformation matrix. Applied to your situation:

  1. Start with the matrix $$ A = \begin{pmatrix}x&0&0\\0&y&0\\1&1&1\end{pmatrix} $$ $A$ is formed by the points $V_x$, $V_y$ and $P$, correcting for the fact that $V_x$ and $V_y$ presumably are finite and therefore have a $1$ in their last coordinate.

  2. The adjoint of this is $$ \operatorname{adj}A = \begin{pmatrix}y&0&0\\0&x&0\\-y&-x&xy\end{pmatrix} $$

  3. Multiplying that with $Q$ you get $$ \operatorname{adj}A\cdot Q=\begin{pmatrix}y\\x\\xy-x-y\end{pmatrix} $$

  4. Scaling the columns of $A$ by these coefficients you get $$ B = \begin{pmatrix}xy&0&0\\0&xy&0\\y&x&xy-x-y\end{pmatrix} $$ This matrix will map the projective basis $(1,0,0)$, $(0,1,0)$, $(0,0,1)$, $(1,1,1)$ to $V_x$, $V_y$, $P$, $Q$.

  5. So you want the inverse of this operation, or the adjoint of this matrix. \begin{align*}\operatorname{adj}B&=\begin{pmatrix} x^{2} y^{2} - x^{2} y - x y^{2} & 0 & 0 \\ 0 & x^{2} y^{2} - x^{2} y - x y^{2} & 0 \\ - x y^{2} & - x^{2} y & x^{2} y^{2}\end{pmatrix} \\&=xy\cdot\begin{pmatrix} x y - x - y & 0 & 0 \\ 0 & x y - x - y & 0 \\ - y & - x & x y \end{pmatrix}\end{align*} You can safely drop that factor $xy$ and take that final matrix as your transformation matrix. It looks very similar to what you have, except for some sign changes.

MvG
  • 42,596
  • Exactly what I needed! I didn't use the adjoint method, instead used the system of linear equations to find the transform from basis to destination coordinates as outlined in your other post. May I slip in a question and ask why just finding the adjoint of A and multiplying by Q gives you the basis to destination coordinate transform? When I used the system of linear equations I computed A and scaled it by a set of values [a,b,c], took the adjoint and scaled by xy to get the answer. But you seemed to have computed the adjoint directly from [Vx, Vy, P]. Is it mathematically equivalent? – Jason Mendez Jul 05 '16 at 22:02