lecture4 single view metrology-2 - silvio savarese · lecture 4 single view metrology calibration...

18
Lecture 4 - Silvio Savarese 16-Jan-15 Professor Silvio Savarese Computational Vision and Geometry Lab Lecture 4 Single View Metrology Lecture 4 - Silvio Savarese 16-Jan-15 • Review calibration and 2D transformations • Vanishing points and lines • Estimating geometry from a single image • Extensions Reading: [HZ] Chapter 2 “Projective Geometry and Transformation in 2D” [HZ] Chapter 3 “Projective Geometry and Transformation in 3D” [HZ] Chapter 8 “More Single View Geometry” [Hoeim & Savarese] Chapter 2 Lecture 4 Single View Metrology Calibration Problem j C i i P M P ! " # $ % & = i i i v u p In pixels [ ] T R K M = ! ! ! " # $ $ $ % & = 1 0 0 0 cot sin o o v u K θ β θ α α World ref. system The calibration problem was discussed in details during lecture 3.

Upload: others

Post on 21-Aug-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: lecture4 single view metrology-2 - Silvio Savarese · Lecture 4 Single View Metrology Calibration Problem j C P i →MP i! " # $ % & →= i i iv u p In pixels M=K[RT]!!! " # $ $ $

Lecture 4 - Silvio Savarese 16-Jan-15

Professor Silvio Savarese Computational Vision and Geometry

Lab

Lecture 4 Single View Metrology

Lecture 4 - Silvio Savarese 16-Jan-15

• Review calibration and 2D transformations • Vanishing points and lines • Estimating geometry from a single image • Extensions

Reading: [HZ] Chapter 2 “Projective Geometry and Transformation in 2D” [HZ] Chapter 3 “Projective Geometry and Transformation in 3D” [HZ] Chapter 8 “More Single View Geometry” [Hoeim & Savarese] Chapter 2

Lecture 4 Single View Metrology

Calibration Problem

jC

ii PMP → !"

#$%

&=→

i

ii v

up

In pixels

[ ]TRKM =

!!!

"

#

$$$

%

& −

=

100

0

cot

sin o

o

v

u

β

θαα

World ref. system

The calibration problem was discussed in details during lecture 3.

Page 2: lecture4 single view metrology-2 - Silvio Savarese · Lecture 4 Single View Metrology Calibration Problem j C P i →MP i! " # $ % & →= i i iv u p In pixels M=K[RT]!!! " # $ $ $

Calibration Problem

jC

ii PMP → !"

#$%

&=→

i

ii v

up

Need at least 6 correspondences11 unknown

[ ]TRKM =

In pixelsWorld ref. system

Pinhole perspective projectionOnce the camera is calibrated...

[ ]TRKM =

COw

-Internal parameters K are known-R, T are known – but these can only relate C to the calibration rig

Pp

Can I estimate P from the measurement p from a single image?

No - in general ☹ (P can be anywhere along the line defined by C and p)

Line of sight

Once the camera is calibrated (intrinsics are known) and the transformation from the world reference system to the camera reference system (which accounts for the extrinsics) is also known, can we estimate the location of a point P in 3D from its observation p? The general answer to this question is no. This is because, given the observation p, even when the camera intrinsics and extrinsic are known, the only thing we can say is that the point P is located somewhere along the line defined by C and p. This line is called the line of sight.

C

p

Line of sight

Pinhole perspective projectionRecovering structure from a single view

Ow

P

unknown known Known/Partially known/unknown

The actual location of P along this line is unknown and cannot be determined from the observation p alone.

Page 3: lecture4 single view metrology-2 - Silvio Savarese · Lecture 4 Single View Metrology Calibration Problem j C P i →MP i! " # $ % & →= i i iv u p In pixels M=K[RT]!!! " # $ $ $

http://www.robots.ox.ac.uk/~vgg/projects/SingleView/models/hut/hutme.wrl

Recovering structure from a single view In the remainder of this lecture, we will introduce tools and techniques for inferring the geometry of the camera and the 3D environment from a just one image of such environment.

Transformation in 2D

-Isometries

-Similarities

-Affinity

-Projective

Before we go into the details of that, let me recap some of the concepts you have already explored when we talked about transformations.There are four important transformations in 2D. All these transformations will be described in homogenous coordinates.

Transformation in 2D

