Announcements Last lecture in a nutshell Parallel lines meet in the

Announcements
• Read Chapters 1 & 2 of Forsyth & Ponce
• Discussion board created by Eric Weigle
Image Formation,
Cameras, Radiometry
http://cse-gsa.ucsd.edu/forum/viewforum.php?f=11
Computer Vision I
CSE 252A
Lecture 4-Part I
CS252A, Winter 2005
Computer Vision I
CS252A, Winter 2005
Computer Vision I
Pinhole Camera: Perspective projection
• Abstract camera model - box
with a small hole in it
Last lecture in a nutshell
CS252A, Winter 2005
Computer Vision I
Geometric properties of projection
• Points go to points
• Lines go to lines
• Planes go to whole image
or half-plane
• Polygons go to polygons
• Angles & distances not preserved
CS252A, Winter 2005 Forsyth&Ponce
Computer Vision I
Parallel lines meet in the image
• vanishing point
• Degenerate cases:
– line through focal point yields point
– plane through focal point yields line
Image plane
CS252A, Winter 2005
Computer Vision I
CS252A, Winter 2005
Computer Vision I
1
Projective Geometry
•
Homogenous Coordinates & the camera matrix
Axioms of Projective Plane
1. Every two distinct points define a line
2. Every two distinct lines define a point (intersect
at a point)
3. There exists three points, A,B,C such that C
does not lie on the line defined by A and B.
•
•
Different than Euclidean (affine) geometry
Projective plane is “bigger” than affine
plane – includes “line at infinity”
Projective
Plane
=
Affine
Plane
+
Homogenous Coordinates
– Euclidean -> Homogenous: (x, y) -> k (x,y,1)
– Homogenous -> Euclidean: (x, y, z) -> (x/z, y/z)
– Projective transformation
– 3 x 3 linear transformation of homogenous
coordinates
– Points map to points, lines map to lines
Line at
Infinity
CS252A, Winter 2005
Computer Vision I
CS252A, Winter 2005
 u1   a11
u  = a
 2   21
u3   a31
a12
a22
a32
a21   x1 
a23   x2 
a33   x3 
Computer Vision I
• Perspective
The equation of projection
u  f  x 
v  = z  y
 
 
• Assume that f=1, and perform a Taylor series
expansion about (x0, y0, z0)
Cartesian coordinates:
x y
(x, y, z) → ( f , f )
z z
Homogenous Coordinates
and Camera matrix
X
 U   1 0 0 0 
Y
  

 V  =  0 1 0 0  Z
  
1

W   0 0
f 0  T 
CS252A, Winter 2005
Computer Vision I
u  1  x0  1  x0 
1 1 
 v  = z  y  − z 2  y  ( z − z0 ) + z 0 (x − x0 )
 
0
0
 0 
0 
0  
1 0
1 2  x0 
(z − z0 )2 + L
+   ( y − y0 ) +
z 0 1 
2 z03  y0 
• Dropping higher order terms and regrouping.
 x
u  1  x0  1 / z0 0 − x0 / z02   
y = Ap + b

v  ≈ z  y  + 
2  
 
0  0
 0 1 / z 0 − y0 / z 0   z 
 
CS252A, Winter 2005
Computer Vision I
What if camera coordinate system differs
from object coordinate system
Orthographic projection
Take Taylor series about (0, 0, z0) – a point on optical axis
{c}
{W}
 x' = x

 y' = y
CS252A, Winter 2005
X 
 U   1 0 0 0  
 Y 
  
 V  =  0 1 0 0  
W   0 0 0 1  Z 
 
  
T 
P
Translation & Rotation between Coordinate Systems
Computer Vision I
CS252A, Winter 2005
Computer Vision I
2
Rotation Matrix
B
A
 i A .i B
R =  i A .jB
i A .k B
j A .i B
j A .jB
j A .k B
CS252A, Winter 2005
Coordinate Changes: Rigid Transformations
k A .i B 
k A .jB 
k A .k B 
 A i TB 


=  A jTB 
 A k TB 


