3d geometric computer visionugweb.cs.ualberta.ca/.../lec01bcrv16-2018.pdf · affine 6 dof...

51
3D Geometric Computer Vision Martin Jagersand Univ. Alberta Edmonton, Alberta, Canada

Upload: others

Post on 22-Jul-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

3D Geometric Computer Vision

Martin Jagersand

Univ. Alberta

Edmonton,

Alberta, Canada

Page 2: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Multi-view geometry

Build 3D models from images Carry out manipulation tasks

And many other usages…

http://webdocs.cs.ualberta.ca/~vis/ibmr/ Training for Amazon manipulation challenge

Page 3: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Multi-view Geometry

Relates

• 3D world points

• Camera calibr.

• 2D image points

The reconstruction of 3D models of objects from a collection of 2D images

Page 4: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Multi-view Geometry

Typical processing pipeline (C. Hernandez MVS tutorial)

Page 5: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Multi-view Geometry

Page 6: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Middlebury multi-view benchmark

Calibration accuracy on these datasets appears to be on the order of a pixel (a pixel spans about 1/4mm on the object).

Cited by 1479

A Comparison and Evaluation of Multi-View Stereo Reconstruction Algorithms, Seitz, Curless, Diebel, SzeliskiCVPR 2006, vol. 1, pages 519-526.

::

Page 7: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Dorsal and Ventral PathwaysWhere/What or Action/Perception?

•Humans don’t internalize detailed 3D maps!

•Use external world as map. (Hayhoe, Pelz, Rensink, Goodale etc)

Page 8: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Course content

•Video processing: Image motion and tracking

•2D projective geometry

•3D projective geometry

•Cameras, their math model and calibration

•Two-camera “stereo” 3D reconstruction

•Multi-view geometry and general 3D reconstruct.

•Light, surface reflectance and math modeling

•Computer vision systems

Page 9: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Challenges:Geometric size ambiguity

Page 10: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

ChallengesLight / photometric ambiguity

Page 11: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

ChallengesLight / photometric ambiguity

Page 12: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

1/9/201812

Fundamental types of video processing “Visual motion detecton”

•Relating two adjacent frames: (small differences):Im(x + �x, y + �y, t + �t) = Im(x, y, t)

Page 13: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Fundamental types of video processing “Visual Tracking” / Stabilization

•Globally relating all frames: (large differences):

Page 14: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

1/9/201814

Intensity images / videonon-trivial to get information

Note: Almost all pixels change!

abs( Image 1 - Image 2) = ?

Constancy: The physical scene is the same

How do we make use of this?

Page 15: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

MTF – Modular Tracking Framework

• Open source • C++ implementation• ROS interface• Matlab/Pyhton• Cross platform

Page 16: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Application:Augmenter Reality

Page 17: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Beyond 3DNon-rigid and articulated motion

• Humans ubiquitous in graphics applications

• A practical, realistic model requires – Skeleton

– Geometry (manually modeled, laser scanned)

• Physical simulation for clothes, muscle

– Texture/appearance (from images)

– Animation (mocap, simulation, artist)

Page 18: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Beyond 3D:Non-rigid and articulated motion

PhD work of Neil Birkbeck, Best thesis prize winner

Page 19: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Uses of partial information from 2D-3D camera geometry

•Measurements in single images

•Visual constraints: verify alignments, detect impossible configurations (Escher paintings)

•Visual servoing

•Video tracking

•Rendering

•… many more

Why? Compact, accurateFew relative alignments vs. complete global geometry

Page 20: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Single View Metrology

Vanishingpoint

Vanishingline

Vanishingpoint

Vertical vanishingpoint

(at infinity)

Geometric Cues

Page 21: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Single View Metrology (559 citations)

Estimating Height

•The distance || tr – br || is known•Used to estimate the height of the man in the scene

A. Criminisi, I Reid, A ZissermanInternational Journal of Computer Vision 40 (2), 123-148, 2000

Page 22: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Geometry for hand-eye coordinationImage-Based Visual Servoing (IBVS)

Page 23: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Intro to Image-based Visual ServoingIBVS

Initial Image

Desired Image

User

Page 24: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Vision-Based Control (Visual Servoing)

: Current Image Features: Desired Image Features

Page 25: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Vision-Based Control (Visual Servoing)

: Current Image Features: Desired Image Features

Page 26: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Vision-Based Control (Visual Servoing)

: Current Image Features: Desired Image Features

Page 27: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Vision-Based Control (Visual Servoing)

: Current Image Features: Desired Image Features

Page 28: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Vision-Based Control (Visual Servoing)

: Current Image Features: Desired Image Features

Page 29: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

u,v Image-Space Error

: Current Image Features: Desired Image Features

E = [ � ]

E =yu

yv

� �

yu

yv

� �

E= [y0�y�]One point

Pixel coord

E =

y1...

y8

y1...

y8

0

Many points

u

v

Page 30: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Problem: Lots of coordinate frames to calibrate

Camera– Center of projection

– Different models

Robot and scene– Base frame

– End-effector frame

– Object

Page 31: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Visual specifications

•Point to Point task “error”:

y�E = [y�

� y0]

y0

y�

y0

