Top Banner
Texts in Computer Science Editors David Gries Fred B. Schneider For further volumes: www.springer.com/series/3191
18

Texts in Computer Sciencelink.springer.com/content/pdf/bfm:978-1-84882-935-0/1.pdfapplications of computer vision to fun problems such as image stitching and photo-based 3D modeling

Jul 19, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Texts in Computer Sciencelink.springer.com/content/pdf/bfm:978-1-84882-935-0/1.pdfapplications of computer vision to fun problems such as image stitching and photo-based 3D modeling

Texts in Computer Science

EditorsDavid GriesFred B. Schneider

For further volumes:www.springer.com/series/3191

Page 2: Texts in Computer Sciencelink.springer.com/content/pdf/bfm:978-1-84882-935-0/1.pdfapplications of computer vision to fun problems such as image stitching and photo-based 3D modeling

123

Richard Szeliski

Computer Vision

Algorithms and Applications

Page 3: Texts in Computer Sciencelink.springer.com/content/pdf/bfm:978-1-84882-935-0/1.pdfapplications of computer vision to fun problems such as image stitching and photo-based 3D modeling

Dr. Richard Szeliski

Series EditorsDavid GriesDepartment of Computer ScienceUpson HallCornell UniversityIthaca, NY 14853-7501, USA

Fred B. SchneiderDepartment of Computer ScienceUpson HallCornell UniversityIthaca, NY 14853-7501, USA

98052-6399 [email protected]

British Library Cataloguing in Publication DataA catalogue record for this book is available from the British Library

Apart from any fair dealing for the purposes of research or private study, or criticism or review, as

stored or transmitted, in any form or by any means, with the prior permission in writing of thepublishers, or in the case of reprographic reproduction in accordance with the terms of licenses issued bythe Copyright Licensing Agency. Enquiries concerning reproduction outside those terms should be sentto the publishers.

permitted under the Copyright, Designs and Patents Act 1988, this publication may only be reproduced,

The use of registered names, trademarks, etc., in this publication does not imply, even in the absence of aspecific statement, that such names are exempt from the relevant laws and regulations and therefore freefor general use.The publisher makes no representation, express or implied, with regard to the accuracy of the informationcontained in this book and cannot accept any legal responsibility or liability for any errors or omissionsthat may be made.

Printed on acid-free paper

DOI 10.1007/978-1-84882-935-0

ISSN 1868-0941 e-ISSN 1868-095XISBN 978-1-84882-934-3 e-ISBN 978-1-84882-935-0

Microsoft Research

Springer London Dordrecht Heidelberg New York

Library of Congress Control Number: 2010936817

One Microsoft Way

Springer is part of Springer Science+Business Media (www.springer.com)

© Springer-Verlag London Limited 2011

Page 4: Texts in Computer Sciencelink.springer.com/content/pdf/bfm:978-1-84882-935-0/1.pdfapplications of computer vision to fun problems such as image stitching and photo-based 3D modeling

This book is dedicated to my parents,

Zdzisław and Jadwiga,

and my family,

Lyn, Anne, and Stephen.

Page 5: Texts in Computer Sciencelink.springer.com/content/pdf/bfm:978-1-84882-935-0/1.pdfapplications of computer vision to fun problems such as image stitching and photo-based 3D modeling

1 Introduction 1

What is computer vision? • A brief history •Book overview • Sample syllabus • Notation

n 2 Image formation 27

Geometric primitives and transformations •Photometric image formation •

The digital camera

3 Image processing 87

Point operators • Linear filtering •More neighborhood operators • Fourier transforms •

Pyramids and wavelets • Geometric transformations •Global optimization

4 Feature detection and matching 181

Points and patches •Edges • Lines

5 Segmentation 235

Active contours • Split and merge •Mean shift and mode finding • Normalized cuts •

Graph cuts and energy-based methods

6 Feature-based alignment 273

2D and 3D feature-based alignment •Pose estimation •

Geometric intrinsic calibration

7 Structure from motion 303

Triangulation • Two-frame structure from motion •Factorization • Bundle adjustment •

Constrained structure and motion

Page 6: Texts in Computer Sciencelink.springer.com/content/pdf/bfm:978-1-84882-935-0/1.pdfapplications of computer vision to fun problems such as image stitching and photo-based 3D modeling

8 Dense motion estimation 335

Translational alignment • Parametric motion •Spline-based motion • Optical flow •

Layered motion

9 Image stitching 375

Motion models • Global alignment •Compositing

10 Computational photography 409

Photometric calibration • High dynamic range imaging •Super-resolution and blur removal •Image matting and compositing •

Texture analysis and synthesis

11 Stereo correspondence 467

Epipolar geometry • Sparse correspondence •Dense correspondence • Local methods •

Global optimization • Multi-view stereo

12 3D reconstruction 505

Shape from X • Active rangefinding •Surface representations • Point-based representations •

