Causes of colour

Download Report

Transcript Causes of colour

Example:
Canny Edge Detection
(Matlab automatically set thresholds)
Computer Vision : CISC 4/689
More: facts and figures
• The convolution of two Gaussians with variances {1}2
and {2}2 is {1}2+{2}2. This is same as consecutive
smoothing with the two corresponding SD’s.
• Thus, generic formula is: i{i}2
• Problem: A discrete appx. to a 1D Gaussian can be obtained
by sampling g(x). In practice, samples are taken
uniformly until the truncated values at the tails of the
distribution are less than 1/1000 of the peak value.
a) For =1, show that the filter is 7 pixels wide.
Computer Vision : CISC 4/689
Answer..
• Lets pick (n+1) pixels from the center of kernel(including
center). This way, total kernel size is 2n+1, n pixels on
either side of origin.
Exp(-{(n+1)2}/{22}) < 1/1000
So, n > 3.7 -1
n must be the nearest integer to 3.7 -0.5
For =1, n=3, 2n+1=7.
Filter coefficients can be obtained as {-3,-2,-1,0,1,2,3}
Computer Vision : CISC 4/689
Choice of 
• The choice of  depends on the scale at which the image is
to be displayed.
• Small values bring out edges at a fine scale, vice-versa.
• Noise is another factor to look into the selection, along
with computational cost
Computer Vision : CISC 4/689
Some comparisons
Zero-crossings easy to find
than threshold
Computer Vision : CISC 4/689
Canny
•
•
•
Many implementations of the Canny
edge detector approximate this process
by first convolving the image with a
Gaussian to smooth the signal, and then
looking for maxima in the first partial
derivatives of the resulting signal (using
masks similar to the Sobel masks).
Thus we can convolve the image with 4
masks, looking for horizontal, vertical
and diagonal edges. The direction
producing the largest result at each
pixel point is marked.
Record the convolution result and the
direction of the edge at each pixel.
Computer Vision : CISC 4/689
Marr-Hildreth vs. Canny
• Laplacian is isotropic, computationally efficient: single
convolution, look for zero-crossing. (one way to explain
zero-crossing is, if first derivative can be looked at as a
function, its maximum will be its derivative=0).
• Canny being a directional operator (derivative in 4 or 3
directions), more costly, esp. due to hysterisis.
• Two derivatives -> more sensitive to noise
Computer Vision : CISC 4/689
Image Pyramids
• Observation: Fine-grained template
matching expensive over a full image
– Idea: Represent image at smaller
scales, allowing efficient coarseto-fine search
• Downsampling: Cut width, height in
half at each iteration:
from Forsyth & Ponce
Computer Vision : CISC 4/689
Gaussian Pyramid
• Let the base (the finest resolution) of an n-level Gaussian pyramid be defined as
P0 = I. Then the ith level is reduced from the level below it by:
• Upsampling S"(I): Double size of image, interpolate missing pixels
Computer Vision : CISC 4/689
Gaussian pyramid
courtesy
of Wolfram
Laplacian Pyramids
• The tip (the coarsest resolution) of an n-level Laplacian pyramid is the
same as the Gaussian pyramid at that level: Ln(I) = Pn(I)
• The ith level is expanded from the level above according to Li(I) = Pi(I)
¡ S"(Pi+1(I))
• Synthesizing the original image: Get I back by summing upsampled
Laplacian pyramid levels
Computer Vision : CISC 4/689
Laplacian Pyramid
•
•
•
The differences of images at successive
levels of the Gaussian pyramid define
the Laplacian pyramid. To calculate a
difference, the image at a higher level
in the pyramid must be increased in size
by a factor of four prior to subtraction.
This computes the pyramid.
The original image may be
reconstructed from the Laplacian
pyramid by reversing the previous
steps. This interpolates and adds the
images at successive levels of the
pyramid beginning with the lowest
level.
Laplacian is largely uncorrelated, and so may
be represented pixel by pixel with many
fewer bits than Gaussian.
Computer Vision : CISC 4/689
courtesy
of Wolfram
Reconstruction
Computer Vision : CISC 4/689
Splining
• Build Laplacian pyramids LA and LB for A & B images
• Build a Gaussian pyramid GR from selected region R
• Form a combined pyramid LS from LA and LB using
nodes of GR as weights:
LS(I,j) = GR(I,j)*LA(I,j)+(1-GR(I,j))*LB(I,j)
Collapse the LS pyramid to get the final blended image
Computer Vision : CISC 4/689
Splining (Blending)
• Splining two images simply requires: 1) generating a
Laplacian pyramid for each image, 2) generating a
Gaussian pyramid for the bitmask indicating how the two
images should be merged, 3) merging each Laplacian level
of the two images using the bitmask from the
corresponding Gaussian level, and 4) collapsing the
resulting Laplacian pyramid.
• i.e.
GS = Gaussian pyramid of bitmask
LA = Laplacian pyramid of image "A"
LB = Laplacian pyramid of image "B"
therefore, "Lout = (GS)LA + (1-GS)LB"
Computer Vision : CISC 4/689
Example images from GTech
Image-1
bit-mask
image-2
Direct addition splining
Computer Vision : CISC 4/689
bad bit-mask choice
Outline
• Corner detection
• RANSAC
Computer Vision : CISC 4/689
Matching with Invariant Features
Darya Frolova, Denis Simakov
The Weizmann Institute of Science
March 2004
Computer Vision : CISC 4/689
Example: Build a Panorama
Computer Vision : CISC 4/689
M. Brown and D. G. Lowe. Recognising Panoramas. ICCV 2003
How do we build panorama?
• We need to match (align) images
Computer Vision : CISC 4/689
Matching with Features
•Detect feature points in both images
Computer Vision : CISC 4/689
Matching with Features
•Detect feature points in both images
•Find corresponding pairs
Computer Vision : CISC 4/689
Matching with Features
•Detect feature points in both images
•Find corresponding pairs
•Use these pairs to align images
Computer Vision : CISC 4/689
Matching with Features
• Problem 1:
– Detect the same point independently in both images
no chance to match!
We need a repeatable detector
Computer Vision : CISC 4/689
Matching with Features
• Problem 2:
– For each point correctly recognize the corresponding one
?
We need a reliable and distinctive descriptor
Computer Vision : CISC 4/689
More motivation…
• Feature points are used also for:
–
–
–
–
–
–
–
Image alignment (homography, fundamental matrix)
3D reconstruction
Motion tracking
Object recognition
Indexing and database retrieval
Robot navigation
… other
Computer Vision : CISC 4/689
Corner Detection
• Basic idea: Find points where two edges meet—i.e., high gradient in two
directions
• “Cornerness” is undefined at a single pixel, because there’s only one
gradient per point
– Look at the gradient behavior over a small window
• Categories image windows based on gradient statistics
–
–
–
–
Constant: Little or no brightness change
Edge: Strong brightness change in single direction
Flow: Parallel stripes
Corner/spot: Strong brightness changes in orthogonal directions
Computer Vision : CISC 4/689
Corner Detection:
Analyzing Gradient Covariance
•
Intuitively, in corner windows both Ix and Iy should be high
–
Can’t just set a threshold on them directly, because we want rotational invariance
•
Analyze distribution of gradient components over a window to differentiate between types from previous
slide:
•
The two eigenvectors and eigenvalues ¸1, ¸2 of C (Matlab: eig(C)) encode the predominant directions
and magnitudes of the gradient, respectively, within the window
Corners are thus where min(¸1, ¸2) is over a threshold
•
courtesy of Wolfram
Computer Vision : CISC 4/689
Contents
•
•
•
Harris Corner Detector
– Description
– Analysis
Detectors
– Rotation invariant
– Scale invariant
– Affine invariant
Descriptors
– Rotation invariant
– Scale invariant
– Affine invariant
Computer Vision : CISC 4/689
Harris Detector: Mathematics
Change of intensity for the shift [u,v]:
Taylor series:
F(x+dx,y+dy) = f(x,y)
+fx(x,y)dx+fy(x,y)dy+…
http://mathworld.wolfram.com.TaylorSeries.html
E (u , v)   w( x, y )  I ( x  u , y  v)  I ( x, y ) 
2
x, y
Window
function
Shifted
intensity
Window function w(x,y) =
Intensity
or
1 in window, 0 outside
Computer Vision : CISC 4/689
Gaussian
Harris Detector: Mathematics
For small shifts [u,v] we have a bilinear approximation:
E (u, v)  u, v 
u 
M  
v 
where M is a 22 matrix computed from image derivatives:
 I x2
M   w( x, y ) 
x, y
 I x I y
Computer Vision : CISC 4/689
IxI y 
2 
I y 
Harris Detector: Mathematics
Intensity change in shifting window: eigenvalue analysis
E (u, v)  u, v 
u 
M  
v 
1, 2 – eigenvalues of M
If we try every possible orientation n,
the max. change in intensity is 2
Ellipse E(u,v) = const
1
2
Computer Vision : CISC 4/689
Harris Detector: Mathematics
Classification of
image points using
eigenvalues of M:
2
“Edge”
2 >> 1
“Corner”
1 and 2 are large,
1 ~ 2 ;
E increases in all
directions
1 and 2 are small;
E is almost constant
in all directions
“Flat”
region
Computer Vision : CISC 4/689
“Edge”
1 >> 2
1
Harris Detector: Mathematics
Measure of corner response:
R  det M  k  trace M 
2
det M  12
trace M  1  2
(k – empirical constant, k = 0.04-0.06)
Computer Vision : CISC 4/689
Harris Detector: Mathematics
2
• R depends only on
eigenvalues of M
“Edge”
R<0
• R is large for a corner
“Corner”
R>0
• R is negative with large
magnitude for an edge
• |R| is small for a flat
region
“Flat”
|R| small
Computer Vision : CISC 4/689
“Edge”
R<0
1
Harris Detector
• The Algorithm:
– Find points with large corner response function R (R > threshold)
– Take the points of local maxima of R
Computer Vision : CISC 4/689
Harris Detector: Workflow
Computer Vision : CISC 4/689
Harris Detector: Workflow
Compute corner response R
Computer Vision : CISC 4/689
Harris Detector: Workflow
Find points with large corner response: R>threshold
Computer Vision : CISC 4/689
Harris Detector: Workflow
Take only the points of local maxima of R
Computer Vision : CISC 4/689
Harris Detector: Workflow
Computer Vision : CISC 4/689
Example: Gradient Covariances
Corners are where both eigenvalues are big
from Forsyth & Ponce
Full image
Detail of image with gradient covariance ellipses for 3 x 3 windows
Computer Vision : CISC 4/689
Example: Corner Detection
(for camera calibration)
Computer Vision : CISC 4/689
courtesy of B. Wilburn
Example: Corner Detection
courtesy of S. Smith
SUSAN corners
Computer Vision : CISC 4/689
Harris Detector: Summary
•
Average intensity change in direction [u,v] can be expressed as a bilinear
form:
E (u, v)  u, v 
u 
M  
v 
•
Describe a point in terms of eigenvalues of M:
measure of corner response
•
A good (corner) point should have a large intensity change in all directions,
i.e. R should be large positive
R  12  k  1  2 
Computer Vision : CISC 4/689
2
Contents
•
•
•
Harris Corner Detector
– Description
– Analysis
Detectors
– Rotation invariant
– Scale invariant
– Affine invariant
Descriptors
– Rotation invariant
– Scale invariant
– Affine invariant
Computer Vision : CISC 4/689
Tracking: compression of video information
• Harris response (uses criss-cross gradients)
• Dinosaur tracking (using features)
• Dinosaur Motion tracking (using correlation)
• Final Tracking (superimposed)
Courtesy: (http://www.toulouse.ca/index.php4?/CamTracker/index.php4?/CamTracker/FeatureTracking.html)
This figure displays results of feature detection over the dinosaur test
sequence with the algorithm set to extract the 6 most "interesting"
features at every image frame.
It is interesting to note that although no attempt to extract frame-to-frame
feature correspondences was made, the algorithm still extracts the
same set of features at every frame.
This will be useful very much in feature tracking.
Computer Vision : CISC 4/689
One More..
• Office sequence
• Office Tracking
Computer Vision : CISC 4/689
Harris Detector: Some Properties
• Rotation invariance
Ellipse rotates but its shape (i.e. eigenvalues)
remains the same
Corner response R is invariant to image rotation
Computer Vision : CISC 4/689
Harris Detector: Some Properties
• Partial invariance to affine intensity change
 Only derivatives are used => invariance
to intensity shift I  I + b
 Intensity scale: I  a I
R
R
threshold
x (image coordinate)
Computer Vision : CISC 4/689
x (image coordinate)
Harris Detector: Some Properties
• But: non-invariant to image scale!
All points will be
classified as edges
Corner !
Computer Vision : CISC 4/689
Harris Detector: Some Properties
•
Quality of Harris detector for different scale changes
-- Correspondences calculated using distance (and threshold)
-- Improved Harris is proposed by Schmid et al
-- repeatability rate is defined as the number of points
repeated between two images w.r.t the total number of
detected points.
 Repeatability rate:
# correspondences
# possible correspondences
Imp.Harris uses derivative of Gaussian
instead of standard template used by
Harris et al.
Computer Vision : CISC 4/689
C.Schmid et.al. “Evaluation of Interest Point Detectors”. IJCV 2000
Contents
•
•
•
Harris Corner Detector
– Description
– Analysis
Detectors
– Rotation invariant
– Scale invariant
– Affine invariant
Descriptors
– Rotation invariant
– Scale invariant
– Affine invariant
Computer Vision : CISC 4/689
We want to:
detect the same interest points regardless of
image changes
Computer Vision : CISC 4/689
Models of Image Change
• Geometry
– Rotation
– Similarity (rotation + uniform scale)
– Affine (scale dependent on direction)
valid for: orthographic camera, locally planar object
• Photometry
– Affine intensity change (I  a I + b)
Computer Vision : CISC 4/689
Contents
•
•
•
Harris Corner Detector
– Description
– Analysis
Detectors
– Rotation invariant
– Scale invariant
– Affine invariant
Descriptors
– Rotation invariant
– Scale invariant
– Affine invariant
Computer Vision : CISC 4/689
Rotation Invariant Detection
• Harris Corner Detector
Computer Vision : CISC 4/689
C.Schmid et.al. “Evaluation of Interest Point Detectors”. IJCV 2000
Contents
•
•
•
Harris Corner Detector
– Description
– Analysis
Detectors
– Rotation invariant
– Scale invariant
– Affine invariant
Descriptors
– Rotation invariant
– Scale invariant
– Affine invariant
Computer Vision : CISC 4/689
Scale Invariant Detection
• Consider regions (e.g. circles) of different sizes around a point
• Regions of corresponding sizes will look the same in both images
Computer Vision : CISC 4/689
Scale Invariant Detection
• The problem: how do we choose corresponding circles independently
in each image?
Computer Vision : CISC 4/689
Scale Invariant Detection
•
Solution:
– Design a function on the region (circle), which is “scale invariant” (the
same for corresponding regions, even if they are at different scales)
Example: average intensity. For corresponding regions
(even of different sizes) it will be the same.
– For a point in one image, we can consider it as a
function of region size (circle radius)
f
Image 1
f
Image 2
scale = 1/2
Computer Vision : CISC 4/689
region size
region size
Scale Invariant Detection
• Common approach:
Take a local maximum of this function
Observation: region size, for which the maximum is
achieved, should be invariant to image scale.
Important: this scale invariant region size is
found in each image independently!
Image 1
f
f
Image 2
scale = 1/2
Computer Vision : CISC 4/689
s1
region size
s2
region size
Scale Invariant Detection
• A “good” function for scale detection:
has one stable sharp peak
f
f
bad
region size
f
Good !
bad
region size
region size
• For usual images: a good function would be the one
with contrast (sharp local intensity change)
Computer Vision : CISC 4/689
Scale Invariant Detection
f  Kernel  Image
• Functions for determining scale
Kernels:
L   2  Gxx ( x, y,  )  G yy ( x, y,  ) 
(Laplacian)
DoG  G( x, y, k )  G( x, y,  )
(Difference of Gaussians)
where Gaussian
G ( x, y ,  ) 
1
2

e
x2  y 2
2 2
Note: both kernels are invariant to
scale and rotation
Computer Vision : CISC 4/689
scale
Find local maximum of:
– Harris corner detector in space
(image coordinates)
– Laplacian in scale
• SIFT (Lowe)2
Find local maximum of:
– Difference of Gaussians in
space and scale
1 K.Mikolajczyk,
y
 Harris 
x
 DoG 
x
scale
 DoG 
• Harris-Laplacian1
 Laplacian 
Scale Invariant Detectors
y
C.Schmid. “Indexing
Based on Scale Invariant Interest Points”. ICCV 2001
Computer Vision : CISC 4/689
2 D.Lowe. “Distinctive Image Features from Scale-Invariant Keypoints”. Accepted to IJCV 2004
Harris Laplacian
• Characteristic Scale: Given a point in an image, compute
the function responses for several factors sn The
characteristic scale is the local max. of the function (can be
more than one).
• Easy to look for zero-crossings of 2nd derivative than
maxima.
• The ratio of the scales, at which the extrema were found
for corresponding points in two rescaled images, is equal
to the scale factor between the images.
• Then what..?
Computer Vision : CISC 4/689
Harris-Laplacian
• Existing methods search for maxima in the 3D representation of an
image (x,y,scale). A feature point represents a local maxima in the
surrounding 3D cube and its value is higher than a threshold.
• THIS (Harris-Laplacian) method uses Harris function first, then
selects points for which Laplacian attains maximum over scales.
• First, prepare scale-space representation for the Harris function. At
each level, detect interest points as local maxima in the image plane (of
that scale) – do this by comparing 8-neighborhood. (different from
plain Harris corner detection)
• Second, use Laplacian to judge if each of the candidate points found
on different levels, if it forms a maximum in the scale direction. (check
with n-1 and n+1)
Computer Vision : CISC 4/689
Scale Invariant Detectors
• Experimental evaluation of detectors
w.r.t. scale change
Repeatability rate:
# correspondences
# possible correspondences
(points present)
Computer Vision : CISC 4/689
K.Mikolajczyk, C.Schmid. “Indexing Based on Scale Invariant Interest Points”. ICCV 2001
Scale Invariant Detection: Summary
• Given: two images of the same scene with a large scale difference
between them
• Goal: find the same interest points independently in each image
• Solution: search for maxima of suitable functions in scale and in space
(over the image)
Methods:
1.
Harris-Laplacian [Mikolajczyk, Schmid]: maximize Laplacian over
scale, Harris’ measure of corner response over the image
2.
SIFT [Lowe]: maximize Difference of Gaussians over scale and space
Computer Vision : CISC 4/689