Calculate homography