Volumetric representations • Model-based reconstruction •Recovering texture maps and albedos

13 Image-based rendering 543

View interpolation • Layered depth images •Light fields and Lumigraphs • Environment mattes •

Video-based rendering

14 Recognition 575

Object detection • Face recognition •Instance recognition • Category recognition •

Context and scene understanding •Recognition databases and test sets

Page 7: Texts in Computer Sciencelink.springer.com/content/pdf/bfm:978-1-84882-935-0/1.pdfapplications of computer vision to fun problems such as image stitching and photo-based 3D modeling

Preface

The seeds for this book were first planted in 2001 when Steve Seitz at the University of Wash-ington invited me to co-teach a course called “Computer Vision for Computer Graphics”. Atthat time, computer vision techniques were increasingly being used in computer graphics tocreate image-based models of real-world objects, to create visual effects, and to merge real-world imagery using computational photography techniques. Our decision to focus on theapplications of computer vision to fun problems such as image stitching and photo-based 3Dmodeling from personal photos seemed to resonate well with our students.

Since that time, a similar syllabus and project-oriented course structure has been used toteach general computer vision courses both at the University of Washington and at Stanford.(The latter was a course I co-taught with David Fleet in 2003.) Similar curricula have beenadopted at a number of other universities and also incorporated into more specialized courseson computational photography. (For ideas on how to use this book in your own course, pleasesee Table 1.1 in Section 1.4.)

This book also reflects my 20 years’ experience doing computer vision research in corpo-rate research labs, mostly at Digital Equipment Corporation’s Cambridge Research Lab andat Microsoft Research. In pursuing my work, I have mostly focused on problems and solu-tion techniques (algorithms) that have practical real-world applications and that work well inpractice. Thus, this book has more emphasis on basic techniques that work under real-worldconditions and less on more esoteric mathematics that has intrinsic elegance but less practicalapplicability.

This book is suitable for teaching a senior-level undergraduate course in computer visionto students in both computer science and electrical engineering. I prefer students to haveeither an image processing or a computer graphics course as a prerequisite so that they canspend less time learning general background mathematics and more time studying computervision techniques. The book is also suitable for teaching graduate-level courses in computervision (by delving into the more demanding application and algorithmic areas) and as a gen-eral reference to fundamental techniques and the recent research literature. To this end, I haveattempted wherever possible to at least cite the newest research in each sub-field, even if thetechnical details are too complex to cover in the book itself.

In teaching our courses, we have found it useful for the students to attempt a number ofsmall implementation projects, which often build on one another, in order to get them used toworking with real-world images and the challenges that these present. The students are thenasked to choose an individual topic for each of their small-group, final projects. (Sometimesthese projects even turn into conference papers!) The exercises at the end of each chaptercontain numerous suggestions for smaller mid-term projects, as well as more open-ended

Page 8: Texts in Computer Sciencelink.springer.com/content/pdf/bfm:978-1-84882-935-0/1.pdfapplications of computer vision to fun problems such as image stitching and photo-based 3D modeling

problems whose solutions are still active research topics. Wherever possible, I encouragestudents to try their algorithms on their own personal photographs, since this better motivatesthem, often leads to creative variants on the problems, and better acquaints them with thevariety and complexity of real-world imagery.

In formulating and solving computer vision problems, I have often found it useful to drawinspiration from three high-level approaches:

• Scientific: build detailed models of the image formation process and develop mathe-matical techniques to invert these in order to recover the quantities of interest (wherenecessary, making simplifying assumption to make the mathematics more tractable).

• Statistical: use probabilistic models to quantify the prior likelihood of your unknownsand the noisy measurement processes that produce the input images, then infer the bestpossible estimates of your desired quantities and analyze their resulting uncertainties.The inference algorithms used are often closely related to the optimization techniquesused to invert the (scientific) image formation processes.

• Engineering: develop techniques that are simple to describe and implement but thatare also known to work well in practice. Test these techniques to understand theirlimitation and failure modes, as well as their expected computational costs (run-timeperformance).

These three approaches build on each other and are used throughout the book.My personal research and development philosophy (and hence the exercises in the book)

have a strong emphasis on testing algorithms. It’s too easy in computer vision to develop analgorithm that does something plausible on a few images rather than something correct. Thebest way to validate your algorithms is to use a three-part strategy.

First, test your algorithm on clean synthetic data, for which the exact results are known.Second, add noise to the data and evaluate how the performance degrades as a function ofnoise level. Finally, test the algorithm on real-world data, preferably drawn from a widevariety of sources, such as photos found on the Web. Only then can you truly know if youralgorithm can deal with real-world complexity, i.e., images that do not fit some simplifiedmodel or assumptions.

In order to help students in this process, this books comes with a large amount of supple-mentary material, which can be found on the book’s Web site http://szeliski.org/Book. Thismaterial, which is described in Appendix C, includes:

