% Author : Sasakthi Abeysinghe, Timothy Simpson % Date : 02/15/2006 function homography = GetHomography(points) % homography = GetHomography(points) % Gets the set of points and creates a homography mapping pointset 1 to % pointset 2. points = double(points); % Trying to solve Ax = b b = [-points(:, 3); -points(:, 4)]; A = [-points(:, 1), -points(:, 2), -ones(size(points, 1), 1), zeros(size(points, 1), 3), points(:, 1) .* points(:, 3), points(:, 2) .* points(:, 3); zeros(size(points, 1), 3), -points(:, 1), -points(:, 2), -ones(size(points, 1), 1), points(:, 1) .* points(:, 4), points(:, 2) .* points(:, 4) ]; x = A\b; homography = [x(1), x(2), x(3); x(4), x(5), x(6); x(7), x(8), 1];