# How is the Homography formula derived?

In the Wikipedia article about Homography, the projective transformation between picture A to picture B is defined as:

$$H_{ab} = R - \frac{t n^T}{d}$$

However, the formula lacks the derivation. How is it derived?

Given a point on a plane $$p$$, $$n^T p$$ for the directed unit normal vector for the plane gives you the projection of the given point onto the line of the normal vector, which gives you the distance $$-d$$ away from the origin on that plane (negative because the normal vector is in the opposite direction to the point vector). i.e.
$$n^T p = -d$$
For a homography from $$a$$ to $$b$$, we want
$$p_b = H_{ab}p_a = (R_{ab}p_a+t_{ab})$$
for some rotation and translation. The translation term is annoying because it doesn't have $$p_a$$ on the right even though H should be a single multiplicative term for p. We have to split up $$H$$ into a single multiplicative factor for $$p$$ with two terms, one for the $$R$$ which doesn't have to change, and one for $$t$$ for which we need to split out so that multiplying by $$p$$ results in the $$t$$ translation.
We do this by looking back at our $$n^T p = -d$$ equation, dividing by $$-d$$ on both sides so LHS = 1. The t can now be multiplied by the LHS, which doesn't change the value but introduces the $$p$$ to be factored out $$p_b = H_{ab}p_a = (R_{ab}+\frac{t_{ab}n^T}{-d})p \\ = R_{ab}p+ t_{ab}\frac{n^T p}{-d} \\ = R_{ab}P + t_{ab}$$ This recovers our expected relationship