Projective Geometry Conversion Euclidean -> Homogenous...
Transcript of Projective Geometry Conversion Euclidean -> Homogenous...
1
CS252A, Fall 2017
Computer Vision I
Image Formation and Cameras
Computer Vision I CSE 252A Lecture 4
CS252A, Fall 2017
Computer Vision I
Announcements • HW0 is due on today • HW1 will be assigned tomorrow. • Read Chapters 1 & 2 of Forsyth & Ponce • Everyone is off waitlist • Welcome extension students – send email to
Bolun Zhang [email protected] • (Subset of?) Final exam can be use for CSE
MS Comprehensive Exam [Pending]
CS252A, Fall 2017
Computer Vision I
Projective Geometry • 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 = + Line at
Infinity CS252A, Fall 2017
Computer Vision I
Conversion Euclidean -> Homogenous -> Euclidean In 2-D • Euclidean -> Homogenous:
(x, y) -> λ(x,y,1)= (λx, λy, λ)
• Homogenous -> Euclidean: (x, y, w) -> (x/w, y/w)
In 3-D • Euclidean -> Homogenous:
(x, y, z) -> λ(x ,y, z, 1) • Homogenous -> Euclidean:
(x, y, z, w) -> (x/w, y/w, z/w)
X
Y (x,y)
(x,y,1)
1 W
CS252A, Fall 2017
Computer Vision I
The equation of projection: Euclidean & Homogenous Coordinates
Cartesian coordinates:
€
(x,y,z)→( f xz, f y
z)
€
UVW
⎛
⎝
⎜ ⎜ ⎜
⎞
⎠
⎟ ⎟ ⎟
=
1 0 0 00 1 0 00 0 1
f 0
⎛
⎝
⎜ ⎜ ⎜ ⎜
⎞
⎠
⎟ ⎟ ⎟ ⎟
XYZT
⎛
⎝
⎜ ⎜ ⎜ ⎜
⎞
⎠
⎟ ⎟ ⎟ ⎟
Homogenous Coordinates and Camera matrix
CS252A, Fall 2017
Computer Vision I
Affine Camera Model
• Take perspective projection equation, and perform Taylor series expansion about some point (x0,y0,z0).
• Drop terms that are higher order than linear. • Resulting expression is affine camera model
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
0
0
0
zyx
Appropriate in Neighborhood About (x0,y0,z0)
2
CS252A, Fall 2017
Computer Vision I
Simplified Camera Models Perspective Projection
Scaled Orthographic Projection
Affine Camera Model
Orthographic Projection
Approximation: Taylor Series Expansion about (X0, Y0, Z0)
Case of affine where X0= Y0 = 0
Case of scaled orthograhic where f/Z0 = 1
CS252A, Fall 2017
Computer Vision I
Projective Transformation Mapping from Plane to Plane
• 3 x 3 linear transformation of homogenous coordinates
• Points map to points • Lines map to lines
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
=
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
3
2
1
333231
232221
211211
3
2
1
xxx
aaaaaaaaa
uuu
X U
CS252A, Fall 2017
Computer Vision I
^
Figure borrowed from Hartley and Zisserman “Multiple View Geometry in computer vision”
Mapping from a Plane to a Plane under Perspective is given by a projective transform H
x’ = Hx H is a 3x3 matrix, x, x’ are 3x1 vectors of homogenous coordinates
ij
Oπ
CS252A, Fall 2017
Computer Vision I
The equation of projection
Cartesian coordinates:
€
(x,y,z)→( f xz, f y
z)
UVW
⎛
⎝
⎜⎜⎜
⎞
⎠
⎟⎟⎟=
1 0 0 00 1 0 00 0 1
f 0
⎛
⎝
⎜⎜⎜⎜
⎞
⎠
⎟⎟⎟⎟
XYZT
⎛
⎝
⎜⎜⎜⎜
⎞
⎠
⎟⎟⎟⎟
Homogenous Coordinates and Camera matrix
CS252A, Fall 2017
Computer Vision I
^
Oπ
x = xi + yj +Oπ
3D point coordinates on plane π
As a matrix equation
X = i j Oπ⎡⎣⎢
⎤⎦⎥
xy1
⎡
⎣
⎢⎢⎢
⎤
⎦
⎥⎥⎥
In homogenous coordinates
x 'y 'w '
⎡
⎣
⎢⎢⎢
⎤
⎦
⎥⎥⎥=
1 0 0 00 1 0 00 0 1
f 0
⎡
⎣
⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥
i0
j0
Oπ
1
⎡
⎣
⎢⎢
⎤
⎦
⎥⎥
xy1
⎡
⎣
⎢⎢⎢
⎤
⎦
⎥⎥⎥= H
xy1
⎡
⎣
⎢⎢⎢
⎤
⎦
⎥⎥⎥
And taking perspective projection onto π’
ijX = i
0j0
Oπ
1
⎡
⎣
⎢⎢
⎤
⎦
⎥⎥
xy1
⎡
⎣
⎢⎢⎢
⎤
⎦
⎥⎥⎥
x’ = Hx
4x3
CS252A, Fall 2017
Computer Vision I
Application of Homography: OCRs, scan,…
Homography: Can be estimated from four points.
P1
P3
P4
P2
(0,0) (0,1)
(1,1) (1,0)
3
CS252A, Fall 2017
Computer Vision I Figure borrowed from Hartley and Zisserman “Multiple View Geometry in computer vision”
Planar Homography
x =H1X X’ =H2X
x’ = H2X = H2(H1-1
x) = (H2H1-1)x
Application: Two photos of a white board CS252A, Fall 2017
Computer Vision I Figure borrowed from Hartley and Zisserman “Multiple View Geometry in computer vision”
Planar Homography: Pure Rotation
x’ = H2X = H2(H1-1
x) = (H2H1-1)x
Application: Panoramas
CS252A, Fall 2017
Computer Vision I
Application: Panoramas and image stitching
All images are warped to central image CS252A, Fall 2017
Computer Vision I
Lenses
CS252A, Fall 2010 Computer Vision I
Beyond the pinhole Camera Getting more light – Bigger Aperture
CS252A, Fall 2010 Computer Vision I
Pinhole Camera Images with Variable Aperture
1mm
.35 mm
.07 mm
.6 mm
2 mm
.15 mm
4
CS252A, Fall 2010 Computer Vision I
Limits for pinhole cameras
CS252A, Fall 2010 Computer Vision I
The reason for lenses
CS252A, Fall 2010 Computer Vision I
Thin Lens
O
• Rotationally symmetric about optical axis. • Spherical interfaces.
Optical axis
CS252A, Fall 2010 Computer Vision I
Thin Lens: Center
O
• All rays that enter lens along line pointing at O emerge in same direction.
F
CS252A, Fall 2010 Computer Vision I
Thin Lens: Focus
O
Parallel lines pass through the Focal Point, F
F
CS252A, Fall 2010 Computer Vision I
Thin Lens: Image of Point
O
All rays passing through lens and starting at P converge upon P’
F
P
P’
5
CS252A, Fall 2010 Computer Vision I
Thin Lens: Image of Point
O F
P
P’ z’
f
z
1z '−1z=1f
Where z, z’, and f are the z-coordinates of P, P, and F. i.e., z is negative.
j k
i
CS252A, Fall 2010 Computer Vision I
Thin Lens: Image Plane
O F
P
P’
Image Plane
Q’
Q
A price: Whereas the image of P is in focus, the image of Q isn’t.
CS252A, Fall 2010 Computer Vision I
Thin Lens: Aperture
O
P
P’
Image Plane • Smaller Aperture -> Less Blur • Pinhole -> No Blur
CS252A, Fall 2010 Computer Vision I
Field of View
O Field of View
Image Plane
f
– Telephoto lens: small field of view (large f) – Wide angle lens: large field of view(small f) – Zoom lens: variable f using compound lens
CS252A, Fall 2010 Computer Vision I
Deviations from the lens model Deviations from this ideal are aberrations Two types
2. chromatic
1. geometrical ❑ spherical aberration ❑ astigmatism ❑ distortion ❑ coma
Aberrations are reduced by combining lenses
Compound lenses CS252A, Fall 2010 Computer Vision I
Spherical aberration
Rays parallel to the axis do not converge Outer portions of the lens yield smaller focal lengths
6
CS252A, Fall 2010 Computer Vision I
Astigmatism An optical system with astigmatism is one where rays that propagate in
two perpendicular planes have different foci. If an optical system with astigmatism is used to form an image of a cross, the vertical and horizontal lines will be in sharp focus at two different distances.
object
CS252A, Fall 2010 Computer Vision I
Distortion magnification/focal length different for different angles of inclination
Can be corrected! (if parameters are know)
pincushion (tele-photo)
barrel (wide-angle)
CS252A, Fall 2010 Computer Vision I
Chromatic aberration
sinθ1sinθ2
=n2n1=λ1λ2
ni is the index of refraction λi is the wavelength of light in the medium
Snells Law
CS252A, Fall 2010 Computer Vision I
Chromatic aberration
rays of different wavelengths focused in different planes cannot be removed completely sometimes achromatization is achieved for more than 2 wavelengths
Vignetting: Spatial Non-Uniformity
camera Iris
Litvinov & Schechner, radiometric nonidealities CS252A, Fall 2010 Computer Vision I
– Only part of the light reaches the sensor – Periphery of the image is dimmer
Vignetting