Any two images of the same planar surface in space are related by a homography. The planar homography relates the transformation between two planes (up to a scale factor):
The homography matrix is a 3x3
matrix with 8 DoF as it is estimated up to a scale. It is generally normalized:
The transformations shown in the followings instances are all related to transformations between two planes.
A rotating camera around its axis of projection, equivalent to consider that the points are on a plane at infinity (image taken from
For any point in the world the projection of the point on the camera plan would be:
now if we put world reference frame on the plane such that X and Y axis lays on the plane:
so all point the Z
will be zero:
or:
if we write the upper equation for 4 points and rewrite them we would get the following linear equation to solve:
Singular-value Decomposition (SVD) of any given matrix
To find homography Matrix from 4 Corresponding Points:
cv::Mat homographyMatrix= cv::getPerspectiveTransform(point_on_plane1,point_on_plane2);
cv::Mat H = cv::findHomography( point_on_plane1,point_on_plane2,0 );
If you need to perform the Homography matrix transformation on points:
cv::perspectiveTransform
If you want to transform an image using perspective transformation, use:
cv::warpPerspective
The function cv::warpPerspective
transforms the source image using the specified matrix:
Apply homography on image,
Finding homography matrix from 4 corresponding points
Finding homography Matrix between two images using keypoints and RANSAC
Refs: 1