• pointers to commonly used data sets for the problems, which can be found on the Web

• pointers to software libraries, which can help students get started with basic tasks suchas reading/writing images or creating and manipulating images

• slide sets corresponding to the material covered in this book

• a BibTeX bibliography of the papers cited in this book.

The latter two resources may be of more interest to instructors and researchers publishingnew papers in this field, but they will probably come in handy even with regular students.Some of the software libraries contain implementations of a wide variety of computer visionalgorithms, which can enable you to tackle more ambitious projects (with your instructor’sconsent).

x

Page 9: Texts in Computer Sciencelink.springer.com/content/pdf/bfm:978-1-84882-935-0/1.pdfapplications of computer vision to fun problems such as image stitching and photo-based 3D modeling

Preface

Acknowledgements

I would like to gratefully acknowledge all of the people whose passion for research andinquiry as well as encouragement have helped me write this book.

Steve Zucker at McGill University first introduced me to computer vision, taught all ofhis students to question and debate research results and techniques, and encouraged me topursue a graduate career in this area.

Takeo Kanade and Geoff Hinton, my Ph. D. thesis advisors at Carnegie Mellon University,taught me the fundamentals of good research, writing, and presentation. They fired up myinterest in visual processing, 3D modeling, and statistical methods, while Larry Matthiesintroduced me to Kalman filtering and stereo matching.

Demetri Terzopoulos was my mentor at my first industrial research job and taught me theropes of successful publishing. Yvan Leclerc and Pascal Fua, colleagues from my brief in-terlude at SRI International, gave me new perspectives on alternative approaches to computervision.

During my six years of research at Digital Equipment Corporation’s Cambridge ResearchLab, I was fortunate to work with a great set of colleagues, including Ingrid Carlbom, GudrunKlinker, Keith Waters, Richard Weiss, Stephane Lavallee, and Sing Bing Kang, as well as tosupervise the first of a long string of outstanding summer interns, including David Tonnesen,Sing Bing Kang, James Coughlan, and Harry Shum. This is also where I began my long-termcollaboration with Daniel Scharstein, now at Middlebury College.

At Microsoft Research, I’ve had the outstanding fortune to work with some of the world’sbest researchers in computer vision and computer graphics, including Michael Cohen, HuguesHoppe, Stephen Gortler, Steve Shafer, Matthew Turk, Harry Shum, Anandan, Phil Torr, An-tonio Criminisi, Georg Petschnigg, Kentaro Toyama, Ramin Zabih, Shai Avidan, Sing BingKang, Matt Uyttendaele, Patrice Simard, Larry Zitnick, Richard Hartley, Simon Winder,Drew Steedly, Chris Pal, Nebojsa Jojic, Patrick Baudisch, Dani Lischinski, Matthew Brown,Simon Baker, Michael Goesele, Eric Stollnitz, David Nister, Blaise Aguera y Arcas, SudiptaSinha, Johannes Kopf, Neel Joshi, and Krishnan Ramnath. I was also lucky to have as in-terns such great students as Polina Golland, Simon Baker, Mei Han, Arno Schodl, Ron Dror,Ashley Eden, Jinxiang Chai, Rahul Swaminathan, Yanghai Tsin, Sam Hasinoff, Anat Levin,Matthew Brown, Eric Bennett, Vaibhav Vaish, Jan-Michael Frahm, James Diebel, Ce Liu,Josef Sivic, Grant Schindler, Colin Zheng, Neel Joshi, Sudipta Sinha, Zeev Farbman, RahulGarg, Tim Cho, Yekeun Jeong, Richard Roberts, Varsha Hedau, and Dilip Krishnan.

While working at Microsoft, I’ve also had the opportunity to collaborate with wonderfulcolleagues at the University of Washington, where I hold an Affiliate Professor appointment.I’m indebted to Tony DeRose and David Salesin, who first encouraged me to get involvedwith the research going on at UW, my long-time collaborators Brian Curless, Steve Seitz,Maneesh Agrawala, Sameer Agarwal, and Yasu Furukawa, as well as the students I havehad the privilege to supervise and interact with, including Frederic Pighin, Yung-Yu Chuang,Doug Zongker, Colin Zheng, Aseem Agarwala, Dan Goldman, Noah Snavely, Rahul Garg,and Ryan Kaminsky. As I mentioned at the beginning of this preface, this book owes itsinception to the vision course that Steve Seitz invited me to co-teach, as well as to Steve’sencouragement, course notes, and editorial input.

I’m also grateful to the many other computer vision researchers who have given me somany constructive suggestions about the book, including Sing Bing Kang, who was my infor-

xi

Page 10: Texts in Computer Sciencelink.springer.com/content/pdf/bfm:978-1-84882-935-0/1.pdfapplications of computer vision to fun problems such as image stitching and photo-based 3D modeling

