Assignment 3: Beier-Neely Image Morphing

 CS 445/645 Introduction to Computer Graphics

Spring 2004

Due: 5:00 p.m. March 23rd

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 will develop an FLTK / OpenGL program to allow the user to load images, annotate them, and generate intermediate morphed images.  Choose images of your choice and use them to create a sixty-frame AVI movie.

Click here to grab a working version of the program and two test images.

Click here to grab a skeleton program.

User Interface (20 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 use the image loader from assignment 1.  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.  You may define the nature of the interface (for example, how does the user know when she is creating/moving/deleting vertices?)

  • 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.  You can define the line segment format.

  • 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 (20 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.

Movie (10 points)

  • Use a software tool (bmp2avi, for example) to combine your images into an AVI movie.

Extra Credit:

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

  • up to 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 a subdirectory named Assignment3{yourID}.

Copy all source code to this file.

Create a README that details 

  • Any extra credit you performed 
  • The compiler you used
  • Instructions for using your program

Create a subdirectory of Assignment3 called Example.

In Example, place the two images, the line file, the 60 images of their morph, and the resulting movie.

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.