2/4/2021
CSE 473/573
‘-
Introduction to Computer Vision and Image Processing
1
Questions From Last Class?
• I will try to come on a few minutes early to answer questions each class. Simply Ask!
• Syllabus and Slides are online
‘-
2
1
2/4/2021
Creating an Image… Lets Drill Down…
Digital Camera
Image Processing Image Processing
‘-
SCENE
3
IMAGE FORMATION
‘-
4
2
2/4/2021
‘-
5
‘-
6
3
2/4/2021
What type of things can effect the image that gets formed?
• LightingConditions • SceneGeometry
• Surfac‘-eProperties • CameraProperties
7
‘-
8
4
2/4/2021
Reflections
• For a rough surface, light is reflected in all directions from any local point
• A light source is providing a lot of rays in parallel
‘-
9
Image formation
Let’s design a camera
– Idea 1: put a piece of film in front of an object – Do we get a reasonable image?
‘-
Slide source: Seitz
Answer is No….
10
5
2/4/2021
Part 1: Geometry of Image Formation
Mapping between image and world coordinates • Pinhole camera model (any photographers?)
• Projective geometry ‘-
‐ Vanishing points and lines • Projection matrix
• SLIDE CREDITS : Hays, Darrell
11
Pinhole camera
Idea 2: add a barrier to block off most of the rays • This reduces blurring
• The opening known as the aperture
‘-
Slide source: Seitz
12
6
2/4/2021
Pinhole camera
f
c
‘-
f = focal length
c = center of the camera
Figure from Forsyth
13
You can build one
• Cardboard box
• Cut two holes in one end • One on left
• One on right
• Put a white piece of paper
at the other end
• Cover the right hole with a piece of aluminum foil
• Poke a hole it with a pin
• Point the box at a light and look in the other hole
‘-
14
7
2/4/2021
‘-
15
Camera obscura: the pre-camera
• Known during classical period in China and Greece (e.g. Mo-Ti, China, 470BC to 390BC)
Illustration of Camera Obscura
‘-
Freestanding camera obscura at UNC Chapel Hill
Photo by Seth Ilys
16
8
2/4/2021
Camera Obscura used for Tracing
‘-
Lens Based Camera Obscura, 1568
17
First Photograph
Oldest surviving photograph • Took 8 hours on pewter plate
Joseph Niepce, 1826
Photograph of the first photograph
‘-
Stored at UT Austin
Niepce later teamed up with Daguerre, who eventually created Daguerrotypes
18
9
2/4/2021
Geometry of Image Formation
Mapping between image and world coordinates • Pinhole camera model (any photographers?)
• Projective geometry ‘-
‐ Vanishing points and lines • Projection matrix
• SLIDE CREDITS : Hays, Darrell
19
Vanishing points and lines
Parallel lines in the world intersect in the image at a “vanishing point”
‘-
20
10
2/4/2021
Vanishing points and lines
Vanishing Line
Vanishing Point
Vanishing Point oo
‘-
21
Vanishing points and lines
‘-
Vertical vanishing point
(at infinity)
Vanishing point
22
Vanishing point
Slide from Efros, Photo from Criminisi
11
2/4/2021
Exercise
• Can you identify other pairs of parallel lines in the image?
• Can you “estimate” the vanishing point of these parallel lines?
• Do they meet on the vanishing line that is defined by the two vanishing
points in the previous slide?
‘-
• What properties must the green lines in the previous slide have, so they will not meet along at the vanishing line?
23
What do we notice about perspective?
24
‘-
12
2/4/2021
Perspective effects
‘-
25
Projection properties
Many-to-one: any points along same ray map to same point in image
Points ? • points
Lines ? • lines
‘-
Distances and angles are / are not ? preserved • are not
Degenerate cases:
– Line through focal point projects to a point.
– Plane through focal point projects to line
– Plane perpendicular to image plane projects to part of the image.
26
13
2/4/2021
Length and area are not preserved
A’ C’
B’
Figure by David Forsyth
Here:
• C and B are approximately equal
• A is shorter then C
Here:
• A and C are approximately equal • A andCareshorterthenB‘-
27
Perspective and art
• Use of correct perspective projection indicated in 1st century B.C. frescoes
• Skill resurfaces in Renaissance: artists develop systematic methods to determine perspective
projection (around 1480-1515)
Raphael
‘-
Durer, 1525
28
K. Grauman
14
2/4/2021
Geometry of Image Formation
Mapping between image and world coordinates • Pinhole camera model (any photographers?)
• Projective geometry ‘-
‐ Vanishing points and lines • Projection matrix
• SLIDE CREDITS : Hays, Darrell
29
What measurements do we lose?
• Projection from 3D world to 2D Image
‘-
30
15
2/4/2021
What do we lose?
• Angles
• Distances
• and therefore Area
‘-
31
Observations
• If we want to reason about images, we have to be able to “convert” between 3D space 2D Images
• In Euclidean Space, Parallel Lines can not meet
‘-
• Homogeneous coordinates are a way of representing N-dimensional coordinates with N+1 numbers.
• 2D, or 3D, or ND it does not matter
• In Projective Space, Parallel Lines can meet
32
16
2/4/2021
Homogeneous coordinates
Converting to homogeneous coordinates ‘-
homogeneous image homogeneous scene coordinates coordinates
Converting from homogeneous coordinates
33
Exercise: Parallel Lines Never Meet
• Euclidean Space linear systems
‘-
• There is no Solution because C = D means they are the same line
• But what if x and y are points in projective (homogeneous) space? Is there a solution?
34
17
2/4/2021
Perspective projection & calibration
• Perspective equations so far in terms of camera’s reference frame….
• Camera’s intrinsic (Camera) and‘-extrinsic (World) parameters needed to calibrate geometry.
Camera frame
35
K. Grauman
Idealized (Pinhole) Assumptions
• Everything is a unit length
• Focal Length is 1 unit, pixels are 1 unit
• The camera and the world coordinate systems are aligned with the image plane. ‘-
• No Rotation or Translation
36
18
2/4/2021
Projection matrix
Slide Credit: Savarese
jw
kw Ow
37
WORLD COORDINATE SYSTEM
R,t
X
‘-
x iw
CAMERA COORDINATE SYSTEM
𝐱𝐊𝐑 𝐭 𝐗
x: Image Coordinates: (u,v,1) K: Intrinsic Matrix (3×3)
R: Rotation (3×3)
t: Translation (3×1)
X: World Coordinates: (X,Y,Z,1)
Intrinsic parameters: from world coordinates to pixel coordinates
p = (u,v)
Perspective projection
Forsyth&Ponce
focal length = f
P = (x,y,z)
‘-
𝑢 𝑓 𝑥𝑧 𝑣 𝑓 𝑦𝑧
38
W. Freeman
19
2/4/2021
Show Geometrically that we can co.mpute (u,v)𝑥 𝑋𝑦
𝑧
.f.
3 5y
‘-z
-2
.v ?
Center
u
𝑥 𝑢𝑣
Camera (0, 0, 0)
IfX=2,Y=3, Z = 5, and f = 2
What are u and v?
𝑣 𝑓
𝑦 𝑧
𝑢𝑥∗𝑓𝑧 𝑢2∗25 𝑣 𝑦 ∗ 𝑓 𝑣 3 ∗ 25
𝑧 39
Intrinsic parameters
𝑢 𝛼 𝑥𝑧 𝑣 𝛼 𝑦𝑧
‘-
Relax pixels of unit length:
The “pixels” are in some arbitrary spatial units
40
W. Freeman
20
2/4/2021
Intrinsic parameters
𝑢 𝛼 𝑥𝑧 𝑣 𝛽 𝑦𝑧
‘-
Relax pixels aspect: Pixels may not be square
𝛽 𝛼
41
W. Freeman
Intrinsic parameters
Relax image center is (0,0):
Origin of our camera pixel coordinates is offset
‘-
𝑢 𝛼 𝑥𝑧 𝑢 𝑣 𝛽 𝑦𝑧 𝑣
42
W. Freeman
21
Intrinsic parameters
2/4/2021
‘-𝑣𝑣 𝑣sin𝜃𝑣
𝑢 𝑢cos𝜃𝑣 𝑢cot𝜃𝑣
𝑢𝛼 𝑥𝛼cot𝜃𝑦𝑢 𝑧 𝑧
𝜃 𝑢 𝑢
Relaxtheimageplaneis orthogonal to the camera axis:
May be skew between camera pixel axes
𝑣
𝛽 𝑦 𝑣 sin 𝜃 𝑧
43
W. Freeman
Intrinsic parameters, homogeneous coordinates
𝑢 𝛼 𝑥𝑧 𝛼 c o t 𝜃 𝑦𝑧 𝑢
𝑣
𝛽 𝑦 𝑣 sin𝜃 𝑧
‘-
Using homogenous coordinates,
we can write this as:
or:
x
cot() u0 u
0 y
v0 v 0
sin() 0 z
10
0 0 1
1
44
W. Freeman
22
2/4/2021
Projection matrix
Extrinsic Assumptions • No rotation
• Camera at (0,0,0)
Intrinsic Assumptions • Unit aspect ratio
• Optical center at (0,0) • No skew
X
x
‘-
K
𝐱𝐊𝐈 𝟎 𝐗
u f 0 0 0x wv0 f 0 0y
1 0 0 1 0z 1
Slide Credit: Savarese
45
Projection matrix
Extrinsic Assumptions • No rotation
• Camera at (0,0,0)
Intrinsic Assumptions • Unit aspect ratio
• Optical center at (0,0) •Noskew
X
x
‘-
𝐱𝐊𝐈 𝟎 𝐗
u f 0 0 0x wv0 f 0 0y
1 0 0 1 0z 1
Slide Credit: Savarese
46
23
2/4/2021
Remove assumption: known optical center
Intrinsic Assumptions • Unit aspect ratio
• No skew
𝐱𝐊𝐈 𝟎 𝐗
Extrinsic Assumptions • No rotation
• Camera at (0,0,0)
‘-
u
0x 0y
f 0 u0 0 f v0 001
wv
1
0z 1
47
Remove assumption: square pixels
Intrinsic Assumptions • No skew
𝐱𝐊𝐈 𝟎 𝐗
Extrinsic Assumptions • No rotation
• Camera at (0,0,0)
‘-
u 0 u 0x 0 y
wv 0 v0 0z
1 0 0 1 0 1
48
24
2/4/2021
Remove assumption: non-skewed pixels
Intrinsic Assumptions
𝐱𝐊𝐈 𝟎 𝐗
Note: different books use different notation for parameters
Extrinsic Assumptions • No rotation
• Camera at (0,0,0)
‘-
u s u 0x 0 y
wv 0 v0 0z
1 0 0 1 0 1
49
Remove assumption: non-skewed pixels
Intrinsic Assumptions
𝐱𝐊𝐈 𝟎 𝐗
Note: different books use different notation for parameters
Extrinsic Assumptions • No rotation
• Camera at (0,0,0)
‘-
u s u 0x 0 y
wv 0 v0 0z
1 0 0 1 0 1
50
25