mal book editor, Vladimir Kolmogorov, who contributed Appendix B.5.5 on linear program-ming techniques for MRF inference, Daniel Scharstein, Richard Hartley, Simon Baker, NoahSnavely, Bill Freeman, Svetlana Lazebnik, Matthew Turk, Jitendra Malik, Alyosha Efros,Michael Black, Brian Curless, Sameer Agarwal, Li Zhang, Deva Ramanan, Olga Veksler,Yuri Boykov, Carsten Rother, Phil Torr, Bill Triggs, Bruce Maxwell, Jana Kosecka, Eero Si-moncelli, Aaron Hertzmann, Antonio Torralba, Tomaso Poggio, Theo Pavlidis, Baba Vemuri,Nando de Freitas, Chuck Dyer, Song Yi, Falk Schubert, Roman Pflugfelder, Marshall Tap-pen, James Coughlan, Sammy Rogmans, Klaus Strobel, Shanmuganathan, Andreas Siebert,Yongjun Wu, Fred Pighin, Juan Cockburn, Ronald Mallet, Tim Soper, Georgios Evangelidis,Dwight Fowler, Itzik Bayaz, Daniel O’Connor, and Srikrishna Bhat. Shena Deuchers did afantastic job copy-editing the book and suggesting many useful improvements and WayneWheeler and Simon Rees at Springer were most helpful throughout the whole book pub-lishing process. Keith Price’s Annotated Computer Vision Bibliography was invaluable intracking down references and finding related work.

If you have any suggestions for improving the book, please send me an e-mail, as I wouldlike to keep the book as accurate, informative, and timely as possible.

Lastly, this book would not have been possible or worthwhile without the incredible sup-port and encouragement of my family. I dedicate this book to my parents, Zdzisław andJadwiga, whose love, generosity, and accomplishments have always inspired me; to my sis-ter Basia for her lifelong friendship; and especially to Lyn, Anne, and Stephen, whose dailyencouragement in all matters (including this book project) makes it all worthwhile.

Lake WenatcheeAugust, 2010

xii

Page 11: Texts in Computer Sciencelink.springer.com/content/pdf/bfm:978-1-84882-935-0/1.pdfapplications of computer vision to fun problems such as image stitching and photo-based 3D modeling

Contents

Preface vii

1 Introduction 1

1.1 What is computer vision? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.2 A brief history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101.3 Book overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171.4 Sample syllabus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231.5 A note on notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251.6 Additional reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

2 Image formation 27

2.1 Geometric primitives and transformations . . . . . . . . . . . . . . . . . . . 292.1.1 Geometric primitives . . . . . . . . . . . . . . . . . . . . . . . . . . 292.1.2 2D transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . 332.1.3 3D transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . 362.1.4 3D rotations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372.1.5 3D to 2D projections . . . . . . . . . . . . . . . . . . . . . . . . . . 422.1.6 Lens distortions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

2.2 Photometric image formation . . . . . . . . . . . . . . . . . . . . . . . . . . 542.2.1 Lighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542.2.2 Reflectance and shading . . . . . . . . . . . . . . . . . . . . . . . . 552.2.3 Optics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

2.3 The digital camera . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 652.3.1 Sampling and aliasing . . . . . . . . . . . . . . . . . . . . . . . . . 692.3.2 Color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 712.3.3 Compression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

2.4 Additional reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 822.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

3 Image processing 87

3.1 Point operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 893.1.1 Pixel transforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . 913.1.2 Color transforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . 923.1.3 Compositing and matting . . . . . . . . . . . . . . . . . . . . . . . . 923.1.4 Histogram equalization . . . . . . . . . . . . . . . . . . . . . . . . . 94

Page 12: Texts in Computer Sciencelink.springer.com/content/pdf/bfm:978-1-84882-935-0/1.pdfapplications of computer vision to fun problems such as image stitching and photo-based 3D modeling

Contents

3.1.5 Application: Tonal adjustment . . . . . . . . . . . . . . . . . . . . . 973.2 Linear filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

3.2.1 Separable filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . 1023.2.2 Examples of linear filtering . . . . . . . . . . . . . . . . . . . . . . . 1033.2.3 Band-pass and steerable filters . . . . . . . . . . . . . . . . . . . . . 104

3.3 More neighborhood operators . . . . . . . . . . . . . . . . . . . . . . . . . . 1083.3.1 Non-linear filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . 1083.3.2 Morphology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1123.3.3 Distance transforms . . . . . . . . . . . . . . . . . . . . . . . . . . 1133.3.4 Connected components . . . . . . . . . . . . . . . . . . . . . . . . . 115

3.4 Fourier transforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1163.4.1 Fourier transform pairs . . . . . . . . . . . . . . . . . . . . . . . . . 1193.4.2 Two-dimensional Fourier transforms . . . . . . . . . . . . . . . . . . 1233.4.3 Wiener filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1233.4.4 Application: Sharpening, blur, and noise removal . . . . . . . . . . . 126

