CS代写 Edge detection

Edge detection
• Converta2Dimageintoasetofcurves – Extracts salient features of the scene
– More compact than pixels

Copyright By PowCoder代写 加微信 powcoder

Edge detection
• Goal: Identify visual changes (discontinuities) in an image.
• Intuitively, semantic information is encoded in edges.
• What are some ‘causes’ of visual edges?
Source: D. of Edges
surface normal discontinuity depth discontinuity
surface color discontinuity illumination discontinuity
• Edges are caused by a variety of factors

Images as functions…
• Edges look like steep cliffs

Closeup of edges
Source: D. Hoiem

Closeup of edges
Source: D. Hoiem

Closeup of edges
Source: D. Hoiem

Closeup of edges
Source: D. Hoiem

Characterizing edges
• An edge is a place of rapid change in the image intensity function
intensity function (along horizontal scanline)
first derivative
Source: L. Lazebnik
edges correspond to extrema of derivative

Image derivatives
• How can we differentiate a digital image F[x,y]? – Option 1: reconstruct a continuous image, f, then
compute the derivative
– Option 2: take discrete derivative (finite difference)
How would you implement this as a linear filter?
Source: S. gradient
• The gradient of an image:
The gradient points in the direction of most rapid increase in intensity
The edge strength is given by the gradient magnitude:
The gradient direction is given by:
Source: Steve gradient
Source: L. Lazebnik

Effects of noise
Noisy input image
Where is the edge?
Source: S. : smooth first
To find edges, look for peaks in
Source: S. property of convolution
• Differentiation is convolution, and convolution is associative:
• This saves us one operation:
Source: S. 1D Gaussian and its derivatives

2D edge detection filters
derivative of Gaussian (x)

Derivative of Gaussian filter
x-direction
y-direction

The Sobel operator
• Common approximation of derivative of Gaussian
• The standard defn. of the Sobel operator omits the 1/8 term – doesn’t make a difference for edge detection
– the 1/8 term is needed to get the right gradient magnitude

Sobel operator: example
x-gradient y-gradient gradient magnitude
Source: Wikipedia

Sobel operator
Original Magnitude Orientation

Laplacian of Gaussian (LoG) • Consider
Laplacian of Gaussian operator
Where is the edge? Zero-crossings of bottom graph

2D edge detection filters
Gaussian derivative of Gaussian
is the Laplacian operator:
Laplacian of Gaussian

Laplacian for Edge Detection

Using the LoG Function
• The LoG function will be
– Zero far away from the edge
– Positive on one side
– Negative on the other side – Zero just at the edge
• Therefore, it can be used as an edge operator • BUT, is this good enough?

Designing an edge detector • Criteria for a good edge detector:
– Good detection: the optimal detector should find all real edges, ignoring noise or other artifacts
– Good localization
• the edges detected must be as close as possible to
the true edges
• the detector must return one point only for each true edge point
• Cues of edge detection
– Differences in color, intensity, or texture across the
– Continuity and closure
– High-level knowledge
Source: L. Fei- edge detector
• This is probably the most widely used edge detector in computer vision
J. Canny, A Computational Approach To Edge Detection, IEEE Trans. Pattern Analysis and Machine Intelligence, 8:679-714, 1986.
Source: L. Fei-Fei

• original image (Lena)

Finding edges
gradient magnitude

Finding edges
thresholding
where is the edge?

Get Orientation at Each Pixel
• Threshold at minimum level
• Get orientation
theta = atan2(gy, gx)

Non-maximum suppression
1. Perform comparisons on the edge strength of the current pixel with the edge strength of the pixel in the positive and negative gradient directions.
2. Preserve the largest and suppress the others.
• Check if pixel is local maximum along gradient direction
Picture from Kalra

Before Non-max Suppression

After Non-max Suppression

Finding edges
thresholding

Finding edges
thinning (non-maximum suppression)

Canny edge detector MATLAB: edge(image,‘canny’)
1. 2. 3. 4.
Filter image with derivative of Gaussian Find magnitude and orientation of gradient Non-maximum suppression
Linking and thresholding (hysteresis):
– Define two thresholds: low and high
– Use the high threshold to start edge curves and the low threshold to continue them
Source: D. Lowe, L. Fei-Fei

‘Hysteresis’ thresholding
• Two thresholds – high and low
• Grad. mag. > high threshold? = strong edge
• Grad. mag. < low threshold? noise • In between = weak edge • ‘Follow’ edges starting from strong edge pixels • Continue them into weak edges • Connected components (Szeliski 3.3.4) Source: S. Canny Edges 𝜎 = 2,𝑡!"# = 0.05,𝑡$%&$ = 0.1 Effect of s (Gaussian kernel spread/size) The choice of s depends on desired behavior • large s detects large scale edges • small s detects fine features Source: S. Characteristics • TheCannyoperatorgivessingle-pixel-wideimages with good continuation between adjacent pixels • Itisprobablythemostwidelyusededgeoperator today; no one has done better since it came out in the late 80s. Many implementations are available. • Itisverysensitivetoitsparameters,whichneedto be adjusted for different application domains. J. Canny, A Computational Approach To Edge Detection, IEEE Trans. Pattern Analysis and Machine Intelligence, 8:679-714, 1986. 程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com