The Canny Edge Detector is a multi-step process that includes converting an image to grayscale, applying Gaussian blur to reduce noise, and calculating intensity gradients using the Sobel operator. It further refines edge detection through non-maximum suppression, double thresholding, and edge tracking to distinguish between strong and weak edges. The final output is a clean image with well-defined edges, achieved by removing any remaining weak edges.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0 ratings0% found this document useful (0 votes)
43 views10 pages
Canny Edge Detector
The Canny Edge Detector is a multi-step process that includes converting an image to grayscale, applying Gaussian blur to reduce noise, and calculating intensity gradients using the Sobel operator. It further refines edge detection through non-maximum suppression, double thresholding, and edge tracking to distinguish between strong and weak edges. The final output is a clean image with well-defined edges, achieved by removing any remaining weak edges.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 10
Canny Edge Detector
m= Tounderstand the canny edge detector, the reader has to go through the following
sequence,
= Canny is not like other traditional edge detectors, it is just not masking or hovering
on the input image matrix.
m Instead, it is detailed and has steps to follow.
= This section shall provide complete input on the same clearly, step by step= Canny edge detection technique, not just is a plain edge detection technique. It has an
additional feature. it also suppresses the noise while detecting the edges flawlessly.
= Let's go step by step
1. Conversion to the Grayscale
m= Let us take a sample image and proceed with the conversion. We have converted the input
RGB image to a Grayscale image. One can refer to the below figure to understand the
same.
Input Image: Grayscale Converted Image:
rr Py2. Gaussian Blur
m= tis an operator, which helps in removing the noise in the input image. This noise
removed image shall enable further processing to be smooth and flawless. The
sigma value has to be set appropriately for better results.3. Intensity Gradient Calculation
We shall go back to the basics. Sobel filter is to be used in this process. Let's
understand what an edge is all about. Sudden intensity change is the edge and in
fact, the intensity change of the pixel is the edge.
= Now the Sobel operator has to applied over the input image and the steps and
sequences remain the same as the process explained in the Sobel Edge Detection
process. The resultant Sobel operated image is presented below. The is referred as
Gradient Magnitude of the image.We preferred sobel operator and it is the general approach. But, it is not a mandated
rule to always go with sobel operator. It can be any gradient operator and the result
should be the gradient magnitude of the image.
The resulting Gradient Approximation can be calculated with
6=\\ex'+ Gy
The G will be compared against the threshold and with which, one can understand
the taken point is an edge or not.
The formula for finding the edge direction is just: Theta = inv tan (Gy / Gx)4. Non Maximum Suppression - This is the next step in the sequence. The gradient
magnitude operators discussed in the previous stage normally obtains thick edges. But, the
final image is expected to have thin edges.
Hence, the process Non Maximum Suppression shall enable us to derive thing edges from
thicker one through the following steps:
m= We have the edge direction already availalsle with us. The subsequent step is to relate the
identified edge direction to a DIRECTION that can be sketched in the image. i. ideally, it
is a prediction of how the movement of edges could happen
m= An example is always handy and we have taken 3 * 3 matrix as a reference. It’s all about
the colors and the below is to be visualized as 3 * 3 matrix for the scenario being
discussed.135 Deg
90 Deg
45 Deg
With the above picture as reference the following
rules are to be framed:
1. Any edge which come under the yellow range is
set to 0 degrees. (Which means from 0 to 22.5
degree and 157.5 to 180 degrees are set to 0
degrees)
2. Any edge which come under the green range is all
set to 45 degrees. (Which means 22.5 degrees to
67.5 degrees is set as 45 degrees)
‘Any edge coming under the blue range is all set to
90 degrees. (Which means 67.5 degrees to 112.5
degrees is set as 45 degrees)
‘The last remains easy to understand. Any edge
coming under the red range is all set to 135
degrees. (Which means 112.5 degrees to 157.5,
degrees is set as 135 degrees)
=The Centre cell is the region of interest for us. It is important to understand this
point explained below.
There can be only 4 possible directions for any pixel. They are
0 Degrees
45 Degrees
90 Degrees and
136 Degrees
Henee, it forces us to a situation where the edge has to be definitely oriented to one
of these four directions.
This is kind of approximation where if the orientation angle is observed to be 5
degrees then it is taken as 0 degrees. Similarly, if it is 43 degrees, it shall be made
as 45 degrees
For ease of understanding we have drawn a semicircle wih color shading. It is
representing 180 degrees. (But, actual scenario is for 360 degrees.)5. Thresholding - A must to do process
‘As one could see from the previous stage results, Non maximum thresholding has not
provided us excellent results.
- There is still some noise. The image even raises a threat in mind that some of the
edges shown may not really be so and some edges could be missed in the process.
Hence, there has to be a process to address this challenge. The process to be
followed is thresholding.
We need to go with double thresholding and in this process we have to set two thresholds.
One, a high and another a low. What is this?
Simple assume high threshold value as 0.8. Any pixel with a value above 0.8 is to be seen
as a stronger edge.
- Another threshold, the lower one can be 0.2. In that case, any pixel below this value
is not an edge at all and hence set them all to 0.
Now comes the next question, what about the values in between?
- I mean from 0.2 to 0.8? They may or may not be arPedge. They are referred as a
weak edge. There has to be a process to determine which of the weak edges are
actual edges so as to not to miss them.on ,
6. Edge Tracking
= As discussed in the previous section, it is important for us to now understand which
of the weaker edges are actual edges.
= Simple approach has to be followed. We can call the weak edges connected to
strong edges as strong/actual edges and retain them. Weak edges which are not
connected to stronger ones are to be removed.
7. The final cleansing
= All the remaining weak edges can be removed and that is it. The process is
complete. Once this process is done, we could get the following output image as the
result.