3.5 Pyramids and wavelets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1273.5.1 Interpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1273.5.2 Decimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1303.5.3 Multi-resolution representations . . . . . . . . . . . . . . . . . . . . 1323.5.4 Wavelets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1363.5.5 Application: Image blending . . . . . . . . . . . . . . . . . . . . . . 140

3.6 Geometric transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . 1433.6.1 Parametric transformations . . . . . . . . . . . . . . . . . . . . . . . 1453.6.2 Mesh-based warping . . . . . . . . . . . . . . . . . . . . . . . . . . 1493.6.3 Application: Feature-based morphing . . . . . . . . . . . . . . . . . 152

3.7 Global optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1533.7.1 Regularization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1543.7.2 Markov random fields . . . . . . . . . . . . . . . . . . . . . . . . . 1583.7.3 Application: Image restoration . . . . . . . . . . . . . . . . . . . . . 169

3.8 Additional reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1693.9 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171

4 Feature detection and matching 181

4.1 Points and patches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1834.1.1 Feature detectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1854.1.2 Feature descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . 1964.1.3 Feature matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2004.1.4 Feature tracking . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2074.1.5 Application: Performance-driven animation . . . . . . . . . . . . . . 209

4.2 Edges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2104.2.1 Edge detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2104.2.2 Edge linking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2154.2.3 Application: Edge editing and enhancement . . . . . . . . . . . . . . 219

4.3 Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2204.3.1 Successive approximation . . . . . . . . . . . . . . . . . . . . . . . 2204.3.2 Hough transforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221

xiv

Page 13: Texts in Computer Sciencelink.springer.com/content/pdf/bfm:978-1-84882-935-0/1.pdfapplications of computer vision to fun problems such as image stitching and photo-based 3D modeling

Contents

4.3.3 Vanishing points . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2244.3.4 Application: Rectangle detection . . . . . . . . . . . . . . . . . . . . 226

4.4 Additional reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2274.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228

5 Segmentation 235

5.1 Active contours . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2375.1.1 Snakes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2385.1.2 Dynamic snakes and CONDENSATION . . . . . . . . . . . . . . . . 2435.1.3 Scissors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2465.1.4 Level Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2485.1.5 Application: Contour tracking and rotoscoping . . . . . . . . . . . . 249

5.2 Split and merge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2505.2.1 Watershed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2515.2.2 Region splitting (divisive clustering) . . . . . . . . . . . . . . . . . . 2515.2.3 Region merging (agglomerative clustering) . . . . . . . . . . . . . . 2515.2.4 Graph-based segmentation . . . . . . . . . . . . . . . . . . . . . . . 2525.2.5 Probabilistic aggregation . . . . . . . . . . . . . . . . . . . . . . . . 253

5.3 Mean shift and mode finding . . . . . . . . . . . . . . . . . . . . . . . . . . 2545.3.1 K-means and mixtures of Gaussians . . . . . . . . . . . . . . . . . . 2565.3.2 Mean shift . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257

5.4 Normalized cuts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2605.5 Graph cuts and energy-based methods . . . . . . . . . . . . . . . . . . . . . 264

5.5.1 Application: Medical image segmentation . . . . . . . . . . . . . . . 2685.6 Additional reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2685.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270

6 Feature-based alignment 273

6.1 2D and 3D feature-based alignment . . . . . . . . . . . . . . . . . . . . . . 2756.1.1 2D alignment using least squares . . . . . . . . . . . . . . . . . . . . 2756.1.2 Application: Panography . . . . . . . . . . . . . . . . . . . . . . . . 2776.1.3 Iterative algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . 2786.1.4 Robust least squares and RANSAC . . . . . . . . . . . . . . . . . . 2816.1.5 3D alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283

6.2 Pose estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2846.2.1 Linear algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2846.2.2 Iterative algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . 2866.2.3 Application: Augmented reality . . . . . . . . . . . . . . . . . . . . 287

6.3 Geometric intrinsic calibration . . . . . . . . . . . . . . . . . . . . . . . . . 2886.3.1 Calibration patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . 2896.3.2 Vanishing points . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2906.3.3 Application: Single view metrology . . . . . . . . . . . . . . . . . . 2926.3.4 Rotational motion . . . . . . . . . . . . . . . . . . . . . . . . . . . 2936.3.5 Radial distortion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295

6.4 Additional reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2966.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296

xv

Page 14: Texts in Computer Sciencelink.springer.com/content/pdf/bfm:978-1-84882-935-0/1.pdfapplications of computer vision to fun problems such as image stitching and photo-based 3D modeling

Contents

7 Structure from motion 303

7.1 Triangulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3057.2 Two-frame structure from motion . . . . . . . . . . . . . . . . . . . . . . . . 307

