CS计算机代考程序代写 Lecture 1: Images and image filtering

Lecture 1: Images and image filtering

Projection

Slide set by Noah Snavely

Projection

Müller-Lyer Illusion
http://www.michaelbach.de/ot/sze_muelue/index.html

Modeling projection
The coordinate system
We will use the pinhole model as an approximation
Put the optical center (Center Of Projection) at the origin
Put the image plane (Projection Plane) in front of the COP
The camera looks down the negative z axis
we like this if we want right-handed-coordinates

4
This way the image is right-side-up

Modeling projection
Projection equations
Compute intersection with PP of ray from (x,y,z) to COP
Derived using similar triangles

We get the projection by throwing out the last coordinate:

Modeling projection
Is this a linear transformation?

Homogeneous coordinates to the rescue—again!
homogeneous image
coordinates
homogeneous scene
coordinates
Converting from homogeneous coordinates

no—division by z is nonlinear

Perspective Projection
Projection is a matrix multiply using homogeneous coordinates:
divide by third coordinate

This is known as perspective projection
The matrix is the projection matrix

(Can also represent as a 4×4 matrix – OpenGL does something like this)

Perspective Projection
How does scaling the projection matrix change the transformation?

Orthographic projection
Special case of perspective projection
Distance from the COP to the PP is infinite

Good approximation for telephoto optics
Also called “parallel projection”: (x, y, z) → (x, y)
What’s the projection matrix?

Image
World

Orthographic projection

Perspective projection

Variants of orthographic projection
Scaled orthographic
Also called “weak perspective”

Affine projection
Also called “paraperspective”

Figures © Stephen E. Palmer, 2002
Dimensionality Reduction Machine (3D to 2D)
3D world
2D image
What have we lost?
Angles
Distances (lengths)
Slide by A. Efros

13

Projection properties
Many-to-one: any points along same ray map to same point in image
Points → points
Lines → lines (collinearity is preserved)
But line through focal point projects to a point
Planes → planes (or half-planes)
But plane through focal point projects to line

14

Projection properties
Parallel lines converge at a vanishing point
Each direction in space has its own vanishing point
But parallels parallel to the image plane remain parallel

15

Camera parameters
How can we model the geometry of a camera?

“The World”
Camera
x
y
z

v
w
u

o

COP
Two important coordinate systems:
1. World coordinate system
2. Camera coordinate system

(x, y, z)
How do we project a given point (x, y, z) in world coordinates?

16

Camera parameters
To project a point (x,y,z) in world coordinates into a camera
First transform (x,y,z) into camera coordinates
Need to know
Camera position (in world coordinates)
Camera orientation (in world coordinates)
Then project into the image plane to get a pixel coordinate
Need to know camera intrinsics

Projection equation

The projection matrix models the cumulative effect of all parameters
Useful to decompose into a series of operations

projection
intrinsics
rotation
translation
identity matrix

Camera parameters
A camera is described by several parameters
Translation T of the optical center from the origin of world coords
Rotation R of the image plane
focal length f, principal point (x’c, y’c), pixel size (sx, sy)
blue parameters are called “extrinsics,” red are “intrinsics”
The definitions of these parameters are not completely standardized
especially intrinsics—varies from one book to another

18

Projection matrix

0

=

(in homogeneous image coordinates)

Extrinsics
How do we get the camera to “canonical form”?
(Center of projection at the origin, x-axis points right, y-axis points up, z-axis points backwards)

0
Step 1: Translate by -c

Extrinsics
How do we get the camera to “canonical form”?
(Center of projection at the origin, x-axis points right, y-axis points up, z-axis points backwards)

0
Step 1: Translate by -c

How do we represent translation as a matrix multiplication?

Extrinsics
How do we get the camera to “canonical form”?
(Center of projection at the origin, x-axis points right, y-axis points up, z-axis points backwards)

0
Step 1: Translate by -c
Step 2: Rotate by R

3×3 rotation matrix

Extrinsics
How do we get the camera to “canonical form”?
(Center of projection at the origin, x-axis points right, y-axis points up, z-axis points backwards)

0

Step 1: Translate by -c
Step 2: Rotate by R

(with extra row/column of [0 0 0 1])

Perspective projection

(intrinsics)

in general,

: aspect ratio (1 unless pixels are not square)
: skew (0 unless pixels are shaped like rhombi/parallelograms)
: principal point ((0,0) unless optical axis doesn’t intersect projection plane at origin)
(upper triangular matrix)
(converts from 3D rays in camera coordinate system to pixel coordinates)

Projection matrix

translation
rotation
projection
intrinsics

This part converts 3D points in world coordinates to 3D rays in the camera’s coordinate system. There are 6 parameters represented (3 for position/translation, 3 for rotation).
The K matrix converts 3D rays in the camera’s coordinate system to 2D image points in image (pixel) coordinates.

Projection matrix

(t in book’s notation)

translation
rotation
projection
intrinsics

Projection matrix

0

=

(in homogeneous image coordinates)

Perspective distortion
Problem for architectural photography: converging verticals

Source: F. Durand

28

Perspective distortion
Problem for architectural photography: converging verticals

Solution: view camera (lens shifted w.r.t. film)
Source: F. Durand
Tilting the camera upwards results in converging verticals
Keeping the camera level, with an ordinary lens, captures only the bottom portion of the building

Shifting the lens upwards results in a picture of the entire subject
http://en.wikipedia.org/wiki/Perspective_correction_lens

29

Perspective distortion
Problem for architectural photography: converging verticals
Result:

Source: F. Durand

30

Perspective distortion
What does a sphere project to?

Image source: F. Durand

31

Perspective distortion
The exterior columns appear bigger
The distortion is not due to lens flaws
Problem pointed out by Da Vinci

Slide by F. Durand

32

Perspective distortion: People

33

Distortion
Radial distortion of the image
Caused by imperfect lenses
Deviations are most noticeable for rays that pass through the edge of the lens

No distortion
Pin cushion
Barrel

Correcting radial distortion

from Helmut Dersch

Distortion

Modeling distortion
To model lens distortion
Use above projection operation instead of standard projection matrix multiplication

Apply radial distortion

Apply focal length
translate image center

Project
to “normalized”
image coordinates

Required reading

Point of observation

ΠX
x
=
ú
ú
ú
ú
û
ù
ê
ê
ê
ê
ë
é
ú
ú
ú
û
ù
ê
ê
ê
ë
é
=
ú
ú
ú
û
ù
ê
ê
ê
ë
é
=
1
*
*
*
*
*
*
*
*
*
*
*
*
Z
Y
X
s
sy
sx

ú
ú
û
ù
ê
ê
ë
é
ú
ú
û
ù
ê
ê
ë
é
ú
ú
ú
û
ù
ê
ê
ê
ë
é
ú
ú
ú
û
ù
ê
ê
ê
ë
é


=
1
1
0
1
0
0
0
0
1
0
0
0
0
1
1
0
0

0

0
3
1
1
3
3
3
3
1
1
3
3
3
x
x
x
x
x
x
c
y
c
x
y
fs
x
fs
0
0
0
T
I
R
Π

/docProps/thumbnail.jpeg