Top Banner
1 CS252A, Fall 2013 Computer Vision I Image Formation and Cameras Computer Vision I CSE 252A Lecture 4 CS252A, Fall 2013 Computer Vision I Announcements Kriegman office hours Tuesday 4:30-5:30 Everyone cleared from waitlist CS252A, Fall 2013 Computer Vision I Equation of Perspective Projection Cartesian coordinates: We have, by similar triangles, that (x’, y’, z’) = (f’ x/z, f’ y/z, f’) Establishing an image plane coordinate system at C’ aligned with i and j, image coordinates of the projection of P are ( x, y, z) ( f ' x z , f ' y z ) CS252A, Fall 2013 Computer Vision I Projective geometry provides an elegant means for handling these different situations in a unified way and homogenous coordinates are a way to represent entities (points & lines) in projective spaces. CS252A, Fall 2013 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 2013 Computer Vision I Conversion Euclidean -> Homogenous -> Euclidean Homogenous coordinates (Also called projective coordinates) In 2-D Euclidean Coordinates-> Homogenous Coordinates: (x, y) -> k (x,y,1) for some k 0 Homogenous -> Euclidean: (x, y, z) -> (x/z, y/z) In 3-D Euclidean -> Homogenous: (x, y, z) -> k (x,y,z,1) Homogenous -> Euclidean: (x, y, z, w) -> (x/w, y/w, z/w) X Y (x,y) (x,y,1) 1 Z
5

Equation of Perspective Projectioncseweb.ucsd.edu/classes/fa13/cse252A-a/lec4.pdf · • Parallel lines project to parallel lines • Ratios of distances are preserved under orthographic

Feb 29, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Equation of Perspective Projectioncseweb.ucsd.edu/classes/fa13/cse252A-a/lec4.pdf · • Parallel lines project to parallel lines • Ratios of distances are preserved under orthographic

1

CS252A, Fall 2013 Computer Vision I

Image Formation and Cameras

Computer Vision I CSE 252A Lecture 4

CS252A, Fall 2013 Computer Vision I

Announcements •  Kriegman office hours Tuesday 4:30-5:30 •  Everyone cleared from waitlist

CS252A, Fall 2013 Computer Vision I

Equation of Perspective Projection

Cartesian coordinates: •  We have, by similar triangles, that (x’, y’, z’) = (f’ x/z, f’ y/z, f’) •  Establishing an image plane coordinate system at C’ aligned with i

and j, image coordinates of the projection of P are

(x,y,z)→( f ' xz, f ' y

z)

CS252A, Fall 2013 Computer Vision I

Projective geometry provides an elegant means for handling these different situations in a unified way and homogenous coordinates are a way to represent entities (points & lines) in projective spaces.

CS252A, Fall 2013 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 2013 Computer Vision I

Conversion Euclidean -> Homogenous -> Euclidean

Homogenous coordinates (Also called projective coordinates) In 2-D •  Euclidean Coordinates-> Homogenous Coordinates:

(x, y) -> k (x,y,1) for some k ≠ 0

•  Homogenous -> Euclidean: (x, y, z) -> (x/z, y/z)

In 3-D •  Euclidean -> Homogenous:

(x, y, z) -> k (x,y,z,1)

•  Homogenous -> Euclidean: (x, y, z, w) -> (x/w, y/w, z/w)

X

Y (x,y)

(x,y,1)

1 Z

Page 2: Equation of Perspective Projectioncseweb.ucsd.edu/classes/fa13/cse252A-a/lec4.pdf · • Parallel lines project to parallel lines • Ratios of distances are preserved under orthographic

2

CS252A, Fall 2013 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 2013 Computer Vision I

Projective transformation •  Also called a homography •  This is a mapping from 2-D to 2-D in

homogenous coordinates •  3 x 3 linear transformation of homogenous

coordinates: u=Ax

•  Matrix A is only defined up a scale factor. •  Points map to points •  Lines map to lines

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

=

⎥⎥⎥

⎢⎢⎢

3

2

1

333231

232221

211211

3

2

1

xxx

aaaaaaaaa

uuu

CS252A, Fall 2013 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 is a 3x1 vector of homogenous coordinates

^ ^

^ ^

CS252A, Fall 2013 Computer Vision I

More applications: OCRs, scan,…

Homography Estimated from four points.

P1

P3

P4

P2

(0,0) (0,1)

(1,1) (1,0)

CS252A, Fall 2013 Computer Vision I

Application: Panoramas Coordinates between pairs of images are related by projective transformations

Transforms

CS252A, Fall 2013 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

Page 3: Equation of Perspective Projectioncseweb.ucsd.edu/classes/fa13/cse252A-a/lec4.pdf · • Parallel lines project to parallel lines • Ratios of distances are preserved under orthographic

3

CS252A, Fall 2013 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

