Programming Assignment #1: Image Mosaicing
Terence Sim

I took 3 pictures of the area around where I live for this assignment, using a Nikon digital camera..  The scene includes the First United Methodist Church, Arlington Apartments and neighboring shops.  Initially, I intended to use pictures of a notice board (to get a planar surface), such as this:

But, as can be seen, the fish-eye effect was quite prominent at the edges of the notice board, so that straight lines appear curved.  So I opted to use pictures of objects at "infinity", to avoid the lens distortion.  Hence the building pictures.

The original 640x480 RGB images (saved in Jpeg format) are shown here.  The red crosses (no pun intended, though some of them are on the church steeple) show the point correspondences between the first and second images, while the yellow crosses are for the second and third images.  I manually marked them after zooming in for better precision.  I used 6 points for correspondence, and solved for the projective map using least squares.  I believe this will help reduce errors in the manual registration than if I had used 4 points.  (6 points mean that the system of equations is overconstrained.)  Note that there is significant overlap between the second and third images.

Original images (640x480)

The final mosaic image, using the 640x480 input images, is 1020x572 pixels.  As of the deadline of this assignment, the image is still being generated.  It takes a long time to mosaic something so large.  (Maybe I should learn some Matlab tricks to improve speed.)

So I reduced the original input images to a quarter of their size, i.e. to 160x120 pixels.  The projective maps are recomputed (using the scaled coordinates of the correspondences), since these maps do not scale linearly.  This produced a mosaic output image of 254x143 pixels, which is shown here.  The viewpoint is from that of the second original image.  The mosaic image is generated for each RBG plane using the destination scan method, and where necessary, bilinear interpolation is used.  The pixel values from different images are simply averaged with equal weighting, regardless of pixel position.

Mosaic image from 1/4-sized originals

Slight edge artifacts are visible in the mosaic.  The fence in the foreground is blurred probably due to the low resolution.  The church building, which appears in all 3 original images, appears to be well composited.  The black patch at the bottom center of the image is actually the shadow of a building, and not a failure of the mosaicing program.  The original images have this shadow as well.

I also generated a mosaic from the half-sized original images.  That output is shown here (509x286).  There is better resolution in the fence, at which slight misalignment is also obvious.

Mosaic from 1/2-sized originals


The whole assignment was done entirely in Matlab, which explains the long processing time.  This was even after I used as much as 64Mb to store all 3 original images, and to allocate memory for the final mosaic image.  I intend to show the large mosaic (1020x572) as soon as it is completed.  This is a link to it.

-- Terence (