37
Introduction to 3D Vision How do we obtain 3D image data? • What can we do with it?

Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Introduction to 3D Vision

• How do we obtain 3D image data?

• What can we do with it?

Page 2: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

What can you determine about 1. the sizes of objects2. the distances of objects from the camera?

What knowledgedo you use toanalyze this image?

Page 3: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

What objects are shown in this image?How can you estimate distance from the camera?What feature changes with distance?

Page 4: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

3D Shape from X

• shading• silhouette• texture

• stereo • light striping• motion

mainly research

used in practice

Page 5: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Perspective Imaging Model: 1D

xi

xf

f

This is the axis of the real image plane.

O

zc

camera lens O is the center of projection.

xc

This is the axis of the frontimage plane, which we use.

xi xcf zc

=

3D objectpoint

B

D

E

image of pointB in front image

real imagepoint

Page 6: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Perspective in 2D(Simplified)

P=(xc,yc,zc)=(xw,yw,zw)

3D object point

xc

yc

zw=zc

yi

Yc

Xc

Zc

xiF f

cameraP´=(xi,yi,f)

xi xcf zc

yi ycf zc

=

=

xi = (f/zc)xcyi = (f/zc)yc

Here camera coordinatesequal world coordinates.

opticalaxis

ray

Page 7: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

3D from Stereo3D point

left image right image

disparity: the difference in image location of the same 3Dpoint when projected under perspective to two different cameras.

d = xleft - xright

Page 8: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Depth Perception from StereoSimple Model: Parallel Optic Axes

f

f

L

R

camera

bbaselinecamera

P=(x,z)

Z

X

image plane

xl

xr

z

x-b

y-axis isperpendicularto the page.

z x-bf xr=z x

f xl= z y y

f yl yr= =

Page 9: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Resultant Depth Calculation

For stereo cameras with parallel optical axes, focal length f,baseline b, corresponding image points (xl,yl) and (xr,yr)with disparity d:

This method ofdetermining depthfrom disparity is called triangulation.

z = f*b / (xl - xr) = f*b/d

x = xl*z/f or b + xr*z/f

y = yl*z/f or yr*z/f

Page 10: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Finding Correspondences

• If the correspondence is correct,triangulation works VERY well.

• But correspondence finding is not perfectly solved.for the general stereo problem.

• For some very specific applications, it can be solvedfor those specific kind of images, e.g. windshield ofa car.

° °

Page 11: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

3 Main Matching Methods

1. Cross correlation using small windows.

2. Symbolic feature matching, usually using segments/corners.

3. Use the newer interest operators, ie. SIFT.

dense

sparse

sparse

Page 12: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Epipolar Geometry Constraint:1. Normal Pair of Images

x

y1

y2

z1 z2

C1 C2b

P1P2

epipolarplane

The epipolar plane cuts through the image plane(s)forming 2 epipolar lines.

P

The match for P1 (or P2) in the other image, must lie on the same epipolar line.

Page 13: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Epipolar Geometry:General Case

P

P1P2

y1y2

x1x2

e1e2

C1

C2

Page 14: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Constraints

P

e1e2

C1

C2

1. Epipolar Constraint:Matching points lie oncorresponding epipolarlines.

2. Ordering Constraint:Usually in the same order across the lines.Q

Page 15: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Structured Lightlight stripe

3D data can also be derived using

• a single camera

• a light source that can producestripe(s) on the 3D object

lightsource

camera

Page 16: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Structured Light3D Computation

3D data can also be derived using

• a single camera

• a light source that can producestripe(s) on the 3D object

lightsource

x axisf

(x´,y´,f)

θ

b

3D point(x, y, z)

b[x y z] = --------------- [x´ y´ f]

f cot θ - x´

(0,0,0)

3D image

Page 17: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Depth from Multiple Light Stripes

What are these objects?

Page 18: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Our (former) System4-camera light-striping stereo

projector

rotationtable

cameras

3Dobject

Page 19: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Camera Model: Recall there are 5 Different Frames of Reference

yc

xc• Object

• World

• Camera

• Real Image

• Pixel Image

zc

xw

A

axf

yf zwC

image

Wyw

xp

pyramidobjectyp

zp

Page 20: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Rigid Body Transformations in 3D

pyramid modelin its own

model space

yp

zp

zw

xp

rotatetranslatescale

Wyw

instance of the object in the

worldxw

Page 21: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Translation and Scaling in 3D

Page 22: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Rotation in 3D is about an axisz

