50
Robotica Robotica Anno accademico 2006/2007 Davide Migliore [email protected]

Robotica - Politecnico di Milanohome.deib.polimi.it/restelli/Lezione1.pdf · 06/10/2006 Corso di Robotica A 06/07 Davide Migliore - [email protected] 2 Today Introduction Camera

Embed Size (px)

Citation preview

Robotica Robotica

Anno accademico 2006/2007

Davide [email protected]

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

22

TodayToday

● Introduction ● Camera Model

– Survey on homogeneous coordinate rappresentation

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

33

Why these lessons?Why these lessons?

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

44

Why these lessons?Why these lessons?

??

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

55

Why these lessons?Why these lessons?

● What from sensors?

Camera Laser

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

66

Why these lessons?Why these lessons?

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

77

Why these lessons?Why these lessons?

??

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

88

Why these lessons?Why these lessons?

● What from sensors?

Disparity Image Stereo Camera

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

99

Possible solutionPossible solution

Sensing

Simultaneous Localization And Mapping

(SLAM)

Computer Computer VisionVision

ProbabilisticProbabilisticRoboticsRobotics

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

1010

Why study Computer Vision?Why study Computer Vision?

● Images and movies are simple to acquire.● Fast-growing collection of useful applications

– building representations of the 3D world from pictures

– automated surveillance, object tracking– obstacle detection and robot localization

● Now cameras are inexpensive

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

1111

What can I do with C.V.?What can I do with C.V.?

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

1212

Why Probabilistic Robotics?Why Probabilistic Robotics?

● A new and growing area in robotics, concerned with perception and control in the face of uncertainty.

● Uncertainty arises from four major factors:– Environment stochastic, unpredictable– Robot stochastic– Sensor limited, noisy– Models inaccurate

● Key idea: Explicit representation of uncertainty

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

1313

What can I do with P.R.?What can I do with P.R.?Indoors

Space

Undersea

Underground

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

1414

Purpose of these lessonsPurpose of these lessons

● To provide an introduction to the uses of visual sensing and probabilistic methods for mobile robotic tasks.

● A survey of the mathematical and algorithmic problems that recur in its application.

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

1515

Date Lesson

06/10/06

13/10/06 2D and 3D geometry

20/10/06 2D and 3D geometry

27/10/06 Features extraction

03/11/06 Introduction and state estimation

01/12/06 Gaussian Filters

15/12/06 Non parametric Filters

12/01/06 Conclusion and demos

Computer Vision & Probabilistic Robotics introduction.Homogeneous Coordinate and Pin-Hole Camera Model

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

1616

Date Lesson

06/10/06

13/10/06 2D and 3D geometry

20/10/06 2D and 3D geometry

27/10/06 Features extraction

03/11/06 Introduction and state estimation

01/12/06 Gaussian Filters

15/12/06 Non parametric Filters

12/01/06 Conclusion and demos

Computer Vision & Probabilistic Robotics introduction.Homogeneous Coordinate and Pin-Hole Camera Model

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

1717

ReferencesReferences

● “Multiple View Geometry”, R.Hartley and A.Zisserman, ed. Cambridge University Press, 2nd edition 2003.● “An Invitation to 3D Vision”, Y.Ma, S.Soatto, J.Kosecka, S.S.Sastry, ed. Springer, 2000. ● “Probabilistic Robotics”, S.Thrun, W.Burgard, D.Fox, ed. MIT Press 2005.● “Robotica”, G.Gini and V.Caglioti, ed. Zanichelli, 2003.

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

1818

The Camera The Camera andand

Homogeneous RepresentationHomogeneous Representation

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

1919

How do we see the world?How do we see the world?

Let’s design a camera● Idea: put a piece of film in front of an object● Do we get a reasonable image?

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

2020

Pinhole cameraPinhole camera

Add a barrier to block off most of the rays– This reduces blurring– The opening known as the aperture– How does this transform the image?

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

2121

Pinhole camera modelPinhole camera model

Pinhole model:– Captures pencil of rays – all rays through a single point– The point is called Center of Projection (COP)– The image is formed on the Image Plane– Effective focal length f is distance from COP to Image

Plane

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

2222

Dimensionality Reduction Machine Dimensionality Reduction Machine (3D to 2D)(3D to 2D)

Point of observation

3D world 2D image

What have we lost?• Angles• Distances (lengths)

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

2323

Funny things happen…Funny things happen…

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

2424

Parallel lines aren’t…Parallel lines aren’t…

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

2525

Distances can’t be trusted...Distances can’t be trusted...

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

2626

……but humans adopt!but humans adopt!

Müller-Lyer Illusion

http://www.michaelbach.de/ot/sze_muelue/index.html

We don’t make measurements in the image plane

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

2727

Building a real cameraBuilding a real camera

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

2828

Camera ObscuraCamera Obscura

The first camera● Known to Aristotele● Depth of the room is the effective focal length

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

2929

Aperture tuningAperture tuning

Why not make the aperture as small as possible?● Less light gets through● Diffraction effects…

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

3030

