Exercise 5
Image Alignment
Due date: January 19
Submission: In pairs
In this exercise, you should implement the 2D parametric estimation
and alignment algorithm that was presented in class on January 29.
The implementation should be for
the case of a global 2D translation (i.e., a global image shift).
Write a function called "align" that performs the following:
-
INPUT:
-
OUTPUT:
-
The image shift (a,b).
-
An image displaying the absolute differences between the two images before
and after alignment (please stretch the difference image until the
moving objects is visible, for example by mapping the gray levels [0 50]
to [0 255] - apply the same stretching for both difference images for comparison).
-
The Sum of Absolute Differences (SAD) over the entire image (i.e., a number
per image) for:
-
Original images.
-
Aligned images in the overlapping areas.
This should be calculated before applying the stretching.
-
An additional optional output ( extra points ): display the ''mosaic''
of the two images by averaging the overlapping region, as illustrated in
the figure below:

Apply your function on the image pairs you will find here.
Your program should:
-
Align the images using the direct method discussed in class. Use a 5-level
Gaussian pyramid (original image + 4 extra levels). Start the process at
the smallest pyramid level and iterate 5 times per level.
-
The function prototype should look like:
[shift, warped_im2, abs_diff_im_before, abs_diff_im_after, SAD_before,
SAD_after] = align(im1,im2);
Where:
-
im1 and im2: The two input images.
-
(a,b) : The 2D shift between the two images (is usually a non-integer
number).
-
warped_im2: im2 warped backwards towards im1 according
to the computed (a,b).
-
abs_diff_im_before : An image which captures the absolute differences
between im1 and im2.
-
abs_diff_im_after: An image of the pixel-wise absolute differences
between im1 and warped_im2.
-
SAD_before: Sum of absolute differences before alignment.
-
SAD_after: Sum of absolute differences after alignment (overlapping
areas only).
Please stick to this prototype, as this time there
will also be an interactive testing of your program (see further submission
instructions below).
-
You can check the quality of your alignment by viewing the two images
after
alignment in a ''movie mode'', or by flickering between them.
Submission:
Please submit in pairs. Your submission will be in two parts :
-
A hard copy report including your code, printed results and a short explanation
of the method used. Bring this to class or leave it at Tal Hassner's mail
box by the due date.
-
The function align should be sent via e-mail to hassner@wisdom.weizmann.ac.il
. This should be a one-file function (do not send multiple files). Note
that many function can be included in one MATLAB m-file. Each function
starting with the key-word "function". The function align must be the first
function in the file, which should be named "align.m".
back
Last updated: December-29-02