=
[
B
B
iA
B
jA
kA
B
]
Computer Vision I
P = ABR AP + BOA
CS252A, Winter 2005
Computer Vision I
Some points about SO(n)
• SO(n) = { R ∈
ℜnxn :
RTR
SO(3)
• Parameterizations of SO(3)
• 3-D manifold, so between 3 parameters and
2n+1 parameters (Whitney’s Embedding Thm.)
= I, det(R) = 1}
– SO(2): rotation matrices in plane ℜ2
– SO(3): rotation matrices in 3-space ℜ3
• Forms a Group under matrix product operation:
–
–
–
–
•
•
•
•
–
–
–
–
–
–
Identity
Inverse
Associative
Closure
Closed (finite intersection of closed sets)
Bounded Ri,j ∈ [-1, +1]
Does not form a vector space.
Manifold of dimension n(n-1)/2
Roll-Pitch-Yaw
Euler Angles
Axis Angle (Rodrigues formula)
Cayley’s formula
Matrix Exponential
Quaternions (four parameters + one constraint)
– Dim(SO(2)) = 1
– Dim(SO(3)) = 3
CS252A, Winter 2005
Computer Vision I
Rigid Transformations as Mappings: Rotation about the k Axis
CS252A, Winter 2005
Computer Vision I
Rotation: Homogenous Coordinates
y
p'
• About z axis
θ
z
x'
y'
z'
1
= rot(k,θ)
CS252A, Winter 2005
Computer Vision I
CS252A, Winter 2005
=
cos θ -sin θ
sin θ cos θ
0
0
0
0
0
0
1
0
p
x
rot(z,θ)
0
0
0
1
x
y
z
1
Computer Vision I
3
Rotation
• About
x axis:
• About
y axis:
x'
y'
z'
1
x'
y'
z'
1
Roll-Pitch-Yaw
=
0
0
1
0 cos θ -sin θ
0 sin θ cos θ
0
0
0
0
0
0
1
x
y
z
1
=
cos θ
0
-sin θ
0
0
1
1
0
0
0
0
1
x
y
z
1
sin θ
0
cos θ
0
CS252A, Winter 2005
R = rot (iˆ, α ) rot ( ˆj, β ) rot (kˆ, ϕ )
Euler Angles
R = rot ( kˆ' ' , α )rot ( ˆj ' , β )rot (kˆ, ϕ )
Computer Vision I
Rotation
• About (kx, ky, kz), a unit
vector on an arbitrary axis
(Rodrigues Formula)
y
CS252A, Winter 2005
Computer Vision I
Quaternions
Rotate(k, θ)
k
z
kxkx(1-c)+c kzkx(1-c)-kzs kxkz(1-c)+kys
x'
kykx(1-c)+kzs kzkx(1-c)+c kykz(1-c)-kxs
y'
=
kzkx(1-c)-kys kzkx(1-c)-kxs kzkz(1-c)+c
z'
0
0
0
1
Operations on quaternions:
• Sum of quaternions: ( a,α ) + ( b,β ) ≡ (( a+b ),(α+β )
x
0
0
0
1
x
y
z
1
• Multiplication by a scalar:
CS252A, Winter 2005
( a,α ) ( b,β ) ≡ (( a b – α ⋅ β ) , ( a β + b α + α × β ))
• Norm:
Computer Vision I
Unit Quaternions and Rotations
λ ( a,α ) ≡ ( λa,λα )
• Quaternion product:
q = (a,α)
• Conjugate:
where c = cos θ & s = sin θ
|q
|2
q’ ≡ (a, -α)
≡ q q’ = q’ q = a2 + | α |2
CS252A, Winter 2005
Computer Vision I
Block Matrix Multiplication
• Let R denote the rotation of angle θ about the unit vector u.
A
A =  11
 A21
• Define unit quaternion q = (cos θ/2, sin θ/2 u).
• Note |q| = 1 (i.e., q lies on unit sphere for any u and θ.
A12 
A22 
B
B =  11
 B21
B12 
B22 
What is AB ?
• Then for any vector α,
R α = imaginary(q α* q’)
where α*= (0, α)
•q and –q define the same rotation matrix.
 A B + A12 B21
AB =  11 11
 A21 B11 + A22 B21
If q = (a, ( b, c, d )T) is a unit quaternion, the corresponding
rotation matrix is:
CS252A, Winter 2005
q is a quaternion (generalization of
imaginary numbers)
a ∈ R is its real part
α ∈ R3 is its imaginary part.
q = (a,α)
θ
Computer Vision I
A11 B12 + A12 B22 
A21 B12 + A22 B22 
Homogeneous Representation of Rigid Transformations
 B P   AB R
 = T
 1  0
CS252A, Winter 2005
B
OA   A P   AB R AP + BOA  B  A P 
 = AT  
  = 
1  1  
1

1
Computer Vision I
4
Camera parameters
Camera Calibration
• Issue
– camera may not be at the origin, looking down the
z-axis
• extrinsic parameters
– one unit in camera coordinates may not be the
same as one unit in world coordinates
• intrinsic parameters - focal length, principal point,
aspect ratio, angle between axes, etc.
 X
 U   Transformation
  1 0 0 0  Transformation

Y
 V  =  representing
  0 1 0 0  representing

  


 Z
 W   intrinsic parameters  0 0 1 0  extrinsic parameters  
 T
3x3
, estimate intrinsic and extrinsic camera parameters
• See Text book for how to do it.
4x4
CS252A, Winter 2005
Computer Vision I
Beyond the pinhole Camera
Getting more light – Bigger Aperture
CS252A, Winter 2005
Computer Vision I
CS252A, Winter 2005
Pinhole Camera Images with Variable
Aperture
2 mm
1mm
.6 mm
.35 mm
.15 mm
.07 mm
CS252A, Winter 2005
Limits for pinhole cameras
CS252A, Winter 2005
Computer Vision I
Computer Vision I
The reason for lenses
Computer Vision I
CS252A, Winter 2005
Computer Vision I
5
Thin Lens
O
Thin Lens: Center
Optical axis
F
• Rotationally symmetric about optical axis.
• Spherical interfaces.
CS252A, Winter 2005
O
• All rays that enter lens along line pointing at
O emerge in same direction.
Computer Vision I
CS252A, Winter 2005
Thin Lens: Focus
Computer Vision I
Thin Lens: Image of Point
P
O
F
F
O
P’
All rays passing through lens and starting at P
converge upon P’
Parallel lines pass through the focus, F
CS252A, Winter 2005
Computer Vision I
CS252A, Winter 2005
Computer Vision I
Thin Lens: Image of Point
Thin Lens: Image Plane
Q’
F
P’
Z’
f
P
P
O
F
Z
P’
1 1 1
− =
z' z f
CS252A, Winter 2005
Computer Vision I
Image Plane
O
Q
A price: Whereas the image of P is in focus,
the image of Q isn’t.
CS252A, Winter 2005
Computer Vision I
6
Thin Lens: Aperture
Field of View
Image Plane
P
O
P’
Image Plane
f
O
Field of View
• Smaller Aperture
-> Less Blur
• Pinhole -> No Blur
CS252A, Winter 2005
Computer Vision I
CS252A, Winter 2005
Computer Vision I
Spherical aberration
Deviations from the lens model
Deviations from this ideal are aberrations
Two types
rays parallel to the axis do not converge
1. geometrical
outer portions of the lens yield smaller
focal lenghts
‰ spherical aberration
‰ astigmatism
‰ distortion
‰ coma
2. chromatic
Aberrations are reduced by combining lenses
CS252A, Winter 2005
Compound lenses
Computer Vision I
CS252A, Winter 2005
Distortion
Computer Vision I
Chromatic aberration
magnification/focal length different
for different angles of inclination
(great for prisms, bad for lenses)
pincushion
(tele-photo)
barrel
(wide-angle)
Can be corrected! (if parameters are know)
CS252A, Winter 2005
Computer Vision I
CS252A, Winter 2005
Computer Vision I
7
Vignetting
Chromatic aberration
rays of different wavelengths focused
in different planes
cannot be removed completely
sometimes achromatization is achieved for
more than 2 wavelengths
CS252A, Winter 2005
Computer Vision I
CS252A, Winter 2005
Computer Vision I
8