E =

y1...

y16

y1...

y16

0

Why 16 elements?

Page 32: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Visual specifications 2

•Point to Line

Line: Epl(y, l) =yl � llyr � lr

� �

ll = y2 � y3[ ]l

yl=

ul

vl

k

[ ]

y2[ ]

y3[ ]

Note: y’s in homogeneous coord.

How to design visual specifications in a principled way?

Page 33: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

X

Y

k

Homogeneous coordinates

≡X

Y

k

s

s ≠ 0

X∞

X

Y

0

X∞

=

• 2D projective space models perspective imaging

• Each 3D ray is a point in P2 : homogeneous coords.

• Ideal points

• P2 is R2 plus a “line at infinity” l∞

The 2D projective plane

Projective point

l∞

x

y

X

Y

1k= Inhomogeneous

equivalent

Page 34: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Projective Lines

HZ • Ideal line ~ the plane parallel to the image

A

B

C

l =X=lTX = X

Tl = AX + BY + CZ = 0

l∞

=

0

0

1

• Projective line ~ a plane through the origin

For any 2d projective property, a dual property holds when the role of points and lines are interchanged.

Duality:

X

Y

0

X∞

=

l1 l2X =X1 X2=l

The line joining two points The point joining two lines

X

Y

Z

X

l

“line at infinity”

Page 35: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Projective transformations

• Homographies, collineations, projectivities

• 3x3 nonsingular H

=

3

2

1

333231

232221

131211

3

2

1

'

'

'

x

x

x

hhh

hhh

hhh

x

x

x

l′= H

�Tl

xTl = 0 x

′Tl′= 0

maps P2 to P2

8 degrees of freedomdetermined by 4 corresponding points

x′= Hx• Transforming Lines?

subspaces preserved

xTH

Tl′= 0substitution

dual transformation

Page 36: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Group Transformation Invariants Distortion

Projective

8 DOF

• Cross ratio

• Intersection

• Tangency

Affine

6 DOF

• Parallelism

• Relative dist in 1d

• Line at infinity

Metric

4 DOF

• Relative distances

• Angles

• Dual conic

Euclidean

3 DOF

• Lengths

• Areas

Homographies a generalization ofaffine and Euclidean transforms

=

1TS

sRH

O

t

=

1TA

AH

O

t

=

1TE

RH

O

t

=

v

AH TP v

t

∞C*

2 dof∞l

2 dof

∞l

∞C*

Page 37: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

How to define a visual task?

Page 38: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Visually defined alignment: basic

point-to-point: epp(y) = y2 - y1

point-to-line: epl(y) = y1. (y2 x y3)

or (homogenous coord) epp(y) = y2 x y1

Page 39: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Some more visual alignments

parallel lines: epar(l) = (l1 x l2) x (l3 x l4)

point-to-ellipse: epe(y) = yT1 Cellipsey1

line-to-line: ell(y) = y1. (y3 x y4) + y2

. (y3 x y4)

Page 40: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Now: Language for visual alignmentsWhat else do we need?

Registrationtrackers:

Featuretrackers

Need: 1. Some way of entering alignments in images 2. video tracking to perform servoing!

Download:http://webdocs.cs.ualberta.ca/~vis/mtf/

Page 41: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Visual ambiguity

•Will the scissors cut the paper in the middle?

Page 42: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

ambiguity

•Will the scissors cut the paper in the middle? NO!

Page 43: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Task Ambiguity

•Is the probe contacting the wire?

Page 44: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Task Ambiguity

•Is the probe contacting the wire? NO!

Page 45: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Solve the cut in the middle task?

•Compute paper midpoint. How?

Page 46: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Solve the cut in the middle task?

•Compute paper midpoint.

(Are we done yet?)xm= (l1 x l2)

l1

l2

Page 47: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Solve the cut in the middle task?

•Compute vanishing point X∞

,

•Intersect X∞

w. midptXmX∞= (l3 x l4)

l4

l3

Alternative formulations?

lm= (X∞

x Xm)

Page 48: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

What information do we use to move?

How about other applications?

• Recognizable Locations l Topological Maps

2 km

100 km

200 m50 km

y

x{W}

l Metric Topological Maps l Fully Metric Maps Cou

rtes

y

K. A

rras

Mobile robot navigation: From appearance to metric SLAM

Page 49: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Beyond projective camera vision and screen GUI: Pointing

Page 50: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Questions?

More information:

•Downloadable renderer+modelswww.cs.ualberta.ca/~vis/ibmr

•Capturing software + IEEE VR tutorial textwww.cs.ualberta.ca/~vis/VR2003tut

•Main references for this talk:

Jagersand et al “Three Tier Model” 3DPVT 2008 ….

Jagersand “Image-based Animation…” CVPR 1997

•More papers: www.cs.ualberta.ca/~jag

Page 51: 3D Geometric Computer Visionugweb.cs.ualberta.ca/.../lec01bCRV16-2018.pdf · Affine 6 DOF •Parallelism •Relative dist in 1d •Line at infinity Metric 4 DOF • Relative distances

Making Pizza with my robot3rd Prize ICRA’15 Video competition

Change a LightbulbICRA’97 Video

Questions?