CS252A, Fall 2013 Computer Vision I

Vanishing Point •  In the projective space, parallel lines meet

at a point at infinity. •  The vanishing point is the perspective

projection of that point at infinity, resulting from multiplication by the camera matrix.

CS252A, Fall 2013 Computer Vision I

Simplified Camera Models Perspective Projection

Scaled Orthographic Projection

Affine Camera Model

Orthographic Projection

Approximation

Particular case

CS252A, Fall 2013 Computer Vision I

Affine Camera Model

•  Take perspective projection equation, and perform Taylor series expansion about some point P= (x0, y0, z0).

•  Drop terms that are higher order than linear. •  Resulting expression is called the affine camera model

⎥⎥⎥

⎢⎢⎢

0

0

0

zyx

Appropriate in Neighborhood About (x0,y0,z0)

CS252A, Fall 2013 Computer Vision I

•  Perspective

•  Perform a Taylor series expansion about (x0, y0, z0)

⎥⎦

⎤⎢⎣

⎡=⎥

⎤⎢⎣

yx

zf

vu

uv

!

"#

$

%&=

fz0

x0y0

!

"##

$

%&&−fz02

x0y0

!

"##

$

%&&z− z0( )+ f

z010

!

"#

$

%& x − x0( )

+fz0

01

!

"#

$

%& y− y0( )+ f

22z03

x0y0

!

"##

$

%&&z− z0( )2 +

uv

!

"#

$

%& ≈

fz0

x0y0

!

"##

$

%&&+

f / z0 0 − fx0 / z02

0 f / z0 − fy0 / z02

!

"

###

$

%

&&&

xyz

!

"

###

$

%

&&&=Ap+b

•  Dropping higher order terms and regrouping.

CS252A, Fall 2013 Computer Vision I

Rewrite affine camera model in terms of Homogenous Coordinates

uvw

!

"

###

$

%

&&&≈

f / z0 0 − fx0 / z02 fx0 / z0

0 f / z0 − fy0 / z02 fy0 / z0

0 0 0 1

!

"

####

$

%

&&&&

xyz1

!

"

####

$

%

&&&&

Affine camera model in Euclidean Coordinates

uv

!

"#

$

%& ≈

fz0

x0y0

!

"##

$

%&&+

f / z0 0 − fx0 / z02

0 f / z0 − fy0 / z02

!

"

###

$

%

&&&

xyz

!

"

###

$

%

&&&=Ap+b

Page 4: Equation of Perspective Projectioncseweb.ucsd.edu/classes/fa13/cse252A-a/lec4.pdf · • Parallel lines project to parallel lines • Ratios of distances are preserved under orthographic

4

CS252A, Fall 2013 Computer Vision I

uv

!

"#

$

%&=

fz0

xy

!

"##

$

%&&

Scaled orthographic projection Starting with Affine Camera Model, take Taylor series about (xo, y0, z0) = (0, 0, z0) – a point on the optical axis

(0, 0, z0)

–  That is the z coordinate is dropped, and the image a scaling of the x and y coordinates, where the scale is 1/z0, the depth of the point of the expansion.

CS252A, Fall 2013 Computer Vision I

The projection matrix for scaled orthographic projection

UVW

!

"

###

$

%

&&&=

f / z0 0 0 00 f / z0 0 00 0 0 1

!

"

####

$

%

&&&&

XYZ1

!

"

####

$

%

&&&&

•  Parallel lines project to parallel lines •  Ratios of distances are preserved under orthographic projection

CS252A, Fall 2013 Computer Vision I

For all cameras?

CS252A, Fall 2013 Computer Vision I

Other camera models •  Generalized camera – maps points lying on rays

and maps them to points on the image plane.

Omnicam (hemispherical) Light Probe (spherical)

CS252A, Fall 2013 Computer Vision I

Some Alternative “Cameras”

CS252A, Fall 2012 Computer Vision I

Beyond the pinhole Camera

Page 5: Equation of Perspective Projectioncseweb.ucsd.edu/classes/fa13/cse252A-a/lec4.pdf · • Parallel lines project to parallel lines • Ratios of distances are preserved under orthographic

5

CS252A, Fall 2012 Computer Vision I

Beyond the pinhole Camera Getting more light – Bigger Aperture

CS252A, Fall 2012 Computer Vision I

Pinhole Camera Images with Variable Aperture

1mm

.35 mm

.07 mm

.6 mm

2 mm

.15 mm

CS252A, Fall 2012 Computer Vision I

Limits for pinhole cameras

CS252A, Fall 2012 Computer Vision I

The reason for lenses We need light, but big pinholes cause blur.

CS252A, Fall 2012 Computer Vision I

Thin Lens

O

•  Rotationally symmetric about optical axis. •  Spherical interfaces.

Optical axis