The goal of this assignment is to play with image warping and mosaicing. Take two or more photographs and create an image mosaic by registering, projective warping, resampling, and composing them. Along the way, learn how to compute homographies, and how to use them to warp images.
Image Warping and Mosaicing
A.1: Shoot the Pictures
Shoot two or more photographs so that the transforms between them are projective (a.k.a. perspective). The most common way is to fix the center of projection (COP) and rotate your camera while capturing photos.
Brooklyn Bridge at Sunset...
with a slightly different angle
A.2: Recover Homographies
We define a single correspondence (x,y,1)↦λ(u,v,1) (homogeneous coordinates) by the projective transformation matrix
Finally, solve the system for h to reconstruct the homography:
H=h1h4h7h2h5h8h3h61.
* While 4 correspondences is the minimum necessary to solve for 8 unknowns of H, having more correspondences makes the final projection transformation matrix more robust to noise in correspondence choices because we can solve the overdetermined system using least squares.
Initialize mask to 1 where image has nonzero pixels and 0 elsewhere
mask1
mask2
Use scipy's ndimage.distance_transform_edt to create blurring mask
(maps each nonzero pixel value to the distance between it and the nearest zero value)
dist_transform1
dist_transform2
Manually set blurring masks to original mask values (1 and 0) where the masks do not overlap
↔
output = weight1 * warped1 + weight2 * image2
Brooklyn Bridge Mosaic
Other examples:
Plane View Mosaic
World Trade Center Mosaic
Feature Matching for Autostitching
B.1: Harris Corner Detection
Detected Harris corners without ANMS
Detected Harris corners without ANMS
B.2: Feature Descriptor Extraction
Normalized Extracted Features (after ANMS)
B.3: Feature Matching
Matched Features
B.4: RANSAC for Robust Homography
World Trade Center Mosaic from Manually-selected Features
World Trade Center Mosaic from Auto-detected Features: Even though the final mosaics were different, they both seemed to capture the overall scene.
Plane View Mosaic from Manually-selected Features
Plane View Mosaic from Auto-detected Features
TaiEr, China Mosaic from Manually-selected Features
TaiEr, China Mosaic from Auto-detected Features
Failed Examples
Brooklyn Bridge Mosaic from Auto-detected FeaturesIt was difficult for the RANSAC Algorithm to find the correct homography because Brooklyn Bridge image has a largely repeating pattern of wires. While it is easy for humans to identify the corresponding features, the algorithm struggles to find them due to the similarity of the features our algorithm can extract.