Project 5a

Danji Liu

Shooting the images

The images I shot for stitching

Marking key points

I used ginput to get the key points of the image. I extracted 6 key points to avoid noises.

ComputeH

I used np.linalg.lstsq to calculate the points. First, I created a coefficient matrix where each row corresponds to predicting a single x or y value. Each column corresponds to one number in the transformation matrix. The coefficient matrix has 8 columns and 6 rows (since I used 6 points to avoid noises). Then, I used least square to compute the transformation matrix by minimizing the least squares. The transformation matrix is calculated as follows.

array([[ 1.95807923e+00, -7.89919677e-03, -3.31251896e+02],
       [ 3.68086626e-01,  1.61761135e+00, -1.04129632e+02],
       [ 2.29387507e-03, -1.19801278e-04,  1.00000000e+00]])