Subhransu Maji
CMPSCI 670: Computer Vision
Image formation
September 13, 2016
Image formation Subhransu Maji CMPSCI 670: Computer Vision - - PowerPoint PPT Presentation
Image formation Subhransu Maji CMPSCI 670: Computer Vision September 13, 2016 Administrivia and survey results Topics: deep learning, CNNs, machine learning, AI Applications: self driving cars, face detection/recognition, etc
September 13, 2016
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Topics:
Goals:
Programming: 7.5 - 8.5, Math: 6.5 - 7.5 Spire: waitlisted students? there are a few more open slots Resources for vector algebra and probability added to the webpage
2
Subhransu Maji (UMass, Fall 16) CMPSCI 670
The pinhole projection model
Cameras with lenses
Digital cameras
Computational photography
3
Subhransu Maji (UMass, Fall 16) CMPSCI 670
4
Albrecht Dürer early 1500s Brunelleschi, early 1400s
Subhransu Maji (UMass, Fall 16) CMPSCI 670
5
Object Film Idea 1: Lets put a film in front of an object Do we get a reasonable image? A B
Subhransu Maji (UMass, Fall 16) CMPSCI 670
6
Object Film Add a barrier to block of most rays Barrier
Subhransu Maji (UMass, Fall 16) CMPSCI 670
7
Object Film Barrier
center of projection, focal point, camera center
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Basic principle known to Mozi (470-390 BCE), Aristotle (384-322 BCE) Drawing aids for artists: described by Leonardo Da Vinci (1452-1519 AD)
8
Gemma Frisius, 1558 “Camera obscure” Latin for “darkened room”
Subhransu Maji (UMass, Fall 16) CMPSCI 670
9
Tree shadow during a solar eclipse photo credit: Nils van der Burg http://www.physicstogo.org/index.cfm
Slide by Steve Seitz
Subhransu Maji (UMass, Fall 16) CMPSCI 670
10
Subhransu Maji (UMass, Fall 16) CMPSCI 670
11
http://www.pauldebevec.com/Pinhole
Subhransu Maji (UMass, Fall 16) CMPSCI 670
12
Point of observation
3D world 2D image
Slide by A. Efros
Subhransu Maji (UMass, Fall 16) CMPSCI 670
x y z
f To compute the projection P’ of a scene point P, form a visual ray connection P to the camera center O and find where it intersects the image plane
13 Slide by Steve Seitz
Subhransu Maji (UMass, Fall 16) CMPSCI 670
The coordinate system
axis)
Projection equations
14
x y z
f
Slide by Steve Seitz
Subhransu Maji (UMass, Fall 16) CMPSCI 670
15
image plane camera center line in the scene
vanishing point
Slide by Steve Seitz
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Each direction in space has its own vanishing point
16
Slide by Steve Seitz
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Each direction in space has its own vanishing point
17
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Vanishing line of the ground plane
18
camera center ground plane
Subhransu Maji (UMass, Fall 16) CMPSCI 670
19
Is the person above or below the viewer?
Subhransu Maji (UMass, Fall 16) CMPSCI 670
20
Subhransu Maji (UMass, Fall 16) CMPSCI 670
21
Subhransu Maji (UMass, Fall 16) CMPSCI 670
22
Subhransu Maji (UMass, Fall 16) CMPSCI 670
23
vanishing point
Subhransu Maji (UMass, Fall 16) CMPSCI 670
24
1 2 3 4 5 What is the height of the camera? 3.7 2.5 5.4 camera height
Subhransu Maji (UMass, Fall 16) CMPSCI 670
25
Masaccio, Trinity, Santa Maria Novella, Florence, 1425-28 One of the first consistent uses of perspective in Western art
Subhransu Maji (UMass, Fall 16) CMPSCI 670
26
(At least partial) Perspective projections in art well before the Renaissance
From ottobwiersma.nl
Also some Greek examples, So apparently pre-renaissance…
Subhransu Maji (UMass, Fall 16) CMPSCI 670
What does a sphere project to?
27
Slide by Steve Seitz
Subhransu Maji (UMass, Fall 16) CMPSCI 670
What does a sphere project to?
28
Subhransu Maji (UMass, Fall 16) CMPSCI 670
The exterior looks bigger The distortion is not due to lens flaws Problem pointed out by Da Vinci
29 Slide by F. Durand
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Special case of perspective projection
30
Image World
Slide by Steve Seitz
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Special case of perspective projection
31
Subhransu Maji (UMass, Fall 16) CMPSCI 670
The pinhole projection model
Cameras with lenses
Digital cameras
Novel cameras
32
Subhransu Maji (UMass, Fall 16) CMPSCI 670
33
Object Film Barrier
aperture, center of projection, focal point, camera center
aperture image
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Why not make the aperture as small as possible?
34 Slide by Steve Seitz
Subhransu Maji (UMass, Fall 16) CMPSCI 670
35 Slide by Steve Seitz
Subhransu Maji (UMass, Fall 16) CMPSCI 670
A lens focuses light on to the film
➡ Rays passing through the center are not deviated (pinhole
projection model still holds)
36
Object Film Lens
Slide by F. Durand
Subhransu Maji (UMass, Fall 16) CMPSCI 670
A lens focuses light on to the film
➡ Rays passing through the center are not deviated (pinhole
projection model still holds)
➡ All parallel rays converge to one point on a plane located at
the focal length f
37
Object Film Lens f
Slide by F. Durand
Subhransu Maji (UMass, Fall 16) CMPSCI 670
A lens focuses light on to the film
➡other points project on to a “circle of confusion” in the image
38
Object Film Lens
circle of confusion
Slide by F. Durand
Subhransu Maji (UMass, Fall 16) CMPSCI 670
What is the relation between the focal length (f), the distance of the
will be in focus (D’)?
39
image plane lens
Slide by F. Durand
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Similar triangles everywhere!
40
image plane lens
Slide by F. Durand
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Similar triangles everywhere!
41
image plane lens
Slide by F. Durand
Subhransu Maji (UMass, Fall 16) CMPSCI 670
42
image plane lens
Any point satisfying the thin lens equation is in focus
Slide by F. Durand
Subhransu Maji (UMass, Fall 16) CMPSCI 670
43
http://www.cambridgeincolour.com/tutorials/depth-of-field.htm
DOF is the distance between the nearest and farthest objects in a scene that appear acceptably sharp in an image
Slide by A.Efros
Subhransu Maji (UMass, Fall 16) CMPSCI 670
44
Large aperture = small DOF Small aperture = large DOF
Slide by A.Efros
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Changing the aperture size affects the depth of field
approximately in focus
the exposure for contrast
45
image credit Wikipedia
Subhransu Maji (UMass, Fall 16) CMPSCI 670
46 Slide by A.Efros
Subhransu Maji (UMass, Fall 16) CMPSCI 670
47 Slide by A.Efros
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Field of view (FOV) depends on the focal length and the size of the camera retina
48
Larger focal length = smaller FOV φ = tan−1 ✓ d 2f ◆
f
Slide by A.Efros
Subhransu Maji (UMass, Fall 16) CMPSCI 670
49
Large FOV, small f — Camera close to the car Small FOV, large f — Camera far from the car
tan(φ) × 2f = d ∼ (φ) × 2f = d
Slide by A.Efros, F.Durand
Subhransu Maji (UMass, Fall 16) CMPSCI 670
50
wide-angle (short focus) telephoto (long focus) standard
Slide by F.Durand
Subhransu Maji (UMass, Fall 16) CMPSCI 670
51 Source: Hartley & Zisserman
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Continuously adjusting the camera focal length while the camera moves away from (or towards) the subject
52
http://en.wikipedia.org/wiki/Dolly_zoom
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Continuously adjusting the camera focal length while the camera moves away from (or towards) the subject Also called as “Vertigo shot” or the “Hitchcock shot”
53
Example of dolly zoom from Goodfellas Example of dolly zoom from La Haine
September 13, 2016
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Homework 01 posted
➡ Any combination of Latex, Word, print + scan, etc.
Mini-project 1 posted
Sign up on Piazza for announcements
Lecture slides and materials are posted on webpage TA office hours:
Waitlisted students?
55
Subhransu Maji (UMass, Fall 16) CMPSCI 670
The pinhole projection model
Cameras with lenses
Digital cameras
Computational photography
56
x y z
f
pinhole camera f D D′ lens
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Lens have different refractive indices (Snell’s law) for different wavelengths: causes color fringing
57
near lens center near lens outer
Slide by S.Seitz
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Spherical lenses don’t focus light perfectly (thin lens model)
58
Slide by S.Seitz
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Reduction of image brightness in the periphery
59
Not all rays reach the sensor
Slide by S.Seitz
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Caused by asymmetry of lenses Deviations are most noticeable near the periphery
60
barrel distortion pincushion distortion mustache distortion
http://parkingandyou.com http://clanegesselphotography.blogspot.com/
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Many uses: cameras, telescopes, microscopes, etc
61
Example of a prime lens - Carl Zeiss Tessar Nikkor 28-200 mm zoom lens, extended to 200 mm at left and collapsed to 28 mm focal length at right.
fixed focal length adjustable zoom
http://en.wikipedia.org/wiki/Zoom_lens
Subhransu Maji (UMass, Fall 16) CMPSCI 670
The pinhole projection model
Cameras with lenses
Digital cameras
Novel cameras
62
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Photographic film — strip of transparent plastic film base coated on
Creates a latent image when exposed to light for short duration Films are then chemically developed to form a photograph Early films/photographic plates could only capture intensity
63
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Sergey Prokudin-Gorskii (1863-1944) Photographs of the Russian empire (1909-1916)
64
Subhransu Maji (UMass, Fall 16) CMPSCI 670
65
Homework 1: fix this by aligning the channels
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Color photographic film — many layers of dyes and light sensitive materials to capture light of different frequencies simultaneously
Simultaneous measurement solves the alignment problem
66
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Color images are commonly represented using 3 channels [R, G, B]
67
red green blue
Subhransu Maji (UMass, Fall 16) CMPSCI 670
A digital camera replaces the film with a sensor array
photons to electrons
➡ Charge Coupled Device (CCD) ➡ Complementary Metal Oxide Semiconductor (CMOS)
68
http://electronics.howstuffworks.com/digital-camera.htm
Slide by S.Seitz
Subhransu Maji (UMass, Fall 16) CMPSCI 670
69
Bayer grid
Estimate missing components from neighboring values (demosiacing)
Why more green?
Human luminance sensitivity function
Color filter array
Slide by S.Seitz
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Estimate missing values
70
Red Green Blue
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Problem: guess the values of ? in each of the three channels Why is this even possible?
71
Subhransu Maji (UMass, Fall 16) CMPSCI 670
72
nearest neighbor copy one of your neighbors ? ←gl linear interpolation average values of your neighbors ? ←(gt+gl+gr+gb)/4 adaptive gradient average based on
if |gt-gb| > |gl-gr| ? ← (gl+gr)/2 else ? ← (gt+gb)/2 Similarly for the blue and red channels Homework 1: implement this
Subhransu Maji (UMass, Fall 16) CMPSCI 670
73 Slide by F.Durand
Subhransu Maji (UMass, Fall 16) CMPSCI 670
74
detector Fine black and white detail in the image scene is misinterpreted as color information
Slide by F.Durand
Subhransu Maji (UMass, Fall 16) CMPSCI 670
White or “panchromatic” cells allow lights across all wavelengths
How would you go about picking the best one?
75
Three new Kodak RGBW filter patterns Fujifilm "X-Trans" filter Source: https://en.wikipedia.org/wiki/Bayer_filter
Subhransu Maji (UMass, Fall 16) CMPSCI 670
76
S.K. Nayar http://www1.cs.columbia.edu/CAVE/projects/what_is/
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Goal: Design a sampling pattern + interpolation algorithm that archives the best color reconstruction Sampling patterns
➡ More choices if we allow different color filters
Interpolation algorithms
77
Subhransu Maji (UMass, Fall 16) CMPSCI 670 78
Subhransu Maji (UMass, Fall 16) CMPSCI 670 79
linearly interpolate color value using intensity-based affinities
Subhransu Maji (UMass, Fall 16) CMPSCI 670 80
increasing noise level
Subhransu Maji (UMass, Fall 16) CMPSCI 670 81
http://ttic.uchicago.edu/~ayanc/learncfa/
To appear at NIPS’16
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Sample over time, lighting, viewing direction, pose
82
Paul Debevec’s group at USC-ICT http://ict.usc.edu/prototypes/light-stages/
Subhransu Maji (UMass, Fall 16) CMPSCI 670
Light field camera: capture intensity along each direction of the light
A captured light field allows you re-render an image post-hoc
83
Subhransu Maji (UMass, Fall 16) CMPSCI 670
History of optics, Wikipedia
Cameras, CVPR 2012 DIY http://www.pauldebevec.com/Pinhole In MATLAB, compute the projection of a sphere using the perspective model and visualize the distortions Light stages over time http://gl.ict.usc.edu/LightStages Sergey Prokudin-Gorskii photographic collection at the Library of Congress http://www.loc.gov/exhibits/empire/index.html Richard Szeliski’s book, Sections 2.2.3 - 2.3.2
84