7.2.1 Projective (uncalibrated) reconstruction . . . . . . . . . . . . . . . . 3127.2.2 Self-calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3137.2.3 Application: View morphing . . . . . . . . . . . . . . . . . . . . . . 315

7.3 Factorization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3157.3.1 Perspective and projective factorization . . . . . . . . . . . . . . . . 3187.3.2 Application: Sparse 3D model extraction . . . . . . . . . . . . . . . 319

7.4 Bundle adjustment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3207.4.1 Exploiting sparsity . . . . . . . . . . . . . . . . . . . . . . . . . . . 3227.4.2 Application: Match move and augmented reality . . . . . . . . . . . 3247.4.3 Uncertainty and ambiguities . . . . . . . . . . . . . . . . . . . . . . 3267.4.4 Application: Reconstruction from Internet photos . . . . . . . . . . . 327

7.5 Constrained structure and motion . . . . . . . . . . . . . . . . . . . . . . . . 3297.5.1 Line-based techniques . . . . . . . . . . . . . . . . . . . . . . . . . 3307.5.2 Plane-based techniques . . . . . . . . . . . . . . . . . . . . . . . . . 331

7.6 Additional reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3327.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332

8 Dense motion estimation 335

8.1 Translational alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3378.1.1 Hierarchical motion estimation . . . . . . . . . . . . . . . . . . . . . 3418.1.2 Fourier-based alignment . . . . . . . . . . . . . . . . . . . . . . . . 3418.1.3 Incremental refinement . . . . . . . . . . . . . . . . . . . . . . . . . 345

8.2 Parametric motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3508.2.1 Application: Video stabilization . . . . . . . . . . . . . . . . . . . . 3548.2.2 Learned motion models . . . . . . . . . . . . . . . . . . . . . . . . . 354

8.3 Spline-based motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3558.3.1 Application: Medical image registration . . . . . . . . . . . . . . . . 358

8.4 Optical flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3608.4.1 Multi-frame motion estimation . . . . . . . . . . . . . . . . . . . . . 3638.4.2 Application: Video denoising . . . . . . . . . . . . . . . . . . . . . 3648.4.3 Application: De-interlacing . . . . . . . . . . . . . . . . . . . . . . 364

8.5 Layered motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3658.5.1 Application: Frame interpolation . . . . . . . . . . . . . . . . . . . . 3688.5.2 Transparent layers and reflections . . . . . . . . . . . . . . . . . . . 368

8.6 Additional reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3708.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371

9 Image stitching 375

9.1 Motion models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3789.1.1 Planar perspective motion . . . . . . . . . . . . . . . . . . . . . . . 3799.1.2 Application: Whiteboard and document scanning . . . . . . . . . . . 3799.1.3 Rotational panoramas . . . . . . . . . . . . . . . . . . . . . . . . . . 3809.1.4 Gap closing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382

xvi

Page 15: Texts in Computer Sciencelink.springer.com/content/pdf/bfm:978-1-84882-935-0/1.pdfapplications of computer vision to fun problems such as image stitching and photo-based 3D modeling

Contents

9.1.5 Application: Video summarization and compression . . . . . . . . . 3839.1.6 Cylindrical and spherical coordinates . . . . . . . . . . . . . . . . . 385

9.2 Global alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3879.2.1 Bundle adjustment . . . . . . . . . . . . . . . . . . . . . . . . . . . 3889.2.2 Parallax removal . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3919.2.3 Recognizing panoramas . . . . . . . . . . . . . . . . . . . . . . . . 3929.2.4 Direct vs. feature-based alignment . . . . . . . . . . . . . . . . . . . 393

9.3 Compositing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3969.3.1 Choosing a compositing surface . . . . . . . . . . . . . . . . . . . . 3969.3.2 Pixel selection and weighting (de-ghosting) . . . . . . . . . . . . . . 3989.3.3 Application: Photomontage . . . . . . . . . . . . . . . . . . . . . . 4039.3.4 Blending . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403

9.4 Additional reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4069.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407

10 Computational photography 409

10.1 Photometric calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41210.1.1 Radiometric response function . . . . . . . . . . . . . . . . . . . . . 41210.1.2 Noise level estimation . . . . . . . . . . . . . . . . . . . . . . . . . 41510.1.3 Vignetting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41610.1.4 Optical blur (spatial response) estimation . . . . . . . . . . . . . . . 416

10.2 High dynamic range imaging . . . . . . . . . . . . . . . . . . . . . . . . . . 41910.2.1 Tone mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42710.2.2 Application: Flash photography . . . . . . . . . . . . . . . . . . . . 434

10.3 Super-resolution and blur removal . . . . . . . . . . . . . . . . . . . . . . . 43610.3.1 Color image demosaicing . . . . . . . . . . . . . . . . . . . . . . . 44010.3.2 Application: Colorization . . . . . . . . . . . . . . . . . . . . . . . 442