Aperture tuningAperture tuning

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

3131

From Pinhole to lensesFrom Pinhole to lenses

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

3232

Image Formation using LensesImage Formation using LensesIdeal Lens: Same projection as pinhole but gathers more light!

foi

111 =+

i o

Lens Formula:

• f is the focal length of the lens – determines the lens’s ability to bend (refract) light

• f different from the effective focal length f discussed before!

P

P’

f

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

3333

Focus and DefocusFocus and Defocus

A lens focuses light onto the film– There is a specific distance at which objects are “in focus”

● other points project to a “circle of confusion” in the image– How can we change focus distance?

“circle of confusion”

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

3434

Depth of FieldDepth of Field

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

3535

Depth of FieldDepth of Field

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

3636

Depth of FieldDepth of Field

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

3737

Aperture controls Depth of Aperture controls Depth of FieldField

Changing the aperture size affects depth of field– A smaller aperture increases the range in which the

object is approximately in focus– But small aperture reduces amount of light – need to

increase exposure

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

3838

Varying the aperture Varying the aperture

Large apeture = small DOF Small apeture = large DOF

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

3939

Modeling projectionModeling projection

The coordinate system– We will use the pin-hole model as an approximation– Put the optical centre or camera centre(Centre) at the origin– Put the image plane in front of the COP

● Why?– The camera looks up the positive z axis

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

4040

Modeling projectionModeling projection

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

– Ignoring the final image coordinate: (from 3D to 2D)

x= f XZ

y= f YZ

X ,Y , Z T f XZ, fYZT

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

4141

Homogeneous coordinatesIs this a linear transformation?

Trick: add one more coordinate (w=1):

homogeneous image coordinates

homogeneous scene coordinates

Converting from homogeneous coordinates

● no—division by z is nonlinear

x , yT⇒ xy1 X ,Y , Z T⇒XYZ1

xyw ⇒x /w , y /wT XYZW

⇒X /W ,Y /W , Z /W T

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

4242

Central ProjectionCentral Projection

● Projection is a matrix multiply using homogeneous coordinates:

N.b. w = ZXYZ1 fXfYZ =[ f 0 0

0 f 00 0 1][1 0 0 0

0 1 0 00 0 1 0]XYZ

1

fXfYZ =[ f 0 0 00 f 0 00 0 1 0 ] XYZ

1

x=PX P=diag f , f ,1[ I∣0]

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

4343

Principal Point OffsetPrincipal Point Offset

X ,Y , Z T f XZ px , f

YZ p y

T

● The origin oh coordinates in image planes is not at the principal point p x , p yT

XYZ1 fXZpx

fYZp yZ =[ f 0 px 0

0 f p y 00 0 1 0 ] XYZ1

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

4444

Camera Calibration Matrix (K)Camera Calibration Matrix (K)

K=[ f 0 px0 f py0 0 1 ]

x=K [ I∣0] X cam● Rewriting the equation:

● The camera is assumed to be located at the origin of Euclidean coordinate system, with principal axis of camera pointing down the Z-axis: this system may be called camera coordinate frame.

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

4545

Trasformation and matricesTrasformation and matrices

[ x 'y ' ]=[ab ][ xy ]● Traslation:

● Homogeneous rappresentation:

[ x 'y '1 ]=[1 0 a0 1 b0 0 1][ xy1 ]

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

4646

Trasformation and matricesTrasformation and matrices

[ x 'y ' ]=[cos −sinsin cos ][ xy ]

● Rotation around origin 2D (anticlockwise is positive):

● Homogeneous rappresentation:

[ x 'y '1 ]=[cos −sin 0sin cos 00 0 1][ xy1 ]

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

4747

Trasformation and matricesTrasformation and matrices

● In 3D:

RR=[1 0 00 cosR −sin R0 sin R cosR ]

P P=[ cosP 0 sinP0 1 0

−sinP 0 cosP]Y Y =[cosY −sinY 0

sin Y cosR 00 0 1 ]

Homoneneous

R R=[1 0 0 00 cosR −sinR 00 sinR cosR 00 0 0 1

]P P=[ cosP 0 sinP 0

0 1 0 0−sinP 0 cosP 00 0 0 1

]Y Y =[cosY −sinY 0 0

sin Y cosR 0 00 0 1 00 0 0 1

]

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

4848

Camera Rotation and TraslationCamera Rotation and Traslation

X cam=R X− C is an inhomogeneus point in world coordinate frame

represents the same point in camera coordiante frame

represents the coordinate of the camera centre in world coordinate frame

X cam=[R −R C0 1 ][ XY1 ]

x=KR [ I∣− C ] X

X

X cam

C

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

4949

Camera Rotation and TraslationCamera Rotation and Traslation

● It is often convenient not to make the camera centre explicit:

X cam=R Xt t=−R C

P=K [R∣t ] Camera MatrixCamera Matrix

06/10/200606/10/2006 Corso di Robotica A 06/07Corso di Robotica A 06/07Davide Migliore - [email protected] Migliore - [email protected]

5050

End of first lesson

● Any question?