Peihong Guo's CSCE 646 Projects

Project 07

Transformation and Warping

Image:   or   Upload image:

Grid based interactive transformation Moving Least Square Parameterized transformation

Grid Size:  x

Transformation parameters

Forward Map Inverse Map Super Sampling

Operations supported:
OperationCommand formatExample
Scalings sx sy Scaling by 0.5 in x direction and 0.75 in y direction:
s 0.5 0.75
Translation t tx ty Translation by 32 in x direction and 64 in y direction:
t 32 64
Rotation r deg Rotation by 45 degree counter clockwise:
r 45
Shear sh shx shy Shear transformation with 0.5 in x direction and 0.25 in y direction:
sh 0.5 0.25
Mirror m axis Mirror along x axis:
m x
Note: axis can only be x or y
Perspective p px py Perspective transformation with vanishing point at (1.0/a,0) and (0, 1.0/b):
p a b
Bilinear b x0 y0 x1 y1 x2 y2 x3 y3 Bilinear transformation with 4 corners(top left, bottom left, top right, bottom right) at (0, 0), (256, 16), (32, 200), (200, 168):
b 0 0 256 16 32 200 200 168
Composition cbegin
op1 params
op2 params
...
cend
cbegin
s 0.5 1.5
t 32 64
sh 0.1 0.2
p 0.001 0.002
cend
Swirl sw degree Swirl with 90 degree:
sw 90
Iteractive Warping Switch to interactive mode by choosing grid based interactive transformation or moving least square. Enter the grid size. By default, a 1x1 grid is used, and bilinear warping is performed. Grid-based warping is performed if a larger grid is used.

Basic operations:
  1. Press 'c' to show/hide control points;
  2. Press 'g' to show/hide grids;
  3. Drag around the control points to deform the image.
Please see the video below for details.
For speed consideration, please use Chrome browser ONLY for the interactive warping, and use forward mapping when image quality is not a main concern.

Results

Note: the images are rescaled for webpage viewing, please click on them to see the full size images.

Moving least square deformation

The warping uses forward mapping for speed consideration. Inverse mapping is also implemented, but runs at a significantly slower speed. The black curves presented are due to the forward mapping method.

Grid-based warping using bilinear warping for each grid cell

Bilinear warping

Scaling

Original Image

Original Image

Original Image

Scale

Scaling with 0.5, 0.75

Scaling with 0.5, 0.75

Translation

Translation with 32, 64

Translation with 32, 64

Rotation

Rotation with 128 degree, counter clockwise

Rotation with 128 degree, counter clockwise

Shear

Shear with 0.5, 0.25

Shear with 0.5, 0.25

Mirror

Mirror with respect to x axis

Mirror with respect to x axis

Perspective

Perspective with 0.0005, 0.0007

Perspective with 0.0005, 0.0007

Bilinear

Shear with 0.5, 0.25

Shear with 0.5, 0.25

Composition 1

Rotate 45 with respect to image center.
cbegin
t 320 214
r 45
t -320 -214
cend

Rotate 45 with respect to image center.

cbegin
t 256 256
r 45
t -256 -256
cend
Composition 2

cbegin
sh -0.1 -0.1
p 0.0005 -0.0005
r 6
t 64 0
cend

cbegin
sh -0.1 -0.1
p 0.0005 -0.0005
r 6
t 64 0
cend

Swirl