10.4 Image matting and compositing . . . . . . . . . . . . . . . . . . . . . . . . . 44310.4.1 Blue screen matting . . . . . . . . . . . . . . . . . . . . . . . . . . . 44510.4.2 Natural image matting . . . . . . . . . . . . . . . . . . . . . . . . . 44610.4.3 Optimization-based matting . . . . . . . . . . . . . . . . . . . . . . 45010.4.4 Smoke, shadow, and flash matting . . . . . . . . . . . . . . . . . . . 45210.4.5 Video matting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454

10.5 Texture analysis and synthesis . . . . . . . . . . . . . . . . . . . . . . . . . 45510.5.1 Application: Hole filling and inpainting . . . . . . . . . . . . . . . . 45710.5.2 Application: Non-photorealistic rendering . . . . . . . . . . . . . . . 458

10.6 Additional reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46010.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461

11 Stereo correspondence 467

11.1 Epipolar geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47111.1.1 Rectification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47211.1.2 Plane sweep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474

11.2 Sparse correspondence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47511.2.1 3D curves and profiles . . . . . . . . . . . . . . . . . . . . . . . . . 476

11.3 Dense correspondence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477

xvii

Page 16: Texts in Computer Sciencelink.springer.com/content/pdf/bfm:978-1-84882-935-0/1.pdfapplications of computer vision to fun problems such as image stitching and photo-based 3D modeling

Contents

11.3.1 Similarity measures . . . . . . . . . . . . . . . . . . . . . . . . . . . 47911.4 Local methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480

11.4.1 Sub-pixel estimation and uncertainty . . . . . . . . . . . . . . . . . . 48211.4.2 Application: Stereo-based head tracking . . . . . . . . . . . . . . . . 483

11.5 Global optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48411.5.1 Dynamic programming . . . . . . . . . . . . . . . . . . . . . . . . . 48511.5.2 Segmentation-based techniques . . . . . . . . . . . . . . . . . . . . 48711.5.3 Application: Z-keying and background replacement . . . . . . . . . . 489

11.6 Multi-view stereo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48911.6.1 Volumetric and 3D surface reconstruction . . . . . . . . . . . . . . . 49211.6.2 Shape from silhouettes . . . . . . . . . . . . . . . . . . . . . . . . . 497

11.7 Additional reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49911.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500

12 3D reconstruction 505

12.1 Shape from X . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50812.1.1 Shape from shading and photometric stereo . . . . . . . . . . . . . . 50812.1.2 Shape from texture . . . . . . . . . . . . . . . . . . . . . . . . . . . 51012.1.3 Shape from focus . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511

12.2 Active rangefinding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51212.2.1 Range data merging . . . . . . . . . . . . . . . . . . . . . . . . . . 51512.2.2 Application: Digital heritage . . . . . . . . . . . . . . . . . . . . . . 517

12.3 Surface representations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51812.3.1 Surface interpolation . . . . . . . . . . . . . . . . . . . . . . . . . . 51812.3.2 Surface simplification . . . . . . . . . . . . . . . . . . . . . . . . . 52012.3.3 Geometry images . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520

12.4 Point-based representations . . . . . . . . . . . . . . . . . . . . . . . . . . . 52112.5 Volumetric representations . . . . . . . . . . . . . . . . . . . . . . . . . . . 522

12.5.1 Implicit surfaces and level sets . . . . . . . . . . . . . . . . . . . . . 52212.6 Model-based reconstruction . . . . . . . . . . . . . . . . . . . . . . . . . . . 523

12.6.1 Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52412.6.2 Heads and faces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52612.6.3 Application: Facial animation . . . . . . . . . . . . . . . . . . . . . 52812.6.4 Whole body modeling and tracking . . . . . . . . . . . . . . . . . . 530

12.7 Recovering texture maps and albedos . . . . . . . . . . . . . . . . . . . . . 53412.7.1 Estimating BRDFs . . . . . . . . . . . . . . . . . . . . . . . . . . . 53612.7.2 Application: 3D photography . . . . . . . . . . . . . . . . . . . . . 537

12.8 Additional reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53812.9 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539

13 Image-based rendering 543

13.1 View interpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54513.1.1 View-dependent texture maps . . . . . . . . . . . . . . . . . . . . . 54713.1.2 Application: Photo Tourism . . . . . . . . . . . . . . . . . . . . . . 548

13.2 Layered depth images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54913.2.1 Impostors, sprites, and layers . . . . . . . . . . . . . . . . . . . . . . 549

xviii

Page 17: Texts in Computer Sciencelink.springer.com/content/pdf/bfm:978-1-84882-935-0/1.pdfapplications of computer vision to fun problems such as image stitching and photo-based 3D modeling

Contents

