Morphing is a technique to turn an image into another through a seamless transition and it is mostly used to create a metamorphosis between two person's faces.
To generate this seamless transition, we should know where the pixels of a source image
S will end up being in a target image
T. To make some calculations simpler, we reverse the problem and instead we find from which position
x(S) a pixel of
T located at
x(T) came from. This sort of inverse warp resembles the semi-lagrangian advection developed by Jos Stam in his famous paper Stable Fluids.
Defined by hand pairs of corresponding points
p(S) and p(T), we initially compute a
Delaunay Triangulation for the set of points
(p(S) + p(T)) / 2. The resulting mesh is displaced to fit into
p(S) and
p(T) generating a pair of corresponding triangulations
t(S) and
t(T).
Given
t(S) and
t(T) we proceed computing the set of affine matrices
M that maps triangles of
t(T) into corresponding triangles of
t(S) so that
M*t(T) = t(S). Subsequently for each pixel of
T located at
x(T) = (x,y), contained into a triangle
Tr, we compute its corresponding position
x(S) through the matrix-vector multiplication
M(Tr) * x(T) = x(S). Finally, we warp
S into
T interpolating the color of the surrounding pixels at
x(S) and placing the resulting value in
x(T).
Left: source image; Right: target image. http://www2.imm.dtu.dk/~aam/datasets/datasets.html
|
|
Pairs of correspondent points defined over the two images.
|
|
Delaunay Triangulations.
|
|