0
0
Computer Visionml~20 mins

Homography and image alignment in Computer Vision - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Homography Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What does a homography matrix represent in image alignment?

In the context of aligning two images taken from different viewpoints, what does the homography matrix represent?

AA matrix that encodes the 3D depth information of the scene.
BA transformation that maps points from one image plane to another, assuming the scene is planar or the camera rotates around its optical center.
CA matrix that describes the color adjustment needed to match brightness between two images.
DA filter that removes noise from images before alignment.
Attempts:
2 left
💡 Hint

Think about how points in one flat image relate to points in another flat image when the camera moves.

Predict Output
intermediate
2:00remaining
Output of homography application on a point

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?

Computer Vision
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())
A[6.0, 8.0]
B[4.0, 5.0]
C[2.0, 3.0]
D[8.0, 10.0]
Attempts:
2 left
💡 Hint

Remember to convert from homogeneous coordinates back to Cartesian coordinates by dividing by the last element.

Hyperparameter
advanced
2:00remaining
Choosing the number of point correspondences for homography estimation

When estimating a homography matrix using point correspondences between two images, what is the minimum number of point pairs required, and why?

A4 pairs, because a homography has 8 degrees of freedom and each point provides two equations.
B3 pairs, because each point provides three equations for the homography.
C8 pairs, because the homography matrix has 8 elements to solve for.
D2 pairs, because each pair gives enough constraints for the transformation.
Attempts:
2 left
💡 Hint

Consider how many unknowns the homography matrix has and how many equations each point correspondence provides.

Metrics
advanced
2:00remaining
Evaluating homography quality with reprojection error

Which metric best measures the quality of a computed homography matrix when aligning two images?

AMean squared error of pixel intensities between the two images.
BNumber of matched keypoints detected.
CStructural similarity index (SSIM) between the images.
DAverage reprojection error between transformed points and their true correspondences.
Attempts:
2 left
💡 Hint

Think about how well the homography maps points from one image to the other.

🔧 Debug
expert
3:00remaining
Why does this homography estimation fail with RANSAC?

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?

AThe points are perfectly aligned, so RANSAC returns None.
BThe threshold value 5.0 is too small for RANSAC to accept any inliers.
CThere are too few point correspondences; RANSAC requires more points to find a valid homography.
DThe input points are not in homogeneous coordinates, causing failure.
Attempts:
2 left
💡 Hint

Recall the minimum number of points needed for homography estimation and how RANSAC works.