θ

Px´Py´Pz´1

rotation by angle θabout the x axis

y

x PxPyPz1

1 0 0 00 cos θ - sin θ 00 sin θ cos θ 00 0 0 1

=

Page 23: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Rotation about Arbitrary Axis

R1

Px´Py´Pz´1

r11 r12 r13 txr21 r22 r23 tyr31 r32 r33 tz0 0 0 1

PxPyPz1

=

R2T

One translation and two rotations to line it up with amajor axis. Now rotate it about that axis. Then applythe reverse transformations (R2, R1, T) to move it back.

Page 24: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

The Camera Model

How do we get an image point IP from a world point P?

PxPyPz1

c11 c12 c13 c14c21 c22 c23 c24c31 c32 c33 1

s Iprs Ipc

s=

imagepoint

worldpoint

camera matrix C

What’s in C?

Page 25: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

The camera model handles the rigid body transformation from world coordinates to camera coordinates plus the

perspective transformation to image coordinates.

1. CP = T R WP2. IP = π(f) CP

CPxCPyCPz

1

s Ipxs Ipy

s

1 0 0 00 1 0 00 0 1/f 1

=

imagepoint

perspectivetransformation

3D point incamera

coordinates

Page 26: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Camera Calibration

• In order work in 3D, we need to know the parametersof the particular camera setup.

• Solving for the camera parameters is called calibration.

yc • intrinsic parameters areof the camera device

• extrinsic parameters arewhere the camera sitsin the world

ywxc

zcC

zwW xw

Page 27: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Intrinsic Parameters

• principal point (u0,v0)

• scale factors (dx,dy)

• aspect ratio distortion factor γ

• focal length f

• lens distortion factor κ(models radial lens distortion)

C

(u0,v0)

f

Page 28: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Extrinsic Parameters

• translation parameterst = [tx ty tz]

• rotation matrix

r11 r12 r13 0r21 r22 r23 0r31 r32 r33 00 0 0 1

R = Are there reallynine parameters?

Page 29: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Calibration Object

The idea is to snapimages at differentdepths and get alot of 2D-3D pointcorrespondences.

Page 30: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

The Tsai Procedure

• The Tsai procedure was developed by Roger Tsaiat IBM Research and is most widely used.

• Several images are taken of the calibration objectyielding point correspondences at different distances.

• Tsai’s algorithm requires n > 5 correspondences

{(xi, yi, zi), (ui, vi)) | i = 1,…,n}

between (real) image points and 3D points.

Page 31: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Tsai’s Geometric SetupyOc

x

principal point p0

z

pi = (ui,vi)

Pi = (xi,yi,zi)

(0,0,zi)

x

y

image plane

camera

3D point

Page 32: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Tsai’s Procedure

• Given n point correspondences ((xi,yi,zi), (ui,vi))

• Estimates • 9 rotation matrix values• 3 translation matrix values• focal length• lens distortion factor

• By solving several systems of equations

Page 33: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

We use them for general stereo.

P

P1=(r1,c1)P2=(r2,c2)

y1y2

x1x2

e1e2

C1

C2

Page 34: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

For a correspondence (r1,c1) inimage 1 to (r2,c2) in image 2:

1. Both cameras were calibrated. Both camera matrices are then known. From the two camera equations we get

4 linear equations in 3 unknowns.

r1 = (b11 - b31*r1)x + (b12 - b32*r1)y + (b13-b33*r1)zc1 = (b21 - b31*c1)x + (b22 - b32*c1)y + (b23-b33*c1)z

r2 = (c11 - c31*r2)x + (c12 - c32*r2)y + (c13 - c33*r2)zc2 = (c21 - c31*c2)x + (c22 - c32*c2)y + (c23 - c33*c2)z

Direct solution uses 3 equations, won’t give reliable results.

Page 35: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Solve by computing the closestapproach of the two skew rays.

P1

Q1

solve forshortest

If the raysintersectedperfectly in 3D,the intersectionwould be P.

PV

Instead, we solve for the shortest linesegment connecting the two rays andlet P be its midpoint.

Page 36: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Application: Kari Pulli’s Reconstruction of 3D Objects from light-striping stereo.

Page 37: Introduction to 3D Vision - University of Washington · 2007. 2. 23. · Introduction to 3D Vision Author: Linda Shapiro Created Date: 2/23/2007 3:48:31 PM

Application: Zhenrong Qian’s 3D Blood Vessel Reconstruction from Visible Human Data