A homography on a real projective plane can be specified by a mapping from one set of four non-collinear points to another set of four non-collinear points. Given such a specification, then the 3-by-3 homography matrix may be computed by means of the DLT (Direct Linear Transformation) algorithm.
Source: wiktionary