# An example homography matrix than shows after transformation, the point inside the triangle could be outside

assume we have 3 vertices and a point inside the triangle.

with a homography matrix

[a,b,c]

[d,e,f]

[g,h,1]

Also the final location of the 3 vertices and the point that is not inside the triangle anymore.

how to find out this homography matrix? you are free to set the vertices to any location.

The one I thought is after transformation, the triangle becomes a single line, all points lie on this line.

-
It is not clear what you are asking for. Do you just want a homography that takes the point inside the triangle to a point outside the triangle, with no restriction on the images of the other points? – Mårten W Feb 7 '13 at 8:41
@MårtenW yes, just a homography that takes a point inside the triangle to outside, no restriction. – fiftyplus Feb 7 '13 at 16:59

Suppose we have the four points $p_1,p_2,p_3,p_4$ with homogeneous coordinates $$p_1=\begin{bmatrix}-1 \\ 0 \\ 1\end{bmatrix}, \quad p_2=\begin{bmatrix}1 \\ 0 \\ 1\end{bmatrix}, \quad p_3=\begin{bmatrix}0 \\ 2 \\ 1\end{bmatrix}, \quad p_4=\begin{bmatrix}0 \\ 1 \\ 1\end{bmatrix},$$ and we want to map $p_1,p_2,p_3$ to themselves but $p_4$ should be mapped to $$q=\begin{bmatrix}0 \\ -1 \\ 1\end{bmatrix}.$$
This results in a linear equation system of the form $$\left\{ \begin{array}{rcl} Hp_1 & = & \lambda_1 p_1\\ Hp_2 & = & \lambda_2 p_2 \\ Hp_3 & = & \lambda_3 p_3 \\ Hp_4 & = & \lambda_4 q \end{array} \right.,$$ in which there are twelve unknowns (eight from $H$ and four $\lambda_i$) and twelve equations. Solve this system and get $$H=\frac{1}{3}\begin{bmatrix}3 & 0 & 0 \\ 0 & -1 & 0 \\ 0 & -2 & 3\end{bmatrix}.$$
Note however that you may not in general assume that a given element in $H$ is one just because the scaling is arbitrary, because it may need to be zero.
Recall that the homogeneous coordinates are defined as equivalence classes of three-component vectors. Since we cannot be sure of which representative of the equivalence class we get, we must have the uknown $\lambda_i$ to account for that. – Mårten W Feb 7 '13 at 20:54
@fiftyplus: $p=\begin{bmatrix}x \\ y \\ 1\end{bmatrix}$ and $\lambda p=\begin{bmatrix}\lambda x \\ \lambda y \\ \lambda\end{bmatrix}$ represent the same point (assuming $\lambda \neq 0$), but if you want the cartesian coordinates you must choose the representative with third coordinate equal to one. – Mårten W Feb 8 '13 at 7:44