2D Coordinate Transformations Nick Battjes, Senior Student: Spatial Data Without Coordinates Control Points
2D Coordinate Transformations Nick Battjes, Senior Student: Spatial Data Without Coordinates Control Points
2D Coordinate Transformations Nick Battjes, Senior Student: Spatial Data Without Coordinates Control Points
+
(
=
(
Cy
Cx
Yo
Xo
a b
b a
Yn
Xn
*
y
x
x
C a b
C b a
Cy a b
C b a
+ + =
+ + =
+ + =
+ + =
60 80 300
60 80 250
10 10 190
10 10 350
No X
o
(map)
Y
o
(map)
X
n
(ground)
Y
n
(ground)
1 10 10 350 190
2 80 60 250 300
(
(
(
(
(
(
(
(
=
(
(
(
(
y
x
C
C
b
a
*
1 0 80 60
0 1 60 80
1 0 10 10
0 1 10 10
300
250
190
350
Conformal Transformation: Example
Transform a given point X
0
=121.48, Y
0
=22.78
The point is transformed to Xn=310.59, Yn=373.6773
(
(
(
(
=
(
(
(
(
(
(
(
(
=
(
(
(
(
865 . 174
189 . 369
716 . 1
203 . 0
300
250
190
350
*
1 0 80 60
0 1 60 80
1 0 10 10
0 1 10 10
1
y
x
C
C
b
a
(
=
(
+
(
=
(
6773 . 373
59 . 310
865 . 174
189 . 369
78 . 22
48 . 121
*
203 . 0 716 . 1
716 . 1 203 . 0
Yn
Xn
Conformal Transformation:
Example
Used in photogrammetry for:
Transform comparator coordinates to photo coordinates and
used for correcting film distortion
Transform model coordinates to survey coordinates
Property
Carry parallel lines
into parallel lines
Does not have to
preserve orthogonality
y
1
y
2
x
1
x
2
|
c
t
2
t
1
Affine Transformation
Physical interpretation:
6 parameters: Cx, Cy, o, c, Dx
0
, Dy
0,
and in linear form:
( ) ( ) ( )
( ) ( ) ( ) ( )
0 0 0
0 0 0
cos( ) sin
sin cos
x y
x y
Xn C X C Y DX
Yn C X C Y DY
o o c
o o c
= + +
= + + +
( )
( ) ( )
0 0
cos sin
sin cos
x x
y y
a C d C
b C e C
c Dx f Dy
o o
o c o c
= =
= + = +
= =
Xn
Yn
X
0
Y
0
o
o+c
c
DX
DY
(
+
(
=
(
Cy
Cx
Yo
Xo
d c
b a
Yn
Xn
*
Affine Transformation
2-D Affine Transformation
The formulas for an affine transformation:
If n control points are measured, this Equation is reorganized as
follows:
s T A A A
s T A A A
x x a b c
y y d e f
( ( ( (
= +
( ( ( (
1 1 1
1 1 1
1 0 0 0
0 0 0 1
1 0 0 0
0 0 0 1
A
T s s
A
T s s
A
A
Tn sn sn
A
Tn sn sn
A
a
x x y
b
y x y
c
d
x x y
e
y x y
f
y
A
(
( (
(
( (
(
( (
(
( ( ~
(
( (
(
( (
(
( (
(
(
Projective or Polynomial Transformation
Instead of 4 or 6 parameters we have many parameters at
least 8 (8 would be the Bi-linear or projective
transformation)
With more parameters we need more known points to solve
the equations
N-equations and N unknowns.
...
...
2
0 5
2
0 4 0 0 3 0 2 0 1 0
2
0 5
2
0 4 0 0 3 0 2 0 1 0
+ + + + + + =
+ + + + + + =
Y b X b X Y b Y b X b b Yn
Y a X a X Y a Y a X a a Xn
General form
Alternatively,
+ + + + + + =
+ + + + + + =
xy b y b x b y bb x b b ' y
xy a y a x a y a x a a ' x
5
2
4
2
3 2 1 0
5
2
4
2
3 2 1 0
( ) ( )
( ) ( )
+ + + + =
+ + + + + =
xy 2 A y x A y A x A B ' y
xy 2 A y x A y A x A A ' x
3
2 2
4 1 2 0
4
2 2
3 2 1 0
Polynomial Transformation
Frequently used in photogrammetry
General form:
1 0 2 0 3
1 0 2 0
1 0 2 0 3
1 0 2 0
1
1
a X a Y a
Xn
d X d Y
b X b Y b
Yn
d X d Y
+ +
=
+ +
+ +
=
+ +
Projective Transformation
Impose condition of orthogonality (c = 0)
yielding 5 parameters: C
x
, C
y
, o, Ax, Ay
Orthogonal Affine Transformation
( ) ( )
( ) ( ) ( ) ( )
0 0 0
0 0 0
cos sin
sin cos
x y
x y
Xn C X C Y DX
Yn C X C Y DY
o o
o o
= + +
= + +
Condition: orthogonality and no scale change (C
x
=
C
y
= 1)
3 parameters: o, Ax, Ay
Rigid Body Transformation
0 0 0
0 0 0
cos sin
sin cos
Xn X Y DX
Yn X Y DY
o o
o o
= + +
= + +
Least Squares Adjustment Review
Model of adjustment of indirect observation ( Gauss-Markov model)
n: # of observations
m: # of parameters
f is a vector of given observation
V is the vector of residuals
B is the matrix of coefficients
W it the matrix of weights (Variance Covariance matrix)
o
0
is the reference variance
A is the vectors of parameters to be estimated
Number of observation is larger than number of parameters (redundant
observations). The solution that minimize the least-squares criterion
(v
T
wv) is:
) , 0 ( ~
2
0
W V V B f + A = o
n u rkB < =
f W B B W B
T T
= A
1
) (
y
2
x
2
y
3
x
3
y
4
x
4
1
0
1
0
1
0
1
0
0
1
0
1
0
1
0
1
|
\
|
|
|
|
|
|
|
|
|
|
|
|
.
:= f
X
1
Y
1
X
2
Y
2
X
3
Y
3
X
4
Y
4
|
\
|
|
|
|
|
|
|
|
|
|
|
|
.
:=
General 2D Conformal Transformation,
Example
N B
T
B
( )
1
:=
The variance-covariance matrix is:
Q
XX
N :=
Q
XX
9.787E-006
0E+000
22.02E-009
122.332E-009
0E+000
9.787E-006
122.332E-009
22.02E-009
22.02E-009
122.332E-009
250E-003
0E+000
122.332E-009
22.02E-009
0E+000
250E-003
|
\
|
|
|
|
|
.
=
t B
T
f :=
t
102157.371
1161.611
0.018
0.001
|
\
|
|
|
|
|
.
=
General 2D Conformal Transformation, Example
The solution vector is:
A N t :=
A
0.99977
0.01137
0.00211
0.01222
|
\
|
|
|
|
|
.
=
The resisuals are
V B A f :=
V
0.002
0.013
0.004
0.019
0.002
0.020
0.004
0.013
|
\
|
|
|
|
|
|
|
|
|
|
.
=
General 2D Conformal Transformation, Example
The reference variance f or the adjustment is
o
V
T
V
4
:= o 0.0003 ( ) =
The Transf ormed coordinates become:
X
a
A
1
x
a
A
2
y
a
+ A
3
+ := X
a
74.913 =
Y
a
A
2
x
a
A
1
y
a
+ A
4
+ := Y
a
11.361 =
X
b
A
1
x
b
A
2
y
b
+ A
3
+ := X
b
66.502 =
Y
b
A
2
x
b
A
1
y
b
+ A
4
+ := Y
b
54.195 =
General 2D Conformal Transformation, Example
Normally shown as
Unique solution if
0 0
0 0
Xn a X b Y c
Yn d X e Y f
= + +
= + +
0
a b
d e
=
General 2D Affine Transformation
0 0
0 0
1 0 0 0
0 0 0 1
a
b
X Y Xn c
X Y Yn d
e
f
(
(
(
(
( (
=
(
( (
(
(
(
Four fiducial marks (1 - 4) and two image points (a and
b) were measured on a comparator. The comparator
photo observations and the known values from the
camera calibration report are given in the following
spreadsheet.
Photo Coordinates Known Values
Point No. x y X Y
1 -111.734 -114.293 -113.007 -112.997
2 111.734 114.293 113.001 112.989
3 -114.289 111.699 -112.997 113.004
4 114.280 -111.749 112.985 -112.997
a 74.794 12.202
b -67.123 53.432
General 2D Affine Transformation,
Example
_____________________________________________________________________________________
y
b
53.432 := x
b
67.123 :=
y
a
12.202 := x
a
74.794 :=
The measured points are:
Y
4
112.997 := X
4
112.985 := y
4
111.749 := x
4
114.280 :=
Y
3
113.004 := X
3
112.997 := y
3
111.699 := x
3
114.289 :=
Y
2
112.989 := X
2
113.001 := y
2
114.293 := x
2
111.734 :=
Y
1
112.997 := X
1
113.007 := y
1
114.293 := x
1
111.734 :=
Input Values: Note that lower case values represent observed comparator coordinates while the upper
case represents the known camera calibration coordinates f or the respective f iducial values
______________________________________________________________________________________
6-Parameter Coordinate Transformation Program
General Affine Transformation, Example
B
x
1
0
x
2
0
x
3
0
x
4
0
y
1
0
y
2
0
y
3
0
y
4
0
1
0
1
0
1
0
1
0
0
x
1
0
x
2
0
x
3
0
x
4
0
y
1
0
y
2
0
y
3
0
y
4
0
1
0
1
0
1
0
1
|
\
|
|
|
|
|
|
|
|
|
|
|
|
.
:= f
X
1
Y
1
X
2
Y
2
X
3
Y
3
X
4
Y
4
|
\
|
|
|
|
|
|
|
|
|
|
|
|
.
:=
N B
T
B
( )
1
:=
General Affine Transformation, Example
Solution: forming the B matrix and f vector
The variance-covariance matrix is:
Q
XX
N :=
Q
XX
19.573E-006
1.603E-009
44.019E-009
0E+000
0E+000
0E+000
1.603E-009
19.573E-006
244.661E-009
0E+000
0E+000
0E+000
44.019E-009
244.661E-009
250E-003
0E+000
0E+000
0E+000
0E+000
0E+000
0E+000
19.573E-006
1.603E-009
44.019E-009
0E+000
0E+000
0E+000
1.603E-009
19.573E-006
244.661E-009
0E+000
0E+000
0E+000
44.019E-009
244.661E-009
250E-003
|
\
|
|
|
|
|
|
|
.
=
General Affine Transformation, Example
t B
T
f :=
t
51079.018
583.52
0.018
578.092
51078.353
0.001
|
\
|
|
|
|
|
|
|
.
=
The solution vector is:
A N t :=
A
0.99977
0.01134
0.00211
0.01140
0.99977
0.01222
|
\
|
|
|
|
|
|
|
.
=
General Affine Transformation, Example
The resisuals are
V B A f :=
V
0.001
0.016
0.001
0.016
0.001
0.016
0.001
0.016
|
\
|
|
|
|
|
|
|
|
|
|
.
=
The reference variance f or the adjustment is
o
V
T
V
2
:= o 0.001 ( ) =
General Affine Transformation, Example
The Transf ormed coordinates become:
X
a
A
1
x
a
A
2
y
a
+ A
3
+ := X
a
74.913 =
Y
a
A
4
x
a
A
5
y
a
+ A
6
+ := Y
a
11.359 =
X
b
A
1
x
b
A
2
y
b
+ A
3
+ := X
b
66.504 =
Y
b
A
4
x
b
A
5
y
b
+ A
6
+ := Y
b
54.197 =
General Affine Transformation, Example