EDGE DETECTION
EDGE DETECTION
Edge is a set of connected pixels that lie on the boundary between two regions.
When pixel intensity is plotted along a particular spatial dimension, the existence of edge
should mean sudden jump or step.
All edge detection algorithms are based on the above two principles. The 1st derivative is
used to find the edge pixel and the sign of the second derivative can be used to determine
whether the edge pixel lies on the dark side or the light side.
𝜕𝑓/𝜕𝑥
∆𝑓(𝑥, 𝑦) = ) ,
𝜕𝑓/𝜕𝑦
𝜕𝑓/𝜕𝑦
tan45 ) ,
𝜕𝑓/𝜕𝑥
Most common kernels used for the gradient edge detector are th Roberts, Prewitt and Sobel
edge operators.
1 0 0 1
𝑓; = < > 𝑓? = < >
0 −1 −1 0
−1 −1 −1 −1 0 1
𝑓; = @ 0 0 0A 𝑓? = @−1 0 1A
1 1 1 −1 0 1
−1 −2 −1 −1 0 1
𝑓; = @ 0 0 0A 𝑓? = @−2 0 2A
1 2 1 −1 0 1
Steps:
Edge pixels are those for which |∆𝑓| > 𝑇 where 𝑇 is a suitable threshold.
𝜕/𝑓 𝜕/𝑓
∇/ 𝑓 = +
𝜕𝑥 / 𝜕𝑦 /
MN
Now, M;
= 𝑓 [𝑥 + 1, 𝑦] − 𝑓[𝑥, 𝑦]
MO N M MN M
And M; O = M; M; = M; (𝑓 [𝑥 + 1, 𝑦] − 𝑓[𝑥, 𝑦])
𝜕/𝑓
= (𝑓[𝑥 + 1, 𝑦] − 𝑓[𝑥, 𝑦]) − (𝑓 [𝑥, 𝑦] − 𝑓(𝑥 − 1, 𝑦])
𝜕𝑥 /
𝜕/𝑓
= 𝑓[𝑥 + 1, 𝑦] − 2𝑓[𝑥, 𝑦] + 𝑓(𝑥 − 1, 𝑦]
𝜕𝑥 /
Similarly,
𝜕/𝑓
= 𝑓[𝑥, 𝑦 + 1] − 2𝑓[𝑥, 𝑦] + 𝑓(𝑥, 𝑦 − 1]
𝜕𝑦 /
Thus,
0 1 0
@1 −4 1A
0 1 0
1 1 1
@1 −8 1A
1 1 1
1) In natural images , features of interest occurs at variety of scales. No single operator can
function at all these scales. So the results of the operators at each of the many scales should
be combined.
2) A natural scene does not consist of diffraction pattern or other wavelike effects, so some
sort of local averaging must take place
3) The optimal smoothing filter that matches the observed requirements is Gaussain
4) when a change in intensity (edge) occurs, there is an extreme value in the first derivative
for intensity. This corresponds to a zero crossing in the second derivative
5) the orientation independent differential operator of lowest order is Laplacian
1 𝑥 / + 𝑦 / 4; O Z?O O
𝐿𝑂𝐺(𝑥, 𝑦) = − / W1 − X 𝑒 /[
𝜋𝜎 2𝜎 /
Canny Edge Detector:
The Canny edge detector is an edge detection operator that uses a multi-stage algorithm to
detect a wide range of edges in images. Canny edge detection is a technique to extract useful
structural information from different vision objects and dramatically reduce the amount of
data to be processed. It has been widely applied in various computer vision systems. The
general criteria for edge detection include:
1. Detection of edge with low error rate, which means that the detection should
accurately catch as many edges shown in the image as possible
2. The edge point detected from the operator should accurately localize on the
centre of the edge.
3. A given edge in the image should only be marked once, and where possible,
image noise should not create false edges.
Algorithm:
• Smooth the image with Gaussain filter : If more detail of image is required then the
variance of the filter is made large. For less details, variance is made small.
• Gradient Operation: Find the intensity gradients of the image
• Non-Maximal Suppression: Consider the pixel in the neighbourhood of the current
pixel. If the gradient magnitude of either pixel is greater than the current pixel, mark
current pixel as non edge.
• Thresholding with hysteresis:
A pixel with 𝑇^ < ∇𝑓 < 𝑇\ is marked as edge only if it is connected to a strong edge
• Edge linking: After labelling the edges, we have to link the similar edges to get the
object boundary. Two neighbouring points (𝑥5 , 𝑦5 ) and (𝑥/ , 𝑦/ ) are linked if the two
conditions are satisfied
∇𝑓(𝑥5 , 𝑦5 ) − ∇𝑓(𝑥/ , 𝑦/ ) < 𝑇/
|∇𝑓(𝑥5 , 𝑦5 ) − ∇𝑓(𝑥/ , 𝑦/ )| < 𝑇5