13.3 Light fields and Lumigraphs . . . . . . . . . . . . . . . . . . . . . . . . . . 55113.3.1 Unstructured Lumigraph . . . . . . . . . . . . . . . . . . . . . . . . 55413.3.2 Surface light fields . . . . . . . . . . . . . . . . . . . . . . . . . . . 55513.3.3 Application: Concentric mosaics . . . . . . . . . . . . . . . . . . . . 556

13.4 Environment mattes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55613.4.1 Higher-dimensional light fields . . . . . . . . . . . . . . . . . . . . . 55813.4.2 The modeling to rendering continuum . . . . . . . . . . . . . . . . . 559

13.5 Video-based rendering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56013.5.1 Video-based animation . . . . . . . . . . . . . . . . . . . . . . . . . 56013.5.2 Video textures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56113.5.3 Application: Animating pictures . . . . . . . . . . . . . . . . . . . . 56413.5.4 3D Video . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56413.5.5 Application: Video-based walkthroughs . . . . . . . . . . . . . . . . 566

13.6 Additional reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56913.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570

14 Recognition 575

14.1 Object detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57814.1.1 Face detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57814.1.2 Pedestrian detection . . . . . . . . . . . . . . . . . . . . . . . . . . 585

14.2 Face recognition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58814.2.1 Eigenfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58914.2.2 Active appearance and 3D shape models . . . . . . . . . . . . . . . . 59614.2.3 Application: Personal photo collections . . . . . . . . . . . . . . . . 601

14.3 Instance recognition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60214.3.1 Geometric alignment . . . . . . . . . . . . . . . . . . . . . . . . . . 60314.3.2 Large databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60414.3.3 Application: Location recognition . . . . . . . . . . . . . . . . . . . 609

14.4 Category recognition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61114.4.1 Bag of words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61214.4.2 Part-based models . . . . . . . . . . . . . . . . . . . . . . . . . . . 61514.4.3 Recognition with segmentation . . . . . . . . . . . . . . . . . . . . . 62014.4.4 Application: Intelligent photo editing . . . . . . . . . . . . . . . . . 621

14.5 Context and scene understanding . . . . . . . . . . . . . . . . . . . . . . . . 62514.5.1 Learning and large image collections . . . . . . . . . . . . . . . . . 62714.5.2 Application: Image search . . . . . . . . . . . . . . . . . . . . . . . 630

14.6 Recognition databases and test sets . . . . . . . . . . . . . . . . . . . . . . . 63114.7 Additional reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63114.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 637

15 Conclusion 641

A Linear algebra and numerical techniques 645

A.1 Matrix decompositions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 646A.1.1 Singular value decomposition . . . . . . . . . . . . . . . . . . . . . 646A.1.2 Eigenvalue decomposition . . . . . . . . . . . . . . . . . . . . . . . 647

xix

Page 18: Texts in Computer Sciencelink.springer.com/content/pdf/bfm:978-1-84882-935-0/1.pdfapplications of computer vision to fun problems such as image stitching and photo-based 3D modeling

Contents

A.1.3 QR factorization . . . . . . . . . . . . . . . . . . . . . . . . . . . . 649A.1.4 Cholesky factorization . . . . . . . . . . . . . . . . . . . . . . . . . 650

A.2 Linear least squares . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 651A.2.1 Total least squares . . . . . . . . . . . . . . . . . . . . . . . . . . . 653

A.3 Non-linear least squares . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 654A.4 Direct sparse matrix techniques . . . . . . . . . . . . . . . . . . . . . . . . . 655

A.4.1 Variable reordering . . . . . . . . . . . . . . . . . . . . . . . . . . . 656A.5 Iterative techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 656

A.5.1 Conjugate gradient . . . . . . . . . . . . . . . . . . . . . . . . . . . 657A.5.2 Preconditioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 659A.5.3 Multigrid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 660

B Bayesian modeling and inference 661

B.1 Estimation theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 662B.1.1 Likelihood for multivariate Gaussian noise . . . . . . . . . . . . . . 663

B.2 Maximum likelihood estimation and least squares . . . . . . . . . . . . . . . 665B.3 Robust statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 666B.4 Prior models and Bayesian inference . . . . . . . . . . . . . . . . . . . . . . 667B.5 Markov random fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 668

B.5.1 Gradient descent and simulated annealing . . . . . . . . . . . . . . . 670B.5.2 Dynamic programming . . . . . . . . . . . . . . . . . . . . . . . . . 670B.5.3 Belief propagation . . . . . . . . . . . . . . . . . . . . . . . . . . . 672B.5.4 Graph cuts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 674B.5.5 Linear programming . . . . . . . . . . . . . . . . . . . . . . . . . . 676

B.6 Uncertainty estimation (error analysis) . . . . . . . . . . . . . . . . . . . . . 678

C Supplementary material 679

C.1 Data sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680C.2 Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682C.3 Slides and lectures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689C.4 Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690

References 691

Index 793

xx