Isometries:!!!

"

#

$$$

%

&

=

!!!

"

#

$$$

%

&

!"

#$%

&=

!!!

"

#

$$$

%

&

1yx

H1yx

10tR

1'y'x

e

- Preserve distance (areas)- 3 DOF- Regulate motion of rigid object

[Euclideans]

[Eq. 4]

The first one is called isometric transformation which is in general the concatenation of a rotation and translation transformation and expressed by the matrix H

e and Eq. 4. This transformation preserves the distance

between any pair of points and has 3 degrees of freedom (2 for translation, 1 for rotation). This group captures the motion of a rigid object.

Page 4: lecture4 single view metrology-2 - Silvio Savarese · Lecture 4 Single View Metrology Calibration Problem j C P i →MP i! " # $ % & →= i i iv u p In pixels M=K[RT]!!! " # $ $ $

Transformation in 2D

Similarities:x 'y'1

!

"

###

$

%

&&&=

SR t0 1

!

"##

$

%&&

xy1

!

"

###

$

%

&&&= Hs

xy1

!

"

###

$

%

&&&

- Preserve- ratio of lengths- angles

-4 DOF

[Eq. 5]S= s 0

0 s!

"#

$

%&

The second group of transformations is called similarity transformation. The transformation is a concatenation of a translation, rotation and scale translation transformations. It preserves the ratio of lengths between any two line segments before and after transformation. It also preserves the angle between any intersecting lines. The group has 4 degrees of freedom (2 translation, 1 rotation, 1 scale)

Transformation in 2D

Affinities:!!!

"

#

$$$

%

&

=

!!!

"

#

$$$

%

&

!"

#$%

&=

!!!

"

#

$$$

%

&

1yx

H1yx

10tA

1'y'x

a

!"

#$%

&=

2221

1211

aaaa

