Download Document

Document related concepts
no text concepts found
Transcript
Introduction to Computer Vision
Week 11, Fall 2010
Instructor: Prof. Ko Nishino
The Projective Plane
  Why do we need homogeneous coordinates?
  represent points at infinity, homographies, perspective
projection, multi-view relationships
  What is the geometric intuition?
  a point in the image is a ray in projective space
y
(x,y,1)
(0,0,0)
z
x
(sx,sy,s)
image plane
  each point (x,y) on the plane is represented by a ray (sx,sy,s)
  all points on the ray are equivalent: (x, y, 1) ≅ (sx, sy, s)
Projective Lines
  What does a line in the image correspond to in
projective space?
•  A line is a plane of rays through origin
–  all rays (x,y,z) satisfying: ax + by + cz = 0
in vector notation :
⎡ x ⎤
⎢ ⎥
0 = [ a b c ] ⎢ y ⎥
⎢⎣ z ⎥⎦
l
p
•  A line is also represented as a homogeneous 3-vector l
€
Point and Line Duality
  A line l is a homogeneous 3-vector
  It is ⊥ to every point (ray) p on the line: l p=0
l
p1
p2
l1
p
l2
What is the line l spanned by rays p1 and p2 ?
•  l is ⊥ to p1 and p2 ⇒ l = p1 × p2
•  l is the plane normal
What is the intersection of two lines l1 and l2 ?
•  p is ⊥ to l1 and l2 ⇒ p = l1 × l2
Points and lines are dual in projective space
•  given any formula, can switch the meanings of points and lines to get
another formula
Ideal Points and Lines
y
y
(sx,sy,0)
z
x
image plane
(0,0,1)
z
  Ideal point (“point at infinity”)
  p ≅ (x, y, 0) – parallel to image plane
  Infinitely large coordinates
  Ideal line
  l ≅ (0,0,1) – parallel to image plane
x
image plane
Homographies of Points and Lines
  Computed by 3x3 matrix multiplication
  To transform a point: p’ = Hp
  To transform a line: lp=0 → l’p’=0
  0 = lp = lH-1Hp = lH-1p’ ⇒ l’ = lH-1
  lines are transformed by postmultiplication of H-1
3D Projective Geometry
  These concepts generalize naturally to 3D
  Homogeneous coordinates
  Projective 3D points have four coords: P = (X,Y,Z,W)
  Duality
  A plane N is also represented by a 4-vector
  Points and planes are dual in 3D: N P=0
  Projective transformations
  Represented by 4x4 matrices T: P’ = TP,
N’ = N T-1
Vanishing Points
image plane
vanishing point
camera
center
ground plane
  Vanishing point
  projection of a point at infinity
Vanishing Points (2D)
image plane
vanishing point
camera
center
line on ground plane
Vanishing Points
image plane
vanishing point V
camera
center
C
line on ground plane
line on ground plane
  Properties
  Any two parallel lines have the same vanishing point v
  The ray from C through v is parallel to the lines
  An image may have more than one vanishing point
Vanishing points
Image by Q-T. Luong (a vision researcher & photographer)
Vanishing Lines
v1
v2
  Multiple Vanishing Points
  Any set of parallel lines on the plane define a vanishing point
  The union of all of these vanishing points is the horizon line (also
called vanishing line)
  Note that different planes define different vanishing lines
Vanishing Lines
  Multiple Vanishing Points
  Any set of parallel lines on the plane define a vanishing point
  The union of all of these vanishing points is the horizon line (also
called vanishing line)
  Note that different planes define different vanishing lines
Vanishing Lines
Image by Q-T. Luong (a vision researcher & photographer)
Computing Vanishing Points
V
P0
D
  P∞ is a point at infinity, v is its projection
  They depend only on line direction
  Parallel lines P0 + tD, P1 + tD intersect at P∞
Computing Vanishing Lines
C
l
ground plane
  l is the intersection of horizontal plane through C with image plane
  Compute l from two sets of parallel lines on ground plane
  All points at same height as C project to l
  points higher than C project above l
  Provides way of comparing height of objects in the scene
Fun with Vanishing Points
Recognition
Slides courtesy of Professor Steven Seitz
Recognition
The “Margaret Thatcher Illusion”, by Peter Thompson!
Recognition
The “George Bush Illusion”, by Tania Lombrozo!
Recognition Problems
  What is it?
  Object detection
  Who is it?
  Recognizing identity
  What are they doing?
  Activities
  All of these are classification problems
  Choose one class from a list of possible candidates
Face Detection
One Simple Method: Skin Detection
R
skin!
G
  Skin pixels have a distinctive range of colors
  Corresponds to region(s) in RGB color space
  for visualization, only R and G components are shown above
  Skin classifier
  A pixel X = (R,G,B) is skin if it is in the skin region
  But how to find this region?
