Assignment 2: Beier-Neely Image Morphing

 CS 551/651 Advanced Computer Graphics

Spring 2002

Due: 9:00 a.m. Tuesday, February 26th

Goal: To build a program that uses the Beier-Neely Siggraph 1992 method to morph one image into another.
Details:

Read the Beier-Neely 1992 Siggraph Paper, Feature-Based Image Metamorphosis:
      http://www.cs.princeton.edu/courses/archive/fall00/cs426/papers/beier92.pdf
      http://www.hammerhead.com/thad/morph.html

You can use the code you developed in Assignment 1 as a starting point, but you will have to use FLTK ( http://www.fltk.org ) to augment the user interface for this assignment.  To assist with your FLTK development, I will release some starter code (will email soon and add to this page as well).  Please feel free to learn from one another about how to debug and build FLTK programs.

User Interface (25 points):

  • Load Images: The user interface must provide a means for the user to type in the names of the source and destination images (no interactive file selection widget is required).    Your program can use any image format you choose, but the image sizes should be 256x256.  You can find a BMP image loader in this assignment code from my intro course: http://www.cs.virginia.edu/~gfx/Courses/2001/Intro.fall.01/Exercises/Exercise2/ .  Another useful site: http://www.seas.gwu.edu/~graphics/cs206/opengl_save_howto.html .

  • Edit feature segments: Your user interface must allow the user to interactively place,  move, and remove line segments on the source and destination images.

  • Interactively test morphing: Provide a type-in box that the user can use to enter a number between zero and one.  This box will be used to control what intermediate image is rendered to the GUI.

  • Load and store feature segment descriptions: The user interface must provide a way to save and load a line segment description file.

  • Save images for a movie: Provide a button that causes a two-second sequence of images (60 images) to be written to the directory from which the program was run.  Name the images however you wish, but make sure they are listed in order (note: prepend index numbers with leading zeros to preserve ordering).  See the GW URL above for info about writing TIFF files.  Hint: make the rendered images small at first so debugging will be faster.

Graphical Environment (25 points):

  • Use OpenGL for the rendering.

  • Create an orthographic camera.

  • Create three squares, positioned side by side, and texture map the source and destination images on the left- and right-most squares respectively.  The images should be 256x256.  The center image will be used to display the texture map of intermediate morphed images.

  • As the user clicks the mouse (and the interface buttons), render the appropriate lines on the source and destination images.  If an intermediate frame of the morph is being rendered to the middle square, also superimpose the interpolated line segments.  Note you may use glut or fltk to obtain mouse positions and mouse clicks.

Morphing Algorithm (50 points):

  • Use endpoint interpolation to compute intermediate line segment positions.

  • Write the forward and inverse mapping functions defined by Beier and Neely.

  • Write the morphing code.

Extra Credit:

  • 5 pts - Add type-in boxes to interactively adjust the a, p, and b parameters.

  • 10 pts - Implement an antialiasing technique.

  • Do the points even matter? The Beier-Neely algorithm has been industry tested and it provides good results, though it's a bit slow.  A recent paper by George Wolberg, Recent Advances in Image Morphing, discusses some alternative methods that you may wish to implement instead of Beier-Neely.  The radial basis function, thin-plate splines, and energy minimization papers he references are interesting but be careful not to get caught at the deadline without a working implementation.

  • Others?  I'm easily impressed.

Turnin: Create an interesting 2-second (60 image) movie.  *Don't turn in your individual images, just the movie* Submit your source image, destination image, and the feature line segment file you used.  Create one tarball or zip file containing these files and the source code, non-standard include files, project files, etc. and your writeup.  Include instructions for using your program in the writeup.  Email your file to dbrogan@cs.virginia.edu
Hints, Code, Setup:

The glut.h file and glut libraries: http://www.opengl.org/developers/documentation/glut.html

OpenGL (normally included with OS):
http://www.opengl.org/users/downloads

FLTK: http://www.fltk.org/

Collaboration and Use of Web Materials:

You can use any materials you find on the web for this assignment.

You can talk with one another about your program, but do not look at anyone’s code and do not show your code to anyone.

Late Days: You have a total of five late days to use during the semester.  Each late day you use will provide you with a 24 hour extension.