[06-30213][06-30241][06-25024]
Computer Vision and Imaging &
Robot Vision
Dr Hyung Jin Chang Dr Yixing Gao
h.j.chang@bham.ac.uk y.gao.8@bham.ac.uk
School of Computer Science
Image Gradient / Edges
Reading: (Szeliski 3.2.3)
Hyung Jin Chang
Lecture 1 – 2 14/02/2021
Edge detection
• Goal: map image from 2D array of pixels to a set of curves or line segments or contours.
• Why?
Figure from J. Shotton et al., PAMI 2007
• Main idea: look for strong gradients, post-process Slide credit: Kristen Grauman
What causes an edge?
Depth discontinuity:
Reflectance change: appearance information,
local texture
object boundary
Cast shadows
Change in surface orientation:
shape changes
Edges/gradients and invariance
Derivatives and edges
An edge is a place of rapid change in the image intensity function.
image
intensity function (along horizontal scanline)
first derivative
255
0
edge
edge
Slide credit: Svetlana Lazebnik
edges correspond to extrema of derivative
Derivatives with convolution
For 2D function, f(x,y), the partial derivative is: ¶f(x,y)=lim f(x+e,y)-f(x,y)
¶xe®0 e
For discrete data, we can approximate using finite differences:
¶f(x,y)» f(x+1,y)-f(x,y) ¶x 1
Question: If implemented by convolution, what would the convolution kernel for derivative look like?
Slide credit: Kristen Grauman
¶f (x, y) ¶x
¶f (x, y) ¶y
? or
Partial derivatives of an image
-1
1
1
-1
-1
1
Which shows changes with respect to x? Slide credit: Kristen Grauman (showing filters for correlation)
Image gradient The gradient of an image:
The gradient points in the direction of most rapid change in intensity
The gradient direction (orientation of edge normal) is given by: The edge (gradient) strength is given by the gradient magnitude
Slide credit: Steve Seitz
Effects of noise
Consider a single row or column of the image
• Plotting intensity as a function of position gives a signal
Where is the edge? Noise gets amplified by derivation… Slide credit: Steve Seitz
Effects of noise
• Difference filters respond strongly to noise
• Image noise results in pixels that look very different from their neighbors
• Generally, the larger the noise the stronger the response
• What can we do about it?
Source: D. Forsyth
Solution: smooth first
Where is the edge?
Find peaks (maxima) in
Slide credit: Kristen Grauman
Derivative theorem of convolution Differentiation property of convolution.
Slide credit: Steve Seitz
2D Partial Derivatives – naïve way
Smarter Way
Smarter Way
Smarter Way
Gaussian Partial Derivatives
Some Other Popular Kernels
>> My = fspecial(‘sobel’);
>> outim = imfilter(double(im), My); >> imagesc(outim);
>> colormap gray;
Slide credit: Kristen Grauman
Mask properties
• Smoothing
– Values positive
– Sum to 1àconstant regions same as input
– Amount of smoothing proportional to mask size
– Remove “high-frequency” components; “low-pass” filter
• Derivatives
– ___________ signs used to get high response in regions of high contrast
– Sum to ___àno response in constant regions
– High absolute value at points of high contrast
Slide credit: Kristen Grauman
Laplacian of Gaussian Consider
Laplacian of Gaussian operator
Where is the edge?
Where the function intersects with x (y=0): Zero-crossings of bottom graph
Slide credit: Steve Seitz
2D edge detection filters
Gaussian derivative of Gaussian
• is the Laplacian operator:
Laplacian of Gaussian
Slide credit: Steve Seitz
Laplacian ≈ Difference of Gaussians
–
=
DoG = Difference of Gaussians
Fast approximation, avoids derivatives.
–
=
Vir: B. Leibe
Smoothing with a Gaussian Recall: parameter σ is the “scale” / “width” / “spread” of the
Gaussian kernel, and it controls the amount of smoothing.
…
Slide credit: Kristen Grauman
Effect of σ on derivatives
σ = 1 pixel σ = 3 pixels
The apparent structures differ depending on Gaussian’s scale parameter.
Larger values: larger scale edges detected Smaller values: finer features detected
So, what scale to choose? It depends what we’re looking for.
Different structures are found on different scales!
Slide credit: Kristen Grauman
Laplacian Pyramid
Laplacian Pyramid
Edge Detection Using the 2nd Derivative
Edge Detection Using the 2nd Derivative
Edge Detection Using the 2nd Derivative
Gradient vs LoG
Thank you
Hyung Jin Chang
14/02/2021