In the context of aligning two images taken from different viewpoints, what does the homography matrix represent?
Think about how points in one flat image relate to points in another flat image when the camera moves.
The homography matrix is a 3x3 matrix that transforms points from one image plane to another under the assumption that the scene is flat or the camera rotates around its center. It does not handle color or depth information.
Given the homography matrix H = [[1, 0, 2], [0, 1, 3], [0, 0, 1]] and a point p = [4, 5], what is the transformed point p' after applying the homography?
import numpy as np H = np.array([[1, 0, 2], [0, 1, 3], [0, 0, 1]]) p = np.array([4, 5, 1]) p_prime = H @ p p_prime_cartesian = p_prime[:2] / p_prime[2] print(p_prime_cartesian.tolist())
Remember to convert from homogeneous coordinates back to Cartesian coordinates by dividing by the last element.
Applying the homography adds 2 to x and 3 to y, so the point (4,5) becomes (6,8).
When estimating a homography matrix using point correspondences between two images, what is the minimum number of point pairs required, and why?
Consider how many unknowns the homography matrix has and how many equations each point correspondence provides.
A homography matrix has 9 elements but is defined up to scale, so 8 degrees of freedom. Each point correspondence gives 2 equations, so 4 pairs are needed to solve.
Which metric best measures the quality of a computed homography matrix when aligning two images?
Think about how well the homography maps points from one image to the other.
The reprojection error measures the distance between points transformed by the homography and their actual matching points, directly assessing alignment accuracy.
Consider this Python snippet using OpenCV to estimate a homography with RANSAC:
import cv2 import numpy as np pts_src = np.array([[10, 20], [30, 40], [50, 60], [70, 80]]) pts_dst = np.array([[12, 22], [32, 42], [52, 62], [72, 82]]) h, mask = cv2.findHomography(pts_src, pts_dst, cv2.RANSAC, 5.0) print(h)
The output is None. What is the most likely reason?
Recall the minimum number of points needed for homography estimation and how RANSAC works.
RANSAC requires more than the minimum number of points to robustly estimate a homography and identify inliers. With only 4 points, it often fails to find a consensus set.