A )(RD)(R)(R φφθ ⋅⋅−⋅= !"

#$%

&=

y

x

s00s

D

[Eq. 6]

[Eq. 7]

The third transformation group is the affine transformation. This group can be interpreted as a series of translation, rotation and anisotropic scaling transformations. The core of the affine transformation is characterized by the matrix A which includes a rotation by phi, an anisotropic scaling by [sx 0; 0 sy], an inverse rotation by –phi and an arbitrary rotation by theta (see Eq. 7). This transformation has also a mathematical interpretation: Any positive definite 2x2 matrix can be decomposed into two orthogonal matrices and a diagonal matrix by Singular Value Decomposition (this is by assuming positive scaling; for negative scaling, the transformation may not be unique.) Thus we can express A = UDV

T = (UV

T) (VDV

T) = R(theta)

R(-phi) D R(phi) by replacing UV

T = R(theta), V = R(phi)

T, and where D is a diagonal

matrix with the singular values. Note that transpose of a rotation matrix is the inverse of the rotation matrix. Thus, an arbitrary 2x2 matrix can be decomposed into R(theta), R(phi), D.

Transformation in 2D

Affinities:!!!

"

#

$$$

%

&

=

!!!

"

#

$$$

%

&

!"

#$%

&=

!!!

"

#

$$$

%

&

1yx

H1yx

10tA

1'y'x

a

!"

#$%

&=

2221

1211

aaaa

A )(RD)(R)(R φφθ ⋅⋅−⋅= !"

#$%

&=

y

x

s00s

D

-Preserve:- Parallel lines- Ratio of areas- Ratio of lengths on collinear lines- others…

- 6 DOF

[Eq. 6]

[Eq. 7]

This transformation group preserves parallel lines (parallel lines are still parallel after transformation). The ratio of lengths on collinear lines is preserved after transformation and thus it follows that the ratio of areas within any arbitrary shapes is preserved.

The transformation has 6 degree of freedom ( 4 elements in the matrix A, 2 for translation ).

Page 5: lecture4 single view metrology-2 - Silvio Savarese · Lecture 4 Single View Metrology Calibration Problem j C P i →MP i! " # $ % & →= i i iv u p In pixels M=K[RT]!!! " # $ $ $

Transformation in 2D

Projective:!!!

"

#

$$$

%

&

=

!!!

"

#

$$$

%

&

!"

#$%

&=

!!!

"

#

$$$

%

&

1yx

H1yx

bvtA

1'y'x

p

- 8 DOF- Preserve:

- cross ratio of 4 collinear points- collinearity - and a few others…

[Eq. 8]

Finally, the fourth transformation is the projective transformation which is a generalization of the affine transformation where two additional elements (the 1x2 vector v) are non-zero. This transformation has 8 degrees of freedom and preserves the cross ratio of 4 collinear points.

The cross ratio

1423

2413

PPPPPPPP

−−

−−

The cross-ratio of 4 collinear points

Can permute the point ordering

!!!!

"

#

$$$$

%

&

=

1i

i

i

i ZYX

P

3421

2431

PPPPPPPP

−−

−−

P1P2

P3P4

[Eq. 9]

An example of cross ratio is defined in Eq.9 for the points P1,P

2,P

3,P

4.

Lecture 4 - Silvio Savarese 16-Jan-15

• Review calibration and 2D transformations • Vanishing points and lines • Estimating geometry from a single image • Extensions

Reading: [HZ] Chapter 2 “Projective Geometry and Transformation in 2D” [HZ] Chapter 3 “Projective Geometry and Transformation in 3D” [HZ] Chapter 8 “More Single View Geometry” [Hoeim & Savarese] Chapter 2

Lecture 4 Single View Metrology

In the next slides we introduce a number of important definitions about lines and points in 2D and 3D and introduce the concepts of vanishing points and lines.

Page 6: lecture4 single view metrology-2 - Silvio Savarese · Lecture 4 Single View Metrology Calibration Problem j C P i →MP i! " # $ % & →= i i iv u p In pixels M=K[RT]!!! " # $ $ $

Lines in a 2D plane

0cbyax =++

-c/b

-a/b

!!!

"

#

$$$

%

&

=

cba

l

If x = [ x1, x2]T ∈ l 0cba

1xx T

2

1

=

!!!

"

#

$$$

%

&

!!!

"

#

$$$

%

&

l

x

y

[Eq. 10]

A line in 2D can be represented as the 3D vector l=[a b c]T in

homogeneous coordinates; The ratio -a/b captures the slope of the line and the ratio -c/b defines the point of intersection of the line with the y axis. If a point x belongs to a line l, than the dot product between x and l is equal to zero (Eq 10). This equations also defines a line in 2D.

Lines in a 2D plane

Intersecting lines

llx !×= l

l!

Proof

lll ⊥"×lll !⊥!×

0l)ll( =⋅"×→0l)ll( =!⋅!×→

lx∈→

x

lx !∈→

→ x is the intersecting point

x

y

x

[Eq. 12][Eq. 13]

[Eq. 11]

In general, two lines l and l’ intersect at a point x. This point is defined as the the cross product between l and l’ [Eq. 11]. This is easy to verify as the slide shows.

Proof: Given two intersecting lines l and l’, the intersection point x should lie on both lines l and line l’; thus the point x is the intersection if and only if x

T l = 0 [Eq.11] and x

T l’ = 0 [Eq.12]. Let x be l x l’. Then, the vector x is

perpendicular to the vector l and the vector l’ and, thus, it satisfies the above constraints. Since the intersection is unique (set arbitrary x’ =\= x and show that x’ is x), l x l’ is the point of intersection of the two lines.

2D Points at infinity (ideal points)

0x,xxx

x 3

3

2

1

"""

#

$

%%%

&

'

=!!!

"

#

$$$

%

&

=

cba

l

!!!

"

#

$$$

%

&

'

='

cba

l ''

!!!

"

#

$$$

%

&

−∝)×→

0ab

llLet’s intersect two parallel lines:

• In Euclidian coordinates this point is at infinity• Agree with the general idea of two lines intersecting at infinity

l

l!!!!

"

#

$$$

%

&

=∞

0''

2

1

xx

x

'/'/ baba −=−

∞= x Eq.13]

Let now us compute the point of intersection of two parallel lines. We start by observing that a point at infinity in Euclidean coordinates corresponds to a point x

inf in homogenous coordinates whose third

coordinate is equal to zero. Let us now consider two parallel lines l and l’. When two lines are parallel, their slope is equal and thus –a/b=-a’/b’. Let’s now compute the point of intersection of these two lines. Using Eq. 11 we obtain Eq. 13 which is exactly the expression of a point at infinity (in homogenous coordinates). This confirms the intuition that two parallel lines intersect at infinity.

The point of intersection of two parallel lines returns a point at infinity which is also called ideal point.

Page 7: lecture4 single view metrology-2 - Silvio Savarese · Lecture 4 Single View Metrology Calibration Problem j C P i →MP i! " # $ % & →= i i iv u p In pixels M=K[RT]!!! " # $ $ $

2D Points at infinity (ideal points)

0x,xxx

x 3

3

2

1

"""

#

$

%%%

&

'

=!!!

"

#

$$$

%

&

=

cba

l

!!!

"

#

$$$

%

&

'

='

cba

l ''

[ ] 00

lT =

!!!

"

#

$$$

%

&

−=∞ ab

cbax

Note: the line l = [a b c]T pass trough the ideal point

So does the line l’ since a b’ = a’ b

l

l!

'/'/ baba −=−

∞x

[Eq. 15]

One interesting property of a point at infinity is that all the parallel lines with the same slope -a/b passes through the point [b -a 0] [Eq.15].

Lines infinity ∞lSet of ideal points lies on a line called the line at infinity.How does it look like?

∞l

!!!

"

#

$$$

%

&

=∞

100

l

T

2

1

0xx

!!!

"

#

$$$

%

&

0100=

!!!

"

#

$$$

%

&Indeed:

A line at infinity can be thought of the set of “directions” of lines in the plane

'∞x

!!!

"

#

$$$

%

&

−=

0''ab

!!!

"

#

$$$

%

&

−=

0''''ab

''∞x

We can further extend this concept and define the lines at infinity.

Consider 2 or more pairs of parallel lines (right side of the slide). Each pair of parallel lines intersect into a point at infinity. Let us call these set of points xinf’, xinf’’, …. The line that passes through all these points at infinity must satisfy l

T xinf’ =0, l

T xinf’’ =0, etc… and is simply l = [0 0 c]

T. Since c in

an arbitrary value, we can simply write l=[0,0,1]T.

A line at infinity can be thought of the set of “directions” of lines in the plane

Projective transformation of a point at infinity

pHp ='

!"

#$%

&=

bvtA

H

?=∞pH!!!

"

#

$$$

%

&

=

!!!

"

#

$$$

%

&

!"

#$%

&=

z

y

x

ppp

bvtA

'''

011

is it a point at infinity?

…no!

?=∞pHA!!!

"

#

$$$

%

&

=

!!!

"

#

$$$

%

&

!"

#$%

&=

0''

011

0 y

x

pp

btA

An affine transformation of a point at infinity is still a point at infinity

[Eq. 17]

[Eq. 18]

Now, let’s see what happens if we apply a generic projective transformation H to a point at infinity p

inf (Eq. 17).

Notice that the last element H pinf

becomes non-zero which suggests that

a projective transformation in general maps points at infinity to points that are no longer at infinity.

This is not true for affine transformations [Eq.18]. If we apply an affine transformation H

A to p

inf will still obtain a point at infinity.

Page 8: lecture4 single view metrology-2 - Silvio Savarese · Lecture 4 Single View Metrology Calibration Problem j C P i →MP i! " # $ % & →= i i iv u p In pixels M=K[RT]!!! " # $ $ $

Projective transformation of a line (in 2D)

lHl T−="

!"

#$%

&=

bvtA

H

?lH T =∞−

!!!

"

#

$$$

%

&

=

!!!

"

#

$$$

%

&

!"

#$%

&=

btt

100

bvtA

y

xT

is it a line at infinity?

…no!

?lH TA =∞−

!!!

"

#

$$$

%

&

=

!!!

"

#

$$$

%

&

!"

#$%

&

−=

!!!

"

#

$$$

%

&

!"

#$%

&=

−−

100

100

10

100

10 TT

TT

AtAtA

[Eq. 19]

[Eq. 20]

[Eq. 21]

This time, let’s apply a projective transformation H to a line. The projective transformation of a line l is l’ = H

-T l (Eq 19).

Let’s derive this equation. All points that pass through a line l must satisfy the line equation: x

Tl = 0; —> x

T H

T H

-T l = 0

Since x’ = H x (and x’T

= xT

HT), then x’

T H

-T l = 0; Because, after the

transformation, a projected point x’ must still belong to the projected line l’ (x’

T l’ = 0), it implies that l’ = H

-T l.

Let’s now apply the projective transformation H to a line at infinity linf

. Is

the projected line still at infinity? No.

Let’s now apply the affine transformation HA to a line at infinity l

inf. Is the

projected line still at infinity? Yes, as the derivation next to Eq 21 shows.

Points and planes in 3D

!!!!

"

#

$$$$

%

&

=

1xxx

x3

2

1

!!!!

"

#

$$$$

%

&

dcba

0dczbyax =+++

x

y

z

x∈ Π↔ xTΠ = 0

How about lines in 3D? • Lines have 4 degrees of freedom - hard to represent in 3D-space• Can be defined as intersection of 2 planes

[Eq. 23][Eq. 22]

So far we have introduced the concepts of lines and points at infinity in 2D. Let’s introduce the equivalent concepts in 3D (and in the corresponding homogenous coordinates). Points in 3D (homogenous coordinates) are denoted as x and their corresponding projective transformations in the 2D image are denoted as p.

Following the 2D case, we can represent a plane as a normal vector (a,b,c) and a distance from the origin (d) which is [Eq.22]. Thus, a point is on a plane if and only if [Eq.23] holds.

In 3D, it is tricky to represent a line but one can represent it using an intersection of 2 planes. See [HZ] Ch.3.2.2 for detail.

Philosophical interlude by C. Choy (course assistant): When you see an object, you are not perceiving 3D space (there is no way to ‘sense’ space directly), you are merely seeing the 2D perspective projection of the object on your retina. Thus seeing is equivalent to perspective projection. So it is essential to model the world as is in 3D space and perspective projection as we do.

Points at infinity in 3DPoints where parallel lines intersect in 3D

!!!!

"

#

$$$$

%

&

=∞

03

2

1

xxx

xworld

Parallel lines

point at infinity

In 3D, similarly to ideals points in 2D, points at infinity are defined as the point of intersection of parallel lines in 3D.

Page 9: lecture4 single view metrology-2 - Silvio Savarese · Lecture 4 Single View Metrology Calibration Problem j C P i →MP i! " # $ % & →= i i iv u p In pixels M=K[RT]!!! " # $ $ $

Vanishing pointsThe projective projection of a point at infinity into the image plane defines a vanishing point.

M

!!!!

"

#

$$$$

%

&

=∞

03

2

1

xxx

x

!!!

"

#

$$$

%

&

=∞

3

2

1

ppp

p

world

p∞

Parallel lines

point at infinity

= direction of the line in 3D

Similarly to the 2D case, by applying the projective transformation M to a point at infinity x

inf we obtain a point p

inf in the image plane which is no

longer at infinity.

Interestingly, similarly to the 2D case, the direction of the (parallel) lines in 3D associated to x

inf is given by the coordinates x

1, x

2 and x

3 of x

inf

v=M X∞ =K I 0[ ]

abc0

"

#

$$$$

%

&

''''

=Kabc

"

#

$$$

%

&

'''

dv K=

d = direction of the line = [a, b, c]T

d

C

v

X∞ =

abc0

"

#

$$$$

%

&

''''

M

vvd

1

1

=KK

[Eq. 24] [Eq. 25]

Proof:

Vanishing points and directionsNext we derive a useful relationship between parallel lines in 3D, the corresponding vanishing point in the image and the camera parameters.

Let’s define as d=[a,b,c] the direction of a set of parallel lines in 3D in the camera reference system. These lines intersect to a point at infinity and the projection of such point in the image returns the vanishing point v.

It’s easy to prove that v is related to d via Eq. 24, where K is the camera matrix. Equivalently, d can be expressed as function of v by Eq. 25, where the division by || K

-1 v || guarantees that d has unit norm (d is a

direction).

The proof of Eq 24 is reported in the bottom part of the slide.

Vanishing (horizon) line

horizon

= lHlT

Phor

∞l

π

Projective transformation M

Image

[Eq. 26]

If we consider a plane π as a superset of set of parallel lines, each set of parallel lines intersects at a point at infinity. The line that passes through such set of points at infinity is the line at infinity l

inf associated to π. A line

at infinity is also defined as the line where two parallel planes intersect (in general, the intersection of two planes in 3D is a line). The projective transformation of l

inf to the image plane is no longer a line at infinity and is

called the vanishing line or horizon line lhoriz

(see Eq. 26). The horizon line is a line that passes through the corresponding vanishing points in the image.

Page 10: lecture4 single view metrology-2 - Silvio Savarese · Lecture 4 Single View Metrology Calibration Problem j C P i →MP i! " # $ % & →= i i iv u p In pixels M=K[RT]!!! " # $ $ $

Are these two lines parallel or not?

- Recognize the horizon line- Measure if the 2 lines meet at the horizon- if yes, these 2 lines are // in 3D

•Recognition helps reconstruction!•Humans have learnt this

The concept of horizon line allows to answer interesting questions about images. One is the following:Are the two dashed lines in the image parallel or not?

In order to answer this question we can assume that an oracle tells us that the horizon line is the orange one. Then, we can verify whether the 2 dashed lines meet at the horizon or not. If yes, these 2 lines are parallel in 3D.

This is an a nice example which shows that recognition can help solve a reconstruction problem. If we recognize the horizon line, we can infer properties about the world (verify the property that two lines are parallel or not). Humans have learnt many of these properties from our daily experience and we use those for solving important estimation problems.

Vanishing points and planes

C

n

horizTK ln =

horizl

πl∞

[Eq. 27]

It is easy to show that the normal n of π and lhoriz

are related by Eq. 27 (see sec. 8.6.2 [HZ] for details), where K is a camera matrix.

Again, Eq. 27 can be useful for estimating properties of the world. If we recognize the horizon and our camera is calibrated (K is known), we can estimate the orientation of the ground plane.

Planes at infinity

x

y

z

• A set of 2 or more lines at infinity defines the plane at infinity

∞Π…

!!!!

"

#

$$$$

%

&

=Π∞

1000

plane at infinity …

∞Π

• Parallel planes intersect at infinity in a common line – the line at infinity

Before introducing the last property that relates vanishing points and lines, we define the plane at infinity π

∞.

A set of 2 or more vanishing lines (blue lines in the figure) defines the plane at infinity π

∞ (yellow plane in the figure). The plane at infinity is

described by [0 0 0 1]T in homogenous coordinates

Page 11: lecture4 single view metrology-2 - Silvio Savarese · Lecture 4 Single View Metrology Calibration Problem j C P i →MP i! " # $ % & →= i i iv u p In pixels M=K[RT]!!! " # $ $ $

Angle between 2 vanishing points

2T21

T1

2T1

vvvv

vvcos

ωω

ωθ =

C

d1v2

v1d2

θ

If 90=θ 0vv 2T1 =→ ω

ω = (K KT )−1[Eq. 28]

x1∞

x2∞

[Eq. 29]Scalar equation

The last property we introduce (which we don’t prove either) is expressed by Eq. 28. Suppose that two pairs of parallel lines have directions d

1 and

d2, and are associated to the points at infinity x1

∞ and x2

∞, respectively. Let

v1 and v2 be the corresponding vanishing points. Eq. 28 relates the angle between d

1 and d

2 and the vanishing points v1 and v2. We define the

matrix (K KT)-1

as ω.One special case which is useful in practice is when the two set of parallel lines are orthogonal to each other. In this case, d

1 and d

2 are orthogonal,

which gives us [Eq. 29]. Notice that this is a scalar equation.

Projective transformation of ∞Ω

= (K KT )−1

It is not function of R, T

!!!

"

#

$$$

%

&

=

654

532

421

ωωω

ωωω

ωωω

ω symmetric and known up scale

02 =ω zero-skew 31 ωω = square pixel02 =ω

1.

2.

3. 4.

M = K R T!"

#$=M −TΩ∞M

−1

Absolute conic

[Eq. 30]

ω

The matrix ω has a special geometrical meaning in that it is the projective transformation of the absolute conic Ω

∞ in the image. This relationship is

expressed by [Eq. 30]. What’s the absolute conic Ω∞? It’s a conic that lies

in the plane at infinity [0 0 0 1]T. Note that in general, the projective

transformation of a quadric or conic Ω is expressed as M-T

Ω M-1

(see HZ page 73, eq. 3.16).

The matrix ω satisfies other interesting properties:

- It depends only on the internal matrix and not on the extrinsic parameters of the camera R and T.

- It is symmetric and known up to scale

- If w2 is 0, the camera has no skew.

- If w1 = w3, the camera has square pixels.

Why is this useful?

• To calibrate the camera• To estimate the geometry of the 3D world

These properties are useful for two reasons:

• To calibrate the camera: By using Eq 28 or Eq 29, we can set up a system of equations that allows us to calibrate our camera – that is, to estimate internal parameters of the camera

• To estimate the geometry of the 3D world: Once K is estimated or K is known, we can use these equations to estimate the orientation of planes in 3D w.r.t. to the camera reference system

Let’s see some examples next.

Page 12: lecture4 single view metrology-2 - Silvio Savarese · Lecture 4 Single View Metrology Calibration Problem j C P i →MP i! " # $ % & →= i i iv u p In pixels M=K[RT]!!! " # $ $ $

Lecture 4 - Silvio Savarese 16-Jan-15

• Review calibration • Vanishing points and line • Estimating geometry from a single image • Extensions

Reading: [HZ] Chapter 2 “Projective Geometry and Transformation in 3D” [HZ] Chapter 3 “Projective Geometry and Transformation in 3D” [HZ] Chapter 8 “More Single View Geometry” [Hoeim & Savarese] Chapter 2

Lecture 4 Single View Metrology

θ = ?

0vv 2T1 =ω

v1v2

ω = (K KT )−1Do we have enough constraints to estimate K?K has 5 degrees of freedom and Eq.29 is a scalar equation ☹

Single view calibration - example

2T21

T1

2T1

vvvv

vvcos

ωω

ωθ =

[Eq.

28]

= 90o

Suppose we can identify two planes in an image of the 3D world (e.g., the two building facades) and suppose we can identify a pair of parallel lines on each of these planes. This allows to estimate two vanishing points in the image v

1 and v

2. Suppose we know that these planes are

perpendicular in 3D (the two building facades are perpendicular in 3D). Than we can set up the system of equations above using Eq 29 and the definition of ω.

Is this sufficient to estimate the camera parameters? K has in general 5 degrees of freedom and Eq.29 is a scalar equation; so clearly we don’t have enough constraints.

v1v2

Single view calibration - example

2T21

T1

2T1

vvvv

vvcos

ωω

ωθ =

[Eq.

28]

v3

0vv 2T1 =ω

0vv 3T1 =ω

0vv 3T2 =ω

[Eqs

. 31]

Let’s now assume we can identify another pair of parallel lines and its corresponding vanishing point v

3. With a third vanishing point and by

assuming that the 3 set of pairs of parallel lines are pairwise orthogonal in 3D (which is true in this example), we can use Eq. 29 to set up a system of 3 equations (constraints) (Eqs. 31).

Page 13: lecture4 single view metrology-2 - Silvio Savarese · Lecture 4 Single View Metrology Calibration Problem j C P i →MP i! " # $ % & →= i i iv u p In pixels M=K[RT]!!! " # $ $ $

Single view calibration - example

0vv 2T1 =ω

0vv 3T1 =ω

0vv 3T2 =ω

!!!

"

#

$$$

%

&

=

654

532

421

ωωω

ωωω

ωωω

ω

31 ωω =02 =ω ! Compute :ω

known up to scale

ω = (K KT )−1 K(Cholesky factorization; HZ pag 582)

Once ω is calculated, we get K:

[Eqs

. 31]

Let’s now also make some assumptions about the camera. Let’s assume the camera is zero-skew and with square pixels.

Using the properties of ω:- ω is symmetric which means we have 6 unknown- ω is known up a scale which reduces to 5 unknown

- ω2=0 and ω

1=ω

3 which reduces to 3 unknown

We have now enough constraints to solve for the unknowns and can calculate ω. The actual parameters of K can be computed from ω using the Cholesky factorization. We don’t proof this results; for more details please refer to HZ pag 582.

Thus, at the end of this procedure we have managed to calibrate the camera from just one single image!

Single view reconstruction - example

lh

knownK horizTK ln =→ = Scene plane orientation in

the camera reference system

Select orientation discontinuities

Once K is known we can “reconstruct” the geometry of the scene; for instance, we can compute the orientation of all the planes in 3D using Eq. 27. In order to do so, we need to identify the corresponding lines at infinity and select the orientation discontinuities (that is, where planes fold).

Single view reconstruction - example

Recover the structure within the camera reference systemNotice: the actual scale of the scene is NOT recovered

C

•Recognition helps reconstruction!•Humans have learnt this

Again, the assortment of tools introduced in this lecture allows us to estimate properties of the camera from observations and/or estimate properties of the world by assuming we have some knowledge about the world (e.g., where the horizon lines are; planes discontinuities; etc…).

Notice that that actual scale of the scene cannot be recovered unless we assume we have access to some measurements in 3D (e.g., a window size); this is similar to what we did when we calibrated the camera.

Page 14: lecture4 single view metrology-2 - Silvio Savarese · Lecture 4 Single View Metrology Calibration Problem j C P i →MP i! " # $ % & →= i i iv u p In pixels M=K[RT]!!! " # $ $ $

Lecture 4 - Silvio Savarese 16-Jan-15

• Review calibration • Vanishing points and lines • Estimating geometry from a single image • Extensions

Reading: [HZ] Chapter 2 “Projective Geometry and Transformation in 3D” [HZ] Chapter 3 “Projective Geometry and Transformation in 3D” [HZ] Chapter 8 “More Single View Geometry” [Hoeim & Savarese] Chapter 2

Lecture 4 Single View Metrology

Criminisi & Zisserman, 99

http://www.robots.ox.ac.uk/~vgg/projects/SingleView/models/merton/merton.wrl

Here we see some results obtained using the approach proposed by A. Criminisi and Zisserman (1999). This approach uses many of the results introduced in this lecture.

Criminisi & Zisserman, 99

http://www.robots.ox.ac.uk/~vgg/projects/SingleView/models/merton/merton.wrl

Page 15: lecture4 single view metrology-2 - Silvio Savarese · Lecture 4 Single View Metrology Calibration Problem j C P i →MP i! " # $ % & →= i i iv u p In pixels M=K[RT]!!! " # $ $ $

La Trinita' (1426) Firenze, Santa Maria Novella; by Masaccio (1401-1428)

La Trinita' (1426) Firenze, Santa Maria Novella; by Masaccio (1401-1428)

http://www.robots.ox.ac.uk/~vgg/projects/SingleView/models/hut/hutme.wrl

Page 16: lecture4 single view metrology-2 - Silvio Savarese · Lecture 4 Single View Metrology Calibration Problem j C P i →MP i! " # $ % & →= i i iv u p In pixels M=K[RT]!!! " # $ $ $

Manually select:• Vanishing points and lines;• Planar surfaces;• Occluding boundaries;• Etc..

Single view reconstruction - drawbacks

Automatic Photo Pop-upHoiem et al, 05

A few years later, D Hoiem proposed an approach where the process of recovering the geometry from a single image is mostly automatic. This approach leverages recognition and segmentation results;

Automatic Photo Pop-upHoiem et al, 05…

Page 17: lecture4 single view metrology-2 - Silvio Savarese · Lecture 4 Single View Metrology Calibration Problem j C P i →MP i! " # $ % & →= i i iv u p In pixels M=K[RT]!!! " # $ $ $

Automatic Photo Pop-upHoiem et al, 05…

http://www.cs.uiuc.edu/homes/dhoiem/projects/software.html

Software:

Training

Image Depth

Prediction

Planar Surface Segmentation

Plane Parameter MRF

Connectivity Co-Planarity

Make3D

youtube

Saxena, Sun, Ng, 05…

During the same period, A. Ng and his student A. Saxena at Stanford also demonstrated that it is possible to recover the geometry of the scene from a single image using recognition results and probabilistic inference.

A software: Make3D“Convert your image into 3d model”

Single Image Depth ReconstructionSaxena, Sun, Ng, 05…

http://make3d.stanford.edu/http://make3d.cs.cornell.edu/

Page 18: lecture4 single view metrology-2 - Silvio Savarese · Lecture 4 Single View Metrology Calibration Problem j C P i →MP i! " # $ % & →= i i iv u p In pixels M=K[RT]!!! " # $ $ $

Coherent object detection and scene layout estimation from a single image

Y. Bao, M. Sun, S. Savarese, CVPR 2010, BMVC 2010

Y. BaoM. Sun

In my own group, we have shown it is possible to combine recognition and reconstruction from a single image in a coherent formulation.

Next lecture:

Multi-view geometry (epipolar geometry)

Appendix