Transcript Document

Ch 7. Geometry
Last updated 2015. 03. 04
Heejune Ahn, SeoulTech
Outline










Geometry and transform
Shape description
Shape preserving transform
Homogeneous coordinate
2D Affine transform
Procrustes transform & alignment
Projective transform
Nonlinear transform
Warping
Overdetermined spatial transform
0. Geometry transform

Purpose of Geometry transform



To remove optical distortion at capturing process
To map onto standard references for comparison
Shape (in detail in Ch9)



Tightly related to geometry transform
Geometry change => Shape change
Shape descriptor types


Shape vectors
compact (but approximate) parameters of shape info
1. Shape description/representation

Shape


(Roughly) the boundary of an object
Simple shapes: e.g.) eggs, footballs, cigars, books


Complicate shapes: e.g) human faces, cars


able to specify mathematically
Unable to specify mathematically, need general
descption
General description of shape


An ordered set (sequence) of coordinate pairs
(tuples in N-dim)
Shape vector

Generating Shape vectors

STEP1: Find the boundary


Image segmentation (in Ch10)
STEP2: Meaningful definition of the shape

Meaning in respect of application
2. Shape preserving transform

Shape-preserving transforms

Then, the definition of shape

All geometric info that remains after translation,
rotation, and scale.

Minimal representation and Shape alignment

SV representation is redundant,


Since multiple SV representation
Procrustes Alignment

Minimal representations or standard representation
3. Homogeneous coordinate

PDM (point distribution matrix)

Matrix notation of SV

Easy to transform using matrix multiplications


E.g.) Scaling, x, y shearing, rotation
But, unfortunately, not for translation

Homogeneous coordinate

Can unify those operations into
matrix multiplication.
H.C

normalize
Concept



3D to 2D mapping
Use of prospective spaces as a means
of removing the special role of the
origin in a Cartesian coordinate
cf) planner projection: (x,y,z) to (x,y,0)
4. Affine 2D transform

Affine 2D Transform

6 parameters transform



c, f : translation
a, b, c, d: rotation, shear, scaling
Not shape preserving

Straight line to straight line, parallel lines to parallel lines,
but rectangular to parallelogram (due to the SHEAR)
5. Affine transform in HC

Cartesian Coord. to Homogeneous Coord.
=

Ex.

Affine transform examples
6. Procrustes transform

Procrustes transform

A special type of Affine transform

Preserving the shape

Decomposed into T = S R X
Procrustes
7. Procrustes alignment

Step1: Translation
centroids


Scaling
y y


Rotation

Eginervector matrics of SVD of matrix

Example 7.1

MATLAB




[d,Z,T] = procrustes(X,Y)
T.c (translation), T.T: rotation, T.b : scale
Z = b*Y*T + c (transformed results)
d : sum of squared difference
8. Projective transfrom

Projective transform


3D to 2D (in Camera)
Not shape preserving, not distance preserving

8 (not 9) degree of freedom (DoF)

Useful in different view points mapping


Especially, stereo vision
MATLAB



t = cp2tform(ipoints, rpoints, ‘perspective)
imtransform(Image, t)
ginput(n), imcrop(Image)

Example
Summary

Linear Geometry transforms
9. Non-linear transform

Nonlinear geometric transform is


Wrapping




if Tx or/and Ty is non-linear func of (x,y)
bending in English dictionary
Strat lines to non-straight lines (curves)
Often by cheap, wide angle cam
MATLAB (Ex7.3)


R = makeresampler(interpolant, padmethod)
B = tformarray(A, T, R, TDIMS_A, TDIMS_B, TSIZE_B,
TMAP_B, F)

Warping example


Pincushion : a > 0
Barrel effect: a < 0
10. Warping

Warping


Geometric Xform of points together with pixel
values
Warping procedure

1) locate ‘tie-points’ in base (x’,y’) & input (x,y)


2) define functional mapping function



Tie points: lands mark pairs in input &base img.
x’ = f(x, y) and y’ = g(x,y)
3) solve the params of f(.) and g(.)
4) calculate values at all (x’,y’)

(x’, y’) to (x,y), then I(x,y)

Ex 7.4


cpselect: tie-points
cp2tfrom:


imtransform


parameters extr.
apply transform
CP: control points
11. over-determined warping

Background
B
A

C
Y = ax + b
2 parameters
(2 DoF)
1 point (constraint) :
under-determined
2 point (constraint) :
determined
over 3 points (constraint) :
over determined
Over-determined in bilinear transform
8 params (4 tie-points)


exact mapping impossible for more than 4 ties.
Least square solution

Determines parameters that minimizes the Sum of
Square distances

Ex 7.5 (plastic surgery, Micheal Jackson MV)

Unsatisfactory !
12. Piecewise Warp

Ex 7.5: global transform
warping, unsatisfactory


too many tie-points with two small
parameters
Solutions for many tie-points

Many parameters, but global


needs high-order polynomial
transform
Piecewise warp


Many contiguous region
of a small number of tie-points
Generally much easy and better!
13. Piecewise affine warping

Affine


Local linear is often KING !
Delaunary Triangulation

Triangular: basis

M (affine transform)
13. Piecewise affine warping

Algorithm

Ex.

piecewise
What is criteria?
global
14. Forwards vs reverse mapping

Mapping direction
forwards
reverse

Forward sounds natural, but some drawbacks




multiple points mapped to single
no input points to the target (holes)
mapped to points out of region
Reverse mapping is often used

map base to input