1 of 60

Image Morphing

Tong-Yee Lee

Blending

2 of 60

2D/3D Morphing/Metamorphics

a: Correspondence

Problem

b: interpolation

More challenging in 3D, i.e,

polygons

are different

3 of 60

Feature Line 2D Image Morphing

Beier&Neely (SIGGRAPH 1992)

4 of 60

Image Morphing Example

5 of 60

An Ideal Example

color blending (r,g,b)

src

dst

6 of 60

Cross-Dissolving

  • Blend images with over operator

(r,g,b)

7 of 60

Dog Averaging

What to do?

    • Cross-dissolve doesn’t work
    • Any ideas?

Ghost effect

8 of 60

Blending is still useful and has some applications when shapes are similar by just replacement

9 of 60

Image morphing

  • The goal is to synthesize a smooth transformation from one image to another.

image #1

image #2

dissolving

  • Cross dissolving is not good for morphing because of the ghosting effects.

10 of 60

Image Morphing

  • Animate transitions between two images
    • Specify Correspondence
    • Warping to change shapes
    • Blending

t= 0

t=1

t= 0.5

11 of 60

Image Morphing

  • Combine warping and cross-dissolving

Ideally change shapes during morphing

12 of 60

Image morphing

morphing

cross-dissolving

image #1

image #2

warp

warp

Warping is key and hard part !!!

13 of 60

Morphing procedure:

for every t,

1. Find the average shape (the “mean dog”☺)

- local warping

2. Find the average color

- Cross-dissolve the warped images

14 of 60

Image morphing

  • Why ghosting?
  • Morphing = warping + cross-dissolving

shape

(geometric)

color

(photometric)

15 of 60

Image Morphing

  • The warping step is the hard one
    • Aim is to align features in images

16 of 60

Warp Specification

How can we specify the warp?

    • Specify corresponding vectors
      • interpolate to a complete warping function
      • The Beier & Neely Algorithm�
  • Thaddeus Beier, Shawn Neely, Feature-Based Image Metamorphosis, SIGGRAPH 1992, pp35-42.

17 of 60

t = 0

t=1

P_t = (1-t) *P_L + t* P_R

control each line point (i.e., x1,x2, y1,y2): P_t

Each line: starting point (x1,y1) and ending point (x2,y2)

A control line vector (x2-x1, y2-y1)

Control Line Vector

(0,0)

18 of 60

morphing

image #1

image #2

warp

warp

t= 0

t= 1

t

Color t = (1-t)Color_L+tColor_R

19 of 60

t= 0

t=1

t= 0.5

(0,0)

20 of 60

t= 0

t= 0.5

t= 1

21 of 60

Image Morphing

22 of 60

�How do we compute colors at dest pixels? (resampling�

23 of 60

Two Options

24 of 60

Forward Mapping - Problems

holes

25 of 60

26 of 60

Holes

Forward mapping

by rotation

Inverse mapping

27 of 60

28 of 60

29 of 60

Backward Mapping

 

t

1-t

30 of 60

Feature-based Warping

  • Berier and Neeley use feature pairs of lines to control warp
    • Given a pixel P in dest image, where is P in source image?

But, u is fraction but not length, it will make correspondence between two control lines with different lengths

Beier&Neely (SIGGRAPH 1992)

(0,0)

31 of 60

The dot product is useful for several things. One of the important uses is in a formula for finding the angle between two vectors that have the same initial point.

u

v

θ

Technically there are two angles between these vectors, one going the "shortest" way and one going around the other way. We are talking about the smaller of the two.

||v||cosθ >0

if θ <90

https://www.mathsisfun.com/sine-cosine-tangent.html

32 of 60

Assume (Q-P)

= (a,b)

Perpendicular

(Q-P) = (b, -a)

x

y

(a,b)

(b,-a)

u>0

u<0

(Q-P)

x >0 such as (1,0)

33 of 60

Warping with One line pair

  • What happen to the F?

34 of 60

Warping with One line pair

  • What happen to the F?

35 of 60

Warping with One line pair

  • What happen to the F?

36 of 60

Warping with One line pair

  • What happen to the F?

37 of 60

Warping with Multiple Line Pairs

(0,0)

(h-1,0)

(w-1,0)

(h-1,w-1)

38 of 60

Warping with Multiple Line Pairs

39 of 60

Weighting Effect of Each Line Pair

  • To weight contribution of each line pair
    • T. Berier and Neeley use:

A constant a is used to avoid dividing by a zero distance[i]

Values of b in the range [0.5, 2] are the most useful. The value of p is typically in the range [0, 1]

40 of 60

Ex: p’=w1/(w1+w2)p1+w2/(w1+w2)p2

p1

p2

Color at p = Color at p’

Weight is computed for each line on destination image

Note: we need to compute color in a bilinear way

41 of 60

Warping Psuedocode

42 of 60

Berier and Neeley’s Examples

43 of 60

Warping Psuedocode

44 of 60

45 of 60

Morphing is not only for faces

46 of 60

Summary

Image warping

Image morphing

47 of 60

Multiple Image Morphing

48 of 60

Barycentric coordinates

49 of 60

Barycentric coordinates

t1 = Area(p,A2,A3)/Area(A1,A2,A3)

t2 = Area(p,A1,A3)/Area(A1,A2,A3)

t3 = Area (p,A1,A2)/Area(A1,A2,A3)

50 of 60

Stages of eating red apple stock photo

Can you try to create it from left to right directly?

51 of 60

Convert to mesh warping

Define a triangular mesh over the points

    • Same mesh in both images!
    • Now we have triangle-to-triangle correspondences
    • Need to find a good corresponding mesh mapping

52 of 60

Defining Keypoints

Matching keypoints are manually annotated on both the start and final image. Below are two examples of such matched annota

Annotated Start Image

Annotated Final Image

https://inst.eecs.berkeley.edu/~cs194-26/fa17/upload/files/proj4/cs194-26-aae/

53 of 60

Some application:�Medical slice interpolation

Tong-Yee Lee, Chao-Hung Lin

Feature-guided Shape-based Image Interpolation

IEEE Transactions on Medical Imaging, Vol. 21, No. 12, pp. 1479-1489.2002 [Web]

54 of 60

Some application in 3D Morphing

Tong-Yee Lee, P.H Huang.�Fast and Institutive Polyhedra Morphing Using SMCC Mesh Merging Scheme.�IEEE Transactions on Visualization and Computer Graphics, Vol. 9, No. 1, pp. 85-98, 2003 [Web]

55 of 60

Warping from 3D to 2D

Matching feature points by warping

Basic Idea

56 of 60

3D Metamorphis

57 of 60

Image Morphing Example

Some tricks

Viewing

continuousity

In neighboring

images

58 of 60

View Morphing

http://homes.cs.washington.edu/~seitz/vmorph/vmorph.htm

Need to consider view transformation when morphing

  1. Do a morphing on a specific view
  2. Rotation the morphing results to a selected view

Viewing difference is large

inbetween neighboring images

59 of 60

Face-Morphing using Generative Adversarial Network(GAN)

60 of 60

  • Image Morphing with Perceptual Constraints and STN Alignment

http://efaidnbmnnnibpcajpcglclefindmkaj/https://arxiv.org/pdf/2004.14071.pdf