Cameras and Stereo CSE 455. Linda Shapiro

Similar documents
Stereo II CSE 576. Ali Farhadi. Several slides from Larry Zitnick and Steve Seitz

Epipolar Geometry and Stereo Vision

Epipolar Geometry and Stereo Vision

Stereo CSE 576. Ali Farhadi. Several slides from Larry Zitnick and Steve Seitz

Stereo. 11/02/2012 CS129, Brown James Hays. Slides by Kristen Grauman

BIL Computer Vision Apr 16, 2014

Epipolar geometry. x x

COSC579: Scene Geometry. Jeremy Bolton, PhD Assistant Teaching Professor

Computer Vision Lecture 17

Stereo vision. Many slides adapted from Steve Seitz

Computer Vision Lecture 17

CS4670: Computer Vision

CS6670: Computer Vision

Today. Stereo (two view) reconstruction. Multiview geometry. Today. Multiview geometry. Computational Photography

Binocular stereo. Given a calibrated binocular stereo pair, fuse it to produce a depth image. Where does the depth information come from?

Multi-view geometry problems

Computer Vision I. Announcement. Stereo Vision Outline. Stereo II. CSE252A Lecture 15

Reminder: Lecture 20: The Eight-Point Algorithm. Essential/Fundamental Matrix. E/F Matrix Summary. Computing F. Computing F from Point Matches

Stereo. Many slides adapted from Steve Seitz

CS5670: Computer Vision

CS201 Computer Vision Camera Geometry

Lecture'9'&'10:'' Stereo'Vision'

Recovering structure from a single view Pinhole perspective projection

Structure from motion

Lecture 6 Stereo Systems Multi-view geometry

Final project bits and pieces

Project 3 code & artifact due Tuesday Final project proposals due noon Wed (by ) Readings Szeliski, Chapter 10 (through 10.5)

CS 4495 Computer Vision A. Bobick. Motion and Optic Flow. Stereo Matching

Recap: Features and filters. Recap: Grouping & fitting. Now: Multiple views 10/29/2008. Epipolar geometry & stereo vision. Why multiple views?

Multiple View Geometry

Lecture 9 & 10: Stereo Vision

Structure from motion

Lecture 6 Stereo Systems Multi- view geometry Professor Silvio Savarese Computational Vision and Geometry Lab Silvio Savarese Lecture 6-24-Jan-15

Lecture 10: Multi view geometry

There are many cues in monocular vision which suggests that vision in stereo starts very early from two similar 2D images. Lets see a few...

Stereo Vision Computer Vision (Kris Kitani) Carnegie Mellon University

Dense 3D Reconstruction. Christiano Gava

Project 2 due today Project 3 out today. Readings Szeliski, Chapter 10 (through 10.5)

CS 4495 Computer Vision A. Bobick. Motion and Optic Flow. Stereo Matching

Structure from Motion and Multi- view Geometry. Last lecture

Camera Calibration. Schedule. Jesus J Caban. Note: You have until next Monday to let me know. ! Today:! Camera calibration

Lecture 9: Epipolar Geometry

Colorado School of Mines. Computer Vision. Professor William Hoff Dept of Electrical Engineering &Computer Science.

Structure from motion

Two-view geometry Computer Vision Spring 2018, Lecture 10

Multiple View Geometry

Lecture 14: Computer Vision

Announcements. Stereo

Geometric camera models and calibration

Epipolar Geometry and Stereo Vision

Image Based Reconstruction II

Chaplin, Modern Times, 1936

55:148 Digital Image Processing Chapter 11 3D Vision, Geometry

Dense 3D Reconstruction. Christiano Gava

Lecture 10: Multi-view geometry

What have we leaned so far?

Lecture 14: Basic Multi-View Geometry

Stereo and Epipolar geometry

Epipolar Geometry and Stereo Vision

Undergrad HTAs / TAs. Help me make the course better! HTA deadline today (! sorry) TA deadline March 21 st, opens March 15th

Announcements. Stereo

Computer Vision Projective Geometry and Calibration. Pinhole cameras

Perception II: Pinhole camera and Stereo Vision

Stereo: Disparity and Matching

Recap from Previous Lecture

Machine vision. Summary # 11: Stereo vision and epipolar geometry. u l = λx. v l = λy

Introduction à la vision artificielle X

Rigid Body Motion and Image Formation. Jana Kosecka, CS 482

calibrated coordinates Linear transformation pixel coordinates

Rectification and Disparity

1 (5 max) 2 (10 max) 3 (20 max) 4 (30 max) 5 (10 max) 6 (15 extra max) total (75 max + 15 extra)

Index. 3D reconstruction, point algorithm, point algorithm, point algorithm, point algorithm, 253

Index. 3D reconstruction, point algorithm, point algorithm, point algorithm, point algorithm, 263

Camera Model and Calibration

EE795: Computer Vision and Intelligent Systems

Unit 3 Multiple View Geometry

Public Library, Stereoscopic Looking Room, Chicago, by Phillips, 1923

More Mosaic Madness. CS194: Image Manipulation & Computational Photography. Steve Seitz and Rick Szeliski. Jeffrey Martin (jeffrey-martin.

3D Geometry and Camera Calibration

EECS 442 Computer vision. Stereo systems. Stereo vision Rectification Correspondence problem Active stereo vision systems

Fundamental matrix. Let p be a point in left image, p in right image. Epipolar relation. Epipolar mapping described by a 3x3 matrix F

Image Rectification (Stereo) (New book: 7.2.1, old book: 11.1)

CS4495/6495 Introduction to Computer Vision. 3B-L3 Stereo correspondence

Fundamentals of Stereo Vision Michael Bleyer LVA Stereo Vision

Projective Geometry and Camera Models

Computer Vision Projective Geometry and Calibration. Pinhole cameras

Stereo Vision. MAN-522 Computer Vision

Computer Vision CS 776 Fall 2018

Homogeneous Coordinates. Lecture18: Camera Models. Representation of Line and Point in 2D. Cross Product. Overall scaling is NOT important.

Camera Model and Calibration. Lecture-12

But First: Multi-View Projective Geometry

CS 664 Slides #9 Multi-Camera Geometry. Prof. Dan Huttenlocher Fall 2003

Epipolar Geometry Prof. D. Stricker. With slides from A. Zisserman, S. Lazebnik, Seitz

Epipolar Geometry in Stereo, Motion and Object Recognition

Binocular Stereo Vision. System 6 Introduction Is there a Wedge in this 3D scene?

Miniature faking. In close-up photo, the depth of field is limited.

3D Computer Vision. Depth Cameras. Prof. Didier Stricker. Oliver Wasenmüller

55:148 Digital Image Processing Chapter 11 3D Vision, Geometry

Step-by-Step Model Buidling

Pinhole Camera Model 10/05/17. Computational Photography Derek Hoiem, University of Illinois

Transcription:

Cameras and Stereo CSE 455 Linda Shapiro 1

Müller-Lyer Illusion http://www.michaelbach.de/ot/sze_muelue/index.html What do you know about perspective projection? Vertical lines? Other lines? 2

Image formation Object Film Let s design a camera Idea 1: put a piece of film in front of an object Do we get a reasonable image? 3

Pinhole camera Object Barrier Film 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? 4

Adding a lens circle of confusion 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 Changing the shape of the lens changes this distance 5

Lenses F optical center (Center Of Projection) focal point A lens focuses parallel rays onto a single focal point focal point at a distance f beyond the plane of the lens f is a function of the shape and index of refraction of the lens Aperture of diameter D restricts the range of rays aperture may be on either side of the lens Lenses are typically spherical (easier to produce) Real cameras use many lenses together (to correct for aberrations) 6

Thin lenses Thin lens equation: Any object point satisfying this equation is in focus 7

Digital camera A digital camera replaces film with a sensor array Each cell in the array is a Charge Coupled Device (CCD) light-sensitive diode that converts photons to electrons CMOS is becoming more popular (esp. in cell phones) http://electronics.howstuffworks.com/digital-camera.htm 8

Issues with digital cameras Noise big difference between consumer vs. SLR-style cameras low light is where you most notice noise Compression creates artifacts except in uncompressed formats (tiff, raw) Color color fringing artifacts from Bayer patterns Blooming charge overflowing into neighboring pixels In-camera processing oversharpening can produce halos Interlaced vs. progressive scan video even/odd rows from different exposures Are more megapixels better? requires higher quality lens noise issues Stabilization compensate for camera shake (mechanical vs. electronic) More info online, e.g., http://electronics.howstuffworks.com/digital-camera.htm http://www.dpreview.com/ 9

Projection Mapping from the world (3d) to an image (2d) Can we have a 1-to-1 mapping? How many possible mappings are there? An optical system defines a particular projection. We ll talk about 2: 1. Perspective projection (how we see normally ) 2. Orthographic projection (e.g., telephoto lenses) 10

Modeling projection C 3D point negative z axis The coordinate system We will use the pin-hole model as an approximation Put the optical center (Center Of Projection) at the origin Put the image plane (Projection Plane) in front of the COP The camera looks down the negative z axis we need this if we want right-handed-coordinates 11

Modeling projection x/z = x /-d x = -d(x/z) Projection equations Compute intersection with PP of ray from (x,y,z) to COP Derived using similar triangles We get the projection by throwing out the last coordinate: (x,y ) 12

Homogeneous coordinates Is this a linear transformation? no division by z is nonlinear Trick: add one more coordinate: homogeneous image coordinates homogeneous scene coordinates Converting from homogeneous coordinates 13

Perspective Projection Projection is a matrix multiply using homogeneous coordinates: projection matrix 3D point divide by third coordinate 2D point This is known as perspective projection The matrix is the projection matrix 14

Perspective Projection Example 1. Object point at (10, 6, 4), d=2 2. Object point at (25, 15, 10) Perspective projection is not 1-to-1! 15

Perspective Projection How does scaling the projection matrix change the transformation? SAME 16

Perspective Projection What happens to parallel lines? What happens to angles? What happens to distances? 17

Perspective Projection What happens when d? 18

Orthographic projection Special case of perspective projection Distance from the COP to the PP is infinite Image World Good approximation for telephoto optics Also called parallel projection : (x, y, z) (x, y) What s the projection matrix? 19

Orthographic Projection What happens to parallel lines? What happens to angles? What happens to distances? 20

Camera parameters How many numbers do we need to describe a camera? We need to describe its pose in the world We need to describe its internal parameters 21

A Tale of Two Coordinate Systems v y w COP Camera Two important coordinate systems: 1. World coordinate system 2. Camera coordinate system u z o The World x 22

Camera parameters To project a point (x,y,z) in world coordinates into a camera First transform (x,y,z) into camera coordinates Need to know Camera position (in world coordinates) Camera orientation (in world coordinates) Then project into the image plane Need to know camera intrinsics These can all be described with matrices 23

3D Translation 3D translation is just like 2D with one more coordinate x 1 0 0 tx x y = 0 1 0 ty y z 0 0 1 tz z 1 0 0 0 1 1 = [x+tx, y+ty, z+tz, 1] T 24

3D Rotation (just the 3 x 3 part shown) About X axis: 1 0 0 About Y: cosθ 0 sinθ 0 cosθ sinθ 0 1 0 0 sinθ cosθ -sinθ 0 cosθ About Z axis: cosθ sinθ 0 sinθ cosθ 0 0 0 1 General (orthonormal) rotation matrix used in practice: r11 r12 r13 r21 r22 r23 r31 r32 r33 25

Camera parameters A camera is described by several parameters Translation T of the optical center from the origin of world coords Rotation R of the image plane focal length f, principal point (x c, y c ), pixel size (s x, s y ) blue parameters are called extrinsics, red are intrinsics Projection equation The projection matrix models the cumulative effect of all parameters Useful to decompose into a series of operations identity matrix [tx, ty, tz] T intrinsics projection rotation translation The definitions of these parameters are not completely standardized especially intrinsics varies from one book to another 26

Extrinsics How do we get the camera to canonical form? (Center of projection at the origin, x-axis points right, y-axis points up, z-axis points backwards) Step 1: Translate by -c 0 image plane camera 27

Extrinsics How do we get the camera to canonical form? (Center of projection at the origin, x-axis points right, y-axis points up, z-axis points backwards) Step 1: Translate by -c How do we represent translation as a matrix multiplication? 0 28

Extrinsics How do we get the camera to canonical form? (Center of projection at the origin, x-axis points right, y-axis points up, z-axis points backwards) Step 1: Translate by -c Step 2: Rotate by R 0 3x3 rotation matrix 29

Extrinsics How do we get the camera to canonical form? (Center of projection at the origin, x-axis points right, y-axis points up, z-axis points backwards) Step 1: Translate by -c Step 2: Rotate by R 0 30

Perspective projection (intrinsics) (converts from 3D rays in camera coordinate system to pixel coordinates) in general, f is the focal length of the camera : aspect ratio (1 unless pixels are not square) : skew (0 unless pixels are shaped like rhombi/parallelograms) : principal point ((0,0) unless optical axis doesn t intersect projection plane at origin) 31

Focal length Can think of as zoom 24mm 50mm 200mm Related to field of view 800mm 32

Projection matrix intrinsics projection rotation translation 33

Projection matrix arbitrary 3D point = image plane 0 (in homogeneous image coordinates) 34

Distortion No distortion Pin cushion Barrel Radial distortion of the image Caused by imperfect lenses Deviations are most noticeable for rays that pass through the edge of the lens 35

Correcting radial distortion from Helmut Dersch 36

Where does all this lead? We need it to understand stereo And 3D reconstruction It also leads into camera calibration, which is usually done in factory settings to solve for the camera parameters before performing an industrial task. The extrinsic parameters must be determined. Some of the intrinsic are given, some are solved for, some are improved. 37

Camera Calibration The idea is to snap images at different depths and get a lot of 2D-3D point correspondences. x1, y1, z1, u1, v1 x2, y2, z1, u2, v2.. xn, yn, zn, un, vn Then solve a system of equations to get camera parameters. 38

Stereo CSE 455 Linda Shapiro 39

40

Amount of horizontal movement is inversely proportional to the distance from the camera 41

Depth from Stereo Goal: recover depth by finding image coordinate x that corresponds to x X X x x x z x' f f C Baseline B C 42

Depth from disparity X x O x O = f z x x z f f O Baseline O B disparity = x x B f = z Disparity is inversely proportional to depth. 43

Depth from Stereo Goal: recover depth by finding image coordinate x that corresponds to x Sub-Problems 1. Calibration: How do we recover the relation of the cameras (if not already known)? 2. Correspondence: How do we search for the matching point x? X x x' 44

Correspondence Problem x? We have two images taken from cameras with different intrinsic and extrinsic parameters How do we match a point in the first image to a point in the second? How can we constrain our search? 45

Key idea: Epipolar constraint X X X x x x x Potential matches for x have to lie on the corresponding line l. Potential matches for x have to lie on the corresponding line l. 46

Epipolar geometry: notation X x x Baseline line connecting the two camera centers Epipoles = intersections of baseline with image planes = projections of the other camera center Epipolar Plane plane containing baseline (1D family) 47

Epipolar geometry: notation X x x Baseline line connecting the two camera centers Epipoles = intersections of baseline with image planes = projections of the other camera center Epipolar Plane plane containing baseline (1D family) Epipolar Lines - intersections of epipolar plane with image planes (always come in corresponding pairs) 48

Example: Converging cameras 49

Example: Motion parallel to image plane 50

Epipolar constraint X x x If we observe a point x in one image, where can the corresponding point x be in the other image? 51

Epipolar constraint X X X x x x x Potential matches for x have to lie on the corresponding epipolar line l. Potential matches for x have to lie on the corresponding epipolar line l. 52

Epipolar constraint example 53

Epipolar constraint: Calibrated case X x x Assume that the intrinsic and extrinsic parameters of the cameras are known We can multiply the projection matrix of each camera (and the image points) by the inverse of the calibration matrix to get normalized image coordinates We can also set the global coordinate system to the coordinate system of the first camera. Then the projection matrices of the two cameras can be written as [I 0] and [R t] 54

Simplified Matrices for the 2 Cameras = (R T) 55

Epipolar constraint: Calibrated case X = (x,1) T x x = Rx+t t R The vectors Rx, t, and x are coplanar 56

Epipolar constraint: Calibrated case X x x x [ t ( Rx)] = 0 x T E x = with E = [ t ] R 0 Essential Matrix E (Longuet-Higgins, 1981) The vectors Rx, t, and x are coplanar 57

Epipolar constraint: Calibrated case X x x x [ t ( Rx)] = 0 x T E x = with E = [ t ] R 0 E x is the epipolar line associated with x (l' = E x) E T x' is the epipolar line associated with x' (l = E T x') E e = 0 and E T e' = 0 E is singular (rank two) E has five degrees of freedom 58

Epipolar constraint: Uncalibrated case X x x The calibration matrices K and K of the two cameras are unknown We can write the epipolar constraint in terms of unknown normalized coordinates: ˆ E xˆ = x T 0 ˆ 1 1 x = K x, xˆ = K xˆ 59

Epipolar constraint: Uncalibrated case X x x xˆ T E xˆ = 0 T = 0 with = T x F x F K E K 1 xˆ xˆ = = K K 1 1 x x Fundamental Matrix (Faugeras and Luong, 1992) 60

Epipolar constraint: Uncalibrated case X x x xˆ T T E xˆ = 0 = 0 with = T x F x F K E K 1 F x is the epipolar line associated with x (l' = F x) F T x' is the epipolar line associated with x' (l' = F T x') F e = 0 and F T e' = 0 61

The eight-point algorithm T x = ( u, v,1), x = ( u, v,1) f f 11 u 1 [ v 1] f f f v = 0 f 12 f 13 u 21 22 23 [ u u u v u v u v v v u v 1] f 22 = 0 31 f32 f f 33 A 23 Minimize: N T 2 ( x i F xi ) i= 1 under the constraint F 2 =1 Smallest eigenvalue of A T A f f f f f f f 11 12 13 21 31 32 33 62

Comparison of estimation algorithms 8-point Normalized 8-point Nonlinear least squares Av. Dist. 1 2.33 pixels 0.92 pixel 0.86 pixel Av. Dist. 2 2.18 pixels 0.85 pixel 0.80 pixel 63

Moving on to stereo Fuse a calibrated binocular stereo pair to produce a depth image image 1 image 2 Dense depth map Many of these slides adapted from 64 Steve Seitz and Lana Lazebnik

Depth from disparity X x O x O = f z x x z f f O Baseline O B disparity = x x B f = z Disparity is inversely proportional to depth. 65

Basic stereo matching algorithm If necessary, rectify the two stereo images to transform epipolar lines into scanlines For each pixel x in the first image Find corresponding epipolar scanline in the right image Search the scanline and pick the best match x Compute disparity x-x and set depth(x) = fb/(x-x ) 66

Simplest Case: Parallel images R t E E x x T = =, 0 = = 0 0 0 0 0 0 0 T T R t E Epipolar constraint: ( ) ( ) v T Tv Tv T v u v u T T v u = = = 0 0 1 0 1 0 0 0 0 0 0 0 1 R = I t = (T, 0, 0) The y-coordinates of corresponding points are the same t x x 68

Stereo image rectification 69

Stereo image rectification Reproject image planes onto a common plane parallel to the line between camera centers Pixel motion is horizontal after this transformation Two homographies (3x3 transform), one for each input image reprojection C. Loop and Z. Zhang. Computing Rectifying Homographies for Stereo Vision. IEEE Conf. Computer Vision and Pattern Recognition, 1999. 70

Example Unrectified Rectified 71

Left Right scanline Matching cost disparity Slide a window along the right scanline and compare contents of that window with the reference window in the left image Matching cost: SSD, SAD, or normalized correlation 72

Correspondence search Left Right scanline SSD 73

Correspondence search Left Right scanline Norm. corr 74

Effect of window size Smaller window + More detail More noise W = 3 W = 20 Larger window + Smoother disparity maps Less detail Fails near boundaries 75

Failures of correspondence search Textureless surfaces Occlusions, repetition Non-Lambertian surfaces, specularities 76

Results with window search Data Window-based matching Ground truth 77

How can we improve window-based matching? So far, matches are independent for each point What constraints or priors can we add? 78

Stereo constraints/priors Uniqueness For any point in one image, there should be at most one matching point in the other image 79

Stereo constraints/priors Uniqueness For any point in one image, there should be at most one matching point in the other image Ordering Corresponding points should be in the same order in both views 80

Stereo constraints/priors Uniqueness For any point in one image, there should be at most one matching point in the other image Ordering Corresponding points should be in the same order in both views 81 Ordering constraint doesn t hold

Priors and constraints Uniqueness For any point in one image, there should be at most one matching point in the other image Ordering Corresponding points should be in the same order in both views Smoothness We expect disparity values to change slowly (for the most part) 82

Stereo as energy minimization What defines a good stereo correspondence? 1. Match quality Want each pixel to find a good match in the other image 2. Smoothness 83

Matching windows: Similarity Measure Formula Sum of Absolute Differences (SAD) Sum of Squared Differences (SSD) Zero-mean SAD Locally scaled SAD Normalized Cross Correlation (NCC) SAD SSD NCC Ground truth 84 http://siddhantahuja.wordpress.com/category/stereo-vision/

Real-time stereo Nomad robot searches for meteorites in Antartica http://www.frc.ri.cmu.edu/projects/meteorobot/index.html Used for robot navigation (and other tasks) Several software-based real-time stereo 85

Stereo reconstruction pipeline Steps Calibrate cameras Rectify images Compute disparity Estimate depth What will cause errors? Camera calibration errors Poor image resolution Occlusions Violations of brightness constancy (specular reflections) Large motions Low-contrast image regions 86

Multi-view stereo? 87

Using more than two images Multi-View Stereo for Community Photo Collections M. Goesele, N. Snavely, B. Curless, H. Hoppe, S. Seitz Proceedings of ICCV 2007, 88