In image matching, with Matlab, I found a vector of correspondences of two images using Sift and now I have to estimate the homography matrix. Any simple way to do it? Thanks in advance
The book "Multiple View Geometry in Computer Vision" by Richard Hartley and Andrew Zisserman is an excellent resource for this sort of problem, and helpfully they also provide a set of Matlab functions to perform common tasks. Look at this page and download the file vgg_H_from_x_lin.m
, which estimates the homography between two sets of points using a linear method. Here's an example (with some completely made-up numbers):
x1 = [ 10 20; 13 23; 45 35 ].';
x2 = [ 103 301; 106 305; 80 229 ].';
H = vgg_H_from_x_lin(x1, x2);
Alternatively, download the file ransacfithomography_vgg.m
to compute the homography using RANSAC. This time you must give an inlier threshold for RANSAC.
x1 = [ 10 20; 13 23; 45 35 ].';
x2 = [ 103 301; 106 305; 80 229 ].';
H = ransacfithomography_vgg(x1, x2, 0.02);