CS-511 - Assignment 3 (5%)
Warping and Morphing
Due by: October 16, 2008
In this assignment you need to implement inverse mapping of one or more
of the spatial transformations discussed in class for ONE out of the
following three applications:
- Image morphing
- Texture mapping
- Image mosaic
- It is up to you to determine which mapping scheme to use. You
must clearly indicate in your program/report which is the option you
selected. The report must be sufficiently detailed.
- When developing your application you need to evaluate and verify
the results you obtain and check that that they correspond to
your understanding of the expected results.
- You may NOT use the OpenGL texture mapping functions. Use SVL/VL
to manipulate vector/matrices.
- Example program demonstrating point selection and image display
will be provided.
- Some systems do not have GL_BGR defined/implemented. If you get
an error about this change GL_BGR to GL_RGB. This will require
you to exchange between the R and B components after reading the
image.
- Your application should be able to load (and save) matched points
from (to) a file. You must provide point files that can be used with
your application.
- Image morphing: In this program the user has to
interactively select a set of matching points in two images. The input
to the program should be the names of two image files (with identical
dimensions) and the required number of steps between them. Once the
points are specified by the user, pressing 'r' renders the next frame in
the sequence. Pressing 'g' renders all the frames from start to end and
then back to start again without further user intervention. Pressing '1'
moves to a mode where one of the warped images is shown without
blending. Pressing '2' returns to the normal (with blending) mode.
It is recommended that you use thin plate splines to warp the images. Note
that a SINGLE affine/projective mapping will not suffice.
- Texture mapping: In this program the user has to
interactively select corresponding points between a 2D projection of a
simple wireframe model (e.g. a cube or a cylinder) and an image. Based
on the user specification the texture of the image is mapped onto the 2D
projection of the model.
Pressing the arrow keys should allow the user to rotate the object (with
texture mapped on it). Use a simple triangulation algorithm to
triangulate the points, then estimate MULTIPLE affine mappings to map
the texture of each triangle. Note that a SINGLE affine/projective
mapping will not suffice.
- Image mosaic: In this program two partially overlapping
images are specified as command line arguments. Assume that the images
were taken under pure camera rotation. The user should interactively
click on 4 or MORE corresponding points in the images that are visible
from the two views. Based on the point correspondence specification the
right image should be rectified so as to become coplanar with the left
image by using a projective mapping. The two views should then be
blended together where they overlap and the combined mosaic should be
displayed. Note that in this option you need to estimate a SINGLE
projective transformation.
- Warping should be done by using inverse mapping. Bilinear
interpolation should be used to find the value of the inverse mapping in
subpixel resolution. This applies to all three assignment options.
When using inverse mapping, it is possible that the source location is
outside the image region. In such a case use a unique color (e.g. black)
instead of image data.
- A simple triangulation can be generated by overlaying a grid (with
a variable number of grid lines) and dragging the grid junctions to
specify the location of the control points.
Finding all the pixels in one triangle can be done by using a
scan-fill algorithm. Since we are assuming triangles, the scan-fill
algorithm is very simple: starting from the top most vertex and ending
with the bottom most vertex of the triangle you need to find a set of
horizontal intervals belonging to the triangle. Each such interval
starts at the left edge of the triangle and ends at its right
edge. Finding the starting and ending point of each interval is
simple.
- In the texture mapping option the user needs to specify
corresponding image and object points interactively. The image
coordinates are referred to as texture coordinates and are assigned to
each vertex. A simple way to assign texture coordinates interactively is
to traverse the object vertices (while highlighting them) and ask the
user to click on corresponding image points.
- If implementing TPS, you need to allow the user to change the
regularization parameter. Note that a separate TPS interpolation is
needed for each coordinate.
- To evaluate the quality of the mapping you obtained, map the
control points and measure the Euclidean distance between the known and
expected locations. Print the average value of this measure (expected to
be small). If you are using TPS, print in addition the bending energy
you obtained.
- When debugging you program start with simple cases: identical
control points (no deformation), simple linear deformations (such as
translation), and small deformations (start with identical control
points, then move them slightly).
- When solving a system of equations make sure that there is a
sufficient number of control points and that the configuration is not
degenerate. Make sure that the resulting matrix is non-singular
(i.e. has non-zero determinant).
- Please follow the submission procedure of assignment 1.
Gady Agam
2008-10-02