CSE 590SS Project 1: Panoramic Mosaic Stitching

Notes on using the sample ImageLib software

(This page was updated 20-Jan-2001 to reflect the fact that IPL is no longer needed. To see the older description with IPL usage, click here.)

To help you with your first project, I have written a simple C++ imaging library, and much of the code needed to perform the warping, alignment, and stitching.  To download the latest sample code as a zip file, click here. To download the earlier version that used IPL, click here.

The code provides the following basic functionality, inside the library called ImageLib:

Image.h            main CByteImage, CFloatImage, … classes

ImageLib.h            main include file

FileIO.h            read / write Targa (TGA) files

Convert.h            convert between image types and select bands

Convolve.h            perform 2D and separable convolutions

Pyramid.h            image pyramids

Transform.h            3x3 coordinate transformation matrices

WarpImage.h            per-pixel and global (parametric) image warping

Images are pretty simple:  they have a type (byte, int, or float), a width and a height, and a number of bands (RGBA color images are 4-banded, and alpha is stored in band 3).

You can allocate images on the stack and pass them around as parameters and return values.  The storage in an image is reference counted and shared during construction and assignment.  You should never need to use new and delete with the image classes.

The code is now stand-alone, and should compile on Linux as well (if I transcribed Doug Zonker's Makefile fixes correctly). However, if you are still having trouble compiling, please send email to the class mailing list (cse590ss@cs.washington.edu). While we expect most students will find the supplied code helpful, you are welcome to write it from scratch yourself and use other packages if you clear it by us first.

How to extend the sample code for your project

In the v4gP1 project, you will find 3 files to which you will have to add code:

WarpCylindrical.cpp            compute the inverse map coordinate to warp your images

LucasKanade.cpp            iterative coarse-to-fine alignment with Lucas-Kanade

BlendImages.cpp            blend the aligned images and crop/trim the result

The places where you need to add code are marked by “TODO”.  If you figure out the right things to add, it shouldn’t be more than a few dozen lines (at most) to each file.

There is also one command-line dispatch file

Project1.cpp

that lets you call all of the necessary routines from a shell, passing images and parameter values as inputs/outputs.  Each processing function (warping, alignment, etc) is invoked by specifying a different “command” (cylWarp, blendPairs) as the second argument of Project1 (see the .cpp file for documentation).   You can also write a script with a series of commands in it (so you don’t have to remember the parameters) and run with with the script command.  A sample script to do a two-image alignment is provided in stitch2.txt.

If you are using the sample code for your project, please submit the C++ files you have modified, along with any script files you are using.

Sample images

The sample images are in the directory

            http://www.cs.washington.edu/education/courses/590ss/01wi/images/pano1.zip

which can also be access locally (from NT) as

            \\ntdfs\cs\cse\www\education\courses\590ss\01wi\images

There are also some TGA formatted images (the first 4 from the sequence) in the images subdirectory of the sample code project, as well as the result of stitching these 4 images together (stitch4x.tga).