In this project, I explored various image warping techniques to create mosaics using multiple photographs. The project involved key steps: shooting images, recovering homographies, warping images, and blending them into mosaics. Below, I present the original images for three different scenes: the library, a tile area, and a window.
For each mosaic (library, tile, and window), I shot multiple pictures ensuring significant overlap between the images. This overlap was critical for accurately aligning the images later during homography recovery. I used a fixed center of projection and rotated the camera slightly to capture different views of each scene.
To align the images for each mosaic, I computed the homographies between pairs of images. A homography is a transformation between two planes that preserves straight lines. To recover the homography matrix, I selected several corresponding points from each image and used a least-squares method to solve for the 3x3 homography matrix.
The homography matrix H is a 3x3 matrix that transforms the coordinates from one image to another. The system of linear equations used to solve for H based on corresponding points is derived from the following relationships:
These relationships are linearized into the following form:
We then stack these equations for all points, resulting in the matrix equation A · h = 0, where A is the matrix containing the known terms and h is the vector containing the unknown homography parameters.
Point Correspondences for the Library Mosaic
Point Correspondences for the Tile Mosaic
Point Correspondences for the Window Mosaic
After calculating the homographies, I applied the transformations to warp the images. I implemented a function warpImage(im, H)
that takes an image and a homography matrix and outputs the warped image. The transformation aligns the image based on the homography to match the perspective of another image. The resulting warped images for the mosaics are displayed below.
Rectification was used to correct the perspective of objects within the images, making them appear frontal. This was achieved by selecting four corner points of a known rectangle and computing a homography matrix that mapped those points to a rectangular shape. Below are the selected points and the rectified results. Check the right part of the image, which has the four rectified points selected as well as the correspondence points.
Selected Rectification Points for Each Mosaic
Rectified Results for Each Mosaic
Below are the final mosaics for the three scenes: Tile, Window, and Library. Each mosaic was created by aligning the images using the computed homographies and blending them smoothly with Gaussian-blurred alpha masks.
Tile Mosaic
Window Mosaic
Library Mosaic
In Part B, I automated the process using feature detection and matching, robust homography estimation with RANSAC, and generated final mosaics without manual intervention. This approach enhanced accuracy and consistency in creating the mosaics.
Harris Corner Detection was used to identify points of interest in each image. These feature points were then used in subsequent steps to match corresponding regions between images.
After detecting features, I extracted descriptors and matched them between image pairs. The matches were filtered using a ratio test to retain reliable matches.
RANSAC was applied to estimate the homography between images while rejecting outliers. This method ensures that only the most consistent feature matches are used to compute the transformation. I made sure to follow the exact steps stated in the lecture slides.
Using the homographies estimated through RANSAC, I automatically aligned the images to create seamless mosaics. These results demonstrate the effectiveness of feature-based alignment.
One of the most fascinating aspects of this project was understanding how homography transformations work and how they enable us to map one plane to another, essentially aligning images captured from different perspectives. It felt like magic to see how a few carefully selected correspondences between images could allow us to compute a transformation matrix that seamlessly aligns and stitches those images together into a panoramic type photo.
Also, implementing the RANSAC algorithm taught me how to make these transformations more robust. RANSAC's ability to automatically identify and exclude outliers from the feature matches,to make sure that only consistent points contribute to the homography estimation, was impressive. It made me appreciate how much of computer vision relies on both precise math and careful handling of imperfect real-world data.