Homework 2 - Mosaic Maker Close this dialog

Navigation Path : Home Page > Computer Vision Homeworks > Homework 2 - Mosaic Maker

Preamble...

Input Data and Results - Data set #1 - A town in the mountains

Input Data

There is a large translation between Image 1 and Image 2,

A translation and a rotation between Image 2 and Image 3,

A translation, rotation and warping between Image 3 and Image 4

Image Correlations (Automatically detected)
Final Mosaic

 

 

 

Input Data and Results - Data set #2 - An indoor Panorama

Input Data

The images were taken by rotating a camera and photographing the room at different angles.

Image Correlations (Automatically detected)
Final Mosaic

 

 

Input Data and Results - Data set #3 - An outdoor panorama

Source images can be provided on request... (There are simply too many.. and will clutter up this page...)

 

 

Algorithms

FindMatchingPoints (Input: Img1 = The first image, Img2 = The second image)

  1. Perform histogram equalization on Img1 and Img2 to adjust for lighting differences.
  2. GridSize = 1/8 of the smaller of the two images. This is based on the assumption that the two images have at least 12.5% of images space common.
  3. Repeat until 15 correspondences are found
    1. Randomly pick (X, Y) coordinates in the 1st image
    2. If (X,Y) points have been picked before go to step 3.1
    3. ImgBox = A portion of Img1, starting at (X, Y) with a width and height of GridSize
    4. Correlation = Calculate the correlation between ImgBox and Img2 using SSD.
    5. Range = Max (Correlation) - Min (Correlation)
    6. Get the maximum correlation and count the number of points which have a correlation value greater than Max(Correlation) - Range / 100
    7. If the number of points = 1, the pick the point otherwise discard the point as it is not a good match.
  4. Call CleanPoints to clean the erroneous points found during the algorithm.
  5. Display the point correlations to the user, so he can say how cool the algorithm is :)

CleanPoints (Input : P = Point Correspondences )

  1. pointCount = the number of Point Correspondences in P
  2. M = Create a mask with pointCount rows and pointCount * 4 columns
    1. For each column
      1. Randomly set 4 cells to 1, and set the others to 0
  3. For each column in M
    1. P2 = Select the 4 rows which have 1s, and select the set of points from P which correspond to those rows
    2. hom = GetHomography ( P2 )
    3. P3 = Use the hom on the original point set P of the first image.
    4. Error = The difference between P3 and the points of the second image in P.
    5. TotalError = TotalError + Error
  4. Sort the Total Error in ascending order by the value of the error, and return the 4 points with the lowest error values.

GetHomography (Input : P = Point Correspondences )

  1. B = A matrix created using the X, Y coordinates of the 2nd image
  2. A = A matrix created by applying a transformation on the X, Y coordinates of both images
  3. Calculate X = A\B (When there are more equations than functions, a least square errors method is used to calculate the best fit)
  4. Return X

Mosaic (Input : Images, Homographies between each image)

  1. Collect all the homographies (and inverse homographies).
  2. Compose them so they are in respect to the initial image.
  3. Use the composite homography inverses to find the coordinate points of all images in the initial image coordinates.
  4. Find the min & max for both axes for all the corners and create the result image so that it will contain all input images.
  5. Iterate over the result image, filling in as much new detail (using a mask to determine what is "new") per image is possible.
  6. When all images are exhausted, return the resultant image.

 

Strengths and Weaknesses (And how we might fix them.. hopefully.. someday.. maybe.. )

FindMatchingPoints

CleanPoints

GetHomography

Mosaic