Skin Detection
R
G
  Learn the skin region from examples
  Manually label pixels in one or more “training images” as skin or not skin
  Plot the training data in RGB space
 skin pixels shown in orange, non-skin pixels shown in blue
 some skin pixels may be outside the region, non-skin pixels inside.
  Skin classifier
  Given X = (R,G,B): how to determine if it is skin or not?
Skin Classification Techniques
R
  Skin classifier
G
  Given X = (R,G,B): how to determine if it is skin or not?
  Nearest neighbor
  find labeled pixel closest to X
  choose the label for that pixel
  Data modeling
  fit a model (curve, surface, or volume) to each class
  Probabilistic data modeling
  fit a probability model to each class
Probability
  Basic probability
  X is a random variable
  P(X) is the probability that X achieves a certain value
called a PDF!
- probability distribution/density function!
- a 2D PDF is a surface, 3D PDF is a volume!
 
or
 
continuous X!
discrete X!
  Conditional probability: P(X | Y)
  probability of X given that we already know Y
Probabilistic Skin Classification
T
h
  Now we can model uncertainty
  Each pixel has a probability of being skin or not skin
 
  Skin classifier
  Given X = (R,G,B): how to determine if it is skin or not?
  Choose interpretation of highest probability
  set X to be a skin pixel if and only if
  Where do we get
and
?
Learning Conditional PDF’s
  We can calculate P(R | skin) from a set of training images
  It is simply a histogram over the pixels in the training images
 each bin Ri contains the proportion of skin pixels with color Ri
  But this isn’t quite what we want
  Why not? How to determine if a pixel is skin?
  We want P(skin | R) not P(R | skin)
  How can we get it?
Bayes Rule
  In terms of our problem:
what we want!
(posterior)!
 
what we measure!
(likelihood)!
domain knowledge!
(prior)
normalization term!
What could we use for the prior P(skin)?
  Could use domain knowledge
  P(skin) may be larger if we know the image contains a person
  for a portrait, P(skin) may be higher for pixels in the center
  Could learn the prior from the training set. How?
  P(skin) may be proportion of skin pixels in training set
Bayesian Estimation
T
h
likelihood!
T
h
posterior (unnormalized)!
= minimize probability of misclassification
  Bayesian estimation
  Goal is to choose the label (skin or ~skin) that maximizes the
posterior (Maximum A Posteriori (MAP) estimation)
  Suppose the prior is uniform: P(skin) = P(~skin) = 0.5!
  in this case
,
  maximizing the posterior is equivalent to maximizing the
likelihood (Maximum Likelihood (ML) estimation)
 
if and only if
Skin Detection Results
General Classification
  This same procedure applies in more general circumstances
  More than two classes
  More than one dimension
  Example: face detection
  Here, X is an image region
 
dimension = # pixels
  each face can be thought
of as a point in a high
dimensional space
H. Schneiderman, T. Kanade. "A Statistical Method for 3D
Object Detection Applied to Faces and Cars". IEEE Conference
on Computer Vision and Pattern Recognition (CVPR 2000)
http://www-2.cs.cmu.edu/afs/cs.cmu.edu/user/hws/www/CVPR00.pdf
H. Schneiderman and
T.Kanade!
Linear Subspaces
convert x into v1, v2 coordinates!
What does the v2 coordinate measure?!
-  distance to line!
-  use it for classification—near 0 for orange pts!
What does the v1 coordinate measure?!
-  position along line!
-  use it to specify which orange point it is!
  Classification can be expensive
 Must either search (e.g., nearest neighbors) or store large
PDF’s
  Suppose the data points are arranged as above
  Idea—fit a line, classifier measures distance to line
Dimensionality Reduction
  Dimensionality reduction
  We can represent the orange points with only their v1 coordinates
  since v2 coordinates are all essentially 0
  This makes it much cheaper to store and compare points
  A bigger deal for higher dimensional problems
Linear Subspaces
Consider the variation along direction v
among all of the orange points:!
What unit vector v minimizes var?!
What unit vector v maximizes var?!
Solution: !v1 is eigenvector of A with largest eigenvalue!
!v2 is eigenvector of A with smallest eigenvalue!
Principal Component Analysis
  Suppose each data point is N-dimensional
  Same procedure applies:
  The eigenvectors of A define a new coordinate system
  eigenvector with largest eigenvalue captures the most variation
among training vectors x
  eigenvector with smallest eigenvalue has least variation
  We can compress the data by only using the top few eigenvectors
  corresponds to choosing a “linear subspace”
 
represent points on a line, plane, or “hyper-plane”
  these eigenvectors are known as the principal components
The Space of Faces
=
+
  An image is a point in a high dimensional space
  An N x M image is a point in RNM
  We can define vectors in this space as we did in the 2D case
Dimensionality Reduction
  The set of faces is a “subspace” of the set of images
  Suppose it is K dimensional
  We can find the best subspace using PCA
  This is like fitting a “hyper-plane” to the set of faces
 spanned by vectors v1, v2, ..., vK
 any face
Eigenfaces
  PCA extracts the eigenvectors of A
  Gives a set of vectors v1, v2, v3, ...
  Each one of these vectors is a direction in face space
T
h
e
  what do these look like?
T
h
e
T
h
e
Projecting onto the Eigenfaces
  The eigenfaces v1, ..., vK span the space of faces
  A face is converted to eigenface coordinates by
The image
part with
The image
part with
The image
part with
The image
part with
The image
part with
The image
part with
The image
part with
The image
part with
Recognition with Eigenfaces
  Algorithm
1.  Process the image database (set of images with labels)
•  Run PCA—compute eigenfaces
•  Calculate the K coefficients for each image
2.  Given a new image (to be recognized) x, calculate K coefficients
3.  Detect if x is a face
4.  If it is a face, who is it?
•  Find closest labeled face in database
•  nearest-neighbor in K-dimensional space
Choosing the Dimension K
eigenvalues
i=
K
NM
  How many eigenfaces to use?
  Look at the decay of the eigenvalues
  the eigenvalue tells you the amount of variance “in the
direction” of that eigenface
  ignore eigenfaces with low variance
Object Recognition
  This is just the tip of the iceberg
  We’ve talked about using pixel color as a feature
  Many other features can be used:
  edges
  motion (e.g., optical flow)
  object size
  SIFT
  ...
  Classical object recognition techniques recover 3D
information as well
  given an image and a database of 3D models, determine
which model(s) appears in that image
  often recover 3D pose of the object as well
Recap
Image Formation/Sensing
 
 
 
 
 
 
 
Pin-hole model
Thin-lens law
Aperture
Depth of field
Radiometric/Geometric distortion
Human eyes
Sensors
  Quantum efficiency
  Sensing color
Camera Models and Projective Geometry
  Homogeneous coordinates and their geometric intuition
  Projection models
  Perspective, orthographic, weak-perspective, and affine
  Camera calibration
  Camera parameters
  Direct linear method
  Homography
  Points and lines in projective space
  projective operations: line intersection, line containing two
points
  ideal points and lines (at infinity)
  Vanishing points and lines and how to compute them
Image Filtering
  Digital vs. continuous images
  Linear shift invariant systems
  Convolution
  Sifting property
  Cascade system
  Fourier transform
  Convolution
  Gaussian smoothing
  Sampling theorem
  Nyquist law
  Aliasing
  Smoothing
  Gaussian filtering
  Median filtering
  Image scaling
  Image resampling
  Correlation
Edge Detection
  Origin of edges
  Edge types
  Theory of edge detection
  Squared gradient
  Laplacian
  Discrete approximations
  Accounting for noise
  Derivative theorem of convolution
  Laplacian of Gaussian
  Canny edge detector
  Difference of Gaussians
Motion
  Optical flow problem definition
  Motion field and optical flow
  Aperture problem and how it arises
  Assumptions
  Brightness constancy, small motion, smoothness
  Derivation of optical flow constraint equation
  Lucas-Kanade equation
  Derivation
  Conditions for solvability
  Meanings of eigenvalues and eigenvectors
  Iterative refinement
  Newton’s method
  Pyramid-based flow estimation
Mosaicing
  Wide-angle imaging
  Cylindrical image reprojection
  Accounting for radial distortion
  Brightness constancy, small motion, smoothness
  Drifting
Lightness
  Color constancy
  Lightness recovery
  Frequency domain interpretation
  Solving Poisson equation
  Lightness from multiple images
Radiometry and Reflectance
  Describing light
  Optics
  Radiometric concepts
 
 
 
 
Solid angle
Radiant intensity
Irradiance
Radiance
  Radiometric image formation
  Scene radiance to image irradiance
  BRDF
  Surface irradiance to surface radiance
  Properties
  Reflection
  Body reflection and surface reflection
  Diffuse reflection and specular reflection
  Reflectance models
  Lambertian
  Ideal specular
  Torrance-Sparrow
  Dichromatic reflectance model
Photometric Stereo
  Gradient space
  Reflectance map
  Diffuse photometric stereo
  derivation
  equations
  solving for albedo, normals
  depths from normals
  Handling shadows
  Computing light source directions from a shiny ball
  Limitations
Shape-from-Shading
 
 
 
 
Stereographic projection
Smoothness constraint
Calculus of variations
Numerical shape-from-shading
Stereo
Visual cues for 3D inference
Disparity and depth
Vergence
Epipolar geometry
  Epipolar plane/line
  Fundamental matrix
  Stereo image rectification
  Stereo matching
  window-based matching
  effect of window size
  sources of error
  Active stereo (basic idea)
  structured light
  laser scanning
 
 
 
 
Structure-from-Motion
  Factorization method
  Problem formulation
  Rank constraint
  SVD
  Resolve ambiguity
Recognition
  Classifiers
  Probabilistic classification
  Decision boundaries
  Learning PDF’s from training images
  Bayes law
  Maximum likelihood
  MAP
  Principal component analysis
  Eigenfaces algorithm
Fin!
  Don’t bomb the final exam
  Closed book
  COMPREHENSIVE!
  Here, same time next week