Escolar Documentos
Profissional Documentos
Cultura Documentos
cume(roof) impulso(spike)
Gráfico sem e com ruído
Derivadas e arestas
1
f i 1 f i f '
i f "
i (a)
2
Com x=-1, f(x)=fi e f(x+x)=fi-1
1 (b)
f i 1 f i f '
i f "
i
2
Aproximações para derivadas
f(x)
fi fi+1
fi-1
i-1 i i+1 x
(a-b) f '
i ( f i 1 f i 1 ) / 2
(a+b) f "
i ( f i 1 2 f i f i 1 )
Em 2D
Gradiente
f x, y f xn 1 , ym f xn , ym 1 1
f
x x x
f ( x, y ) f
1
y
f x, y f xn , ym1 f xn , ym
1
y x
Convolution Kernels
Laplaciano
2 f 2 f 1 4 1
f ( x, y )
2
x 2
y 2 4 20 4
1
4 1
Laplaciano
•Sometimes we are interested only in changing magnitude without regard to the changing orientation.
•A linear differential operator called the Laplacian may be used.
•The Laplacian has the same properties in all directions and is therefore invariant to rotation in the image.
f "
i ( f i 1 2 f i f i 1 )
http://www.cee.hw.ac.uk/hipr/html/log.html
http://ct.radiology.uiowa.edu/~jiangm/courses/dip/html/node83.html
Finite differences
I x I * 1 1
I 1
Iy I *
Khurram Hassan-Shafique
1
Classical Operators
Prewitt’s Operator
1 0 1
1 1 1 0 1
1 1 1 1
1 0 1
1 1
Smooth Differentiate
1 1 1
1 1 1 1 0 0 0
1 1 1 1
1 1 1
Khurram Hassan-Shafique
Classical Operators
Sobel’s Operator
1 0 1
1 1 2 0 2
2 2 1 1
1 0 1
1 1
Differentiate
Smooth
1 2 1
1 2 1 1 0
1 2 1 1 0 0
1 2 1
Khurram Hassan-Shafique
Detecting Edges in Image
1 0 1
2 0 2 d
I
dx
1 0 1
2
d d
2
* I I
dx dy Edges
Threshold
Image I
1 2 1
* 0 d
0 0 I
dy
1 2 1
Khurram Hassan-Shafique
Sobel Edge Detector
d
I
dx
d
I
dy
Khurram Hassan-Shafique
Sobel Edge Detector
2
d d
2
I I
dx dy
Threshold 100
Khurram Hassan-Shafique
Marr and Hildreth Edge Operator
• Smooth by Gaussian x2 y2
S G * I 1
G e 2 2
2
• Use Laplacian to find derivatives
2 2
S 2 S 2 S
2
x y
Khurram Hassan-Shafique
Marr and Hildreth Edge Operator
2 S 2 G * I 2G * I
x2 y2
1 x y 2 2
G
2
2
3
e 2 2
2 2
Khurram Hassan-Shafique
Marr and Hildreth Edge Operator
x2 y2
1 x y 2 2
G
2
2
3
e 2 2
2 2
Y
0.0008 0.0066 0.0215 0.031 0.0215 0.0066 0.0008
0.0066 0.0438 0.0982 0.108 0.0982 0.0438 0.0066
0.0215 0.0982 0 -0.242 0 0.0982 0.0215 X
0.031 0.108 -0.242 -0.7979 -0.242 0.108 0.031
0.0215 0.0982 0 -0.242 0 0.0982 0.0215
0.0066 0.0438 0.0982 0.108 0.0982 0.0438 0.0066
0.0008 0.0066 0.0215 0.031 0.0215 0.0066 0.0008
Khurram Hassan-Shafique
Marr and Hildreth Edge Operator
Image I 2G * I Edge Image
2
* G Zero Crossings
Detection
3
6
Khurram Hassan-Shafique
Quality of an Edge Detector
• Robustness to Noise
• Localization
• Too Many/Too less Responses True Edge
• Single Response Constraint: The detector must return one point only for
each edge point.
Khurram Hassan-Shafique
Hai Tao
The result
– General form of the filter (N.B. the filter is odd so h(x) = -h(-x) the following expression
is for x < 0 only)
a1 01486768717
.
2.05220
a2 0.2087553476
2.91540
a3 1244653939
.
156939
.
a4 0.7912446531
1 2
Camillo J. Taylor
Approximation
– Canny’s filter can be approximated by the derivative of a Gaussian
x2 x2
d 2 x 2
h( x ) ( e 2
) e 2
dx 2
Camillo J. Taylor
Canny Edge Detector
Khurram Hassan-Shafique
Algorithm Canny_Enhancer
• Smooth by Gaussian
x2 y2
S G * I G
1
e 2 2
2
• Compute x and y derivatives
T
S S S Sx Sy
T
x y
• Compute gradient magnitude and orientation
S S x2 S y2
Sy
tan 1
Sx Khurram Hassan-Shafique
Canny Edge Operator
S G * I G * I
T
G G
G
x y
T
G G
S *I *I
x y
Khurram Hassan-Shafique
Canny Edge Detector
Sx
Sy
Khurram Hassan-Shafique
Canny Edge Detector
S S x2 S y2
S Threshold 25
Khurram Hassan-Shafique
Algorithm Non-Maximum Suppression
We wish to mark points along the curve where the magnitude is biggest.
We can do this by looking for a maximum along a slice normal to the curve
(non-maximum suppression). These points should form a curve. There are
then two algorithmic issues: at which point is the maximum, and where is the
next one? Khurram Hassan-Shafique
Non-Maximum Suppression
• Suppress the pixels in ‘Gradient Magnitude Image’ which
are not local maximum
Khurram Hassan-Shafique
Non-Maximum Suppression
Sy
tan θ 2
Sx 3 1
Khurram Hassan-Shafique
Non-Maximum Suppression
S S x2 S y2 M
M Threshold 25
Khurram Hassan-Shafique
Hysteresis Thresholding
Khurram Hassan-Shafique
Hysteresis Thresholding
Khurram Hassan-Shafique
Hysteresis Thresholding
M M Threshold 25
High 35
Low 15
Khurram Hassan-Shafique
Resultado de algoritmo de histerese
–
Subpixel Localization
One can try to further localize the position of the edge within a pixel by analyzing the response to the
edge enhancement filter
– One common approach is to fit a quadratic polynomial to the filter response in the region of a maxima
and compute the true maximum.
y ( x ) ax 2 bx c
y (0) c;
y (1) a b c;
y ( 1) a b c
1
b ( y (1) y ( 1));
2
1
a ( y (1) y ( 1)) y (0);
2
-1 0 1 b
xmax
2a
Derivadas direcionais
f(x,y) f ( p) f ( p h n ) f ( p)
lim
n h 0 h
f f n f n
y n x x y y f
f f f f n
nx
n nx n y n
x n x y
ny
f
f f f f f n x
2
n x
n y f
x
n n n x
y n y
y
Detecting corners
Ex Ex 2 Ex E y
C E x Ey
E E 2
Ey x y Ey
Camillo J. Taylor
Examining the matrix
– One way to decide on the presence of a corner is to look at the eigenvalues
of the 2 by 2 matrix C.
• If the area is a region of constant intensity we would expect both
eigenvalues to be small
• If it contains a edge we expect one large eigenvalue and one small one
• If it contains edges at two or more orientations we expect 2 large
eigenvalues
Camillo J. Taylor
Finding corners
• 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
Contents
• Harris Corner Detector
– Description
– Analysis
• Detectors
– Rotation invariant
– Scale invariant
– Affine invariant
• Descriptors
– Rotation invariant
– Scale invariant
– Affine invariant
Harris Detector: Mathematics
Change of intensity for the shift [u,v]:
E (u, v) w( x, y ) I ( x u, y v) I ( x, y )
2
x, y
u
E (u, v) u, v M
v
I x2 IxI y
M w( x, y ) 2
x, y I x I y I y
Harris Detector: Geometric Interpretation
u
E (u, v) u, v M
v
0 T u 1 0 u'
E u vR 1 R u ' v ' const
0 2 v 0 2 v'
1, 2 – eigenvalues of M
(max)-1/2
(min)-1/2
1 (u' ) 2 2 (v' ) 2 const
Harris Detector: Mathematics
Classification of 2 “Edge”
image points using 2 >> 1 “Corner”
eigenvalues of M: 1 and 2 are large,
1 ~ 2 ;
E increases in all
directions
1
Harris Detector: Mathematics
Measure of corner response:
R det M k trace M
2
det M 12
trace M 1 2
2 “Edge” “Corner”
R<0
R>0
“Flat” “Edge”
|R| small R<0
1
Algoritmo
R det M k trace M
2
2 “Edge” “Corner”
R<0
R>0
“Flat” “Edge”
|R| small R<0
1
Algoritmo
R det M k trace M
2
2 “Edge” “Corner”
R<0
R>0
“Flat” “Edge”
|R| small 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
Harris Detector: Workflow
Harris Detector: Workflow
Compute corner response R
Harris Detector: Workflow
Find points with large corner response: R>threshold
Harris Detector: Workflow
Take only the points of local maxima of R
Harris Detector: Workflow
Example: Gradient Covariances
courtesy of B. Wilburn
Example: Corner Detection
courtesy of S. Smith
SUSAN corners
Harris Detector: Summary
• A good (corner) point should have a large intensity change in all directions,
i.e. R should be large positive
R 12 k 1 2
2
Contents
• Harris Corner Detector
– Description
– Analysis
• Detectors
– Rotation invariant
– Scale invariant
– Affine invariant
• Descriptors
– Rotation invariant
– Scale invariant
– Affine invariant
Tracking: compression of video information
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.
One More..
• Office sequence
• Office Tracking
Harris Detector: Some Properties
• Rotation invariance
R R
threshold
Fine/Low Coarse/High
Scale Invariant Detection
• The problem: how do we choose corresponding circles independently
in each image?
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)
f Image 1 f Image 2
scale = 1/2
f f f Good !
bad bad
region size region size region size
L 2 Gxx ( x, y, ) G yy ( x, y, )
(Laplacian)
DoG G ( x, y, k ) G ( x, y, )
(Difference of Gaussians)
where Gaussian
x2 y 2
Note: both kernels are invariant to
G( x, y, ) 1
2
e 2 2
scale and rotation
Build Scale-Space Pyramid
Blur
Subtract
R
e
sa
mple
B
lu
r
S
ubtr
act
Key point localization
Blur
Subtract
space
Scale Invariant Detectors
Laplacian
• Harris-Laplacian1 scale
Find local maximum of:
– Harris corner detector in space
(image coordinates)
– Laplacian in scale y
Harris x
DoG
Find local maximum of:
– Difference of Gaussians in
space and scale y
DoG x
1 K.Mikolajczyk, C.Schmid. “Indexing Based on Scale Invariant Interest Points”. ICCV 2001
2 D.Lowe. “Distinctive Image Features from Scale-Invariant Keypoints”. Accepted to IJCV 2004
Normal, Gaussian..
Repeatability rate:
# correspondences
# possible correspondences
(points present)
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
Contents
• Harris Corner Detector
– Description
– Analysis
• Detectors
– Rotation invariant
– Scale invariant
– Affine invariant (maybe later)
• Descriptors
– Rotation invariant
– Scale invariant
– Affine invariant
Affine Invariant Detection
• Above we considered:
Similarity transform (rotation + uniform scale)
• Now we go on to:
Affine transform (rotation + non-uniform scale)
Affine Invariant Detection
• Take a local intensity extremum as initial point
• Go along every ray starting from this point and stop when extremum of
function f is reached
Methods:
1. Search for extremum along rays [Tuytelaars, Van Gool]:
2. Maximally Stable Extremal Regions [Matas et.al.]
SIFT
• Introdução
• Motivação
• Visão Geral do Algoritmo
Introdução
• O que é o SIFT?
– Scale Invariant Feature Transform
David Lowe
Motivação
by lowe
Visão Geral do Algoritmo
by Brandon Green
•
Detecção dos máximos
Usa o DoG para calcular os keypoints
L ( x , y , ) G ( x, y , ) I ( x , y ) (def. espaço de Escala)
Detecção dos máximos
1. Imagem inicial
2. Maximos
3. Eliminando por
contraste
4. Eliminando por
localização ruim
Cálculo da Orientação