SlideShare a Scribd company logo
EDGE DETECTION
Presented by: Vaddi Manikanta
B212053
ETC
INTRODUCTION
Edges are significant local
changes of intensity in an
image.
Edge Detection is the
process of identifying and
locating sharp discontinuities
in an image.
Abrupt change in pixel
intensity characterize
boundary of an object and
usually edges occur on the
boundary of two regions.
Tulips image
Edges of the Tulips image
Tulips Image Part of the image Edge of the part of the image
Matrix generated by the part of the image
CAUSES OF INTENSITY CHANGE
Geometric events
Discontinuity in depth and
surface colour and texture
Non-geometric events
Reflection of light
Illumination
shadows
Edge formation due to
discontinuity of surface
Reflectance Illumination Shadow
APPLICATIONS
Enhancement of noisy images like satellite images,
x-rays, medical images like cat scans.
Text detection.
Traffic management.
Mapping of roads.
Video surveillance.
DIFFERENT TYPES OF EDGES OR
INTENSITY CHANGES
Step edge: The image intensity abruptly changes from
one value on one side of the discontinuity to a different
value on the opposite side.
Ramp edge: A step edge where the intensity change is
not instantaneous but occur over a finite distance.
Ridge edge: The image intensity abruptly changes value
but then returns to the starting value within some short
distance (i.e., usually generated by lines).
Roof edge: A ridge edge where the intensity change is
not instantaneous but occur over a finite distance (i.e.,
usually generated by the intersection of two surfaces).
MAIN STEPS IN EDGE DETECTION
Smoothing: Suppress as much noise as possible,
without destroying true edges.
Enhancement: Apply differentiation to enhance the
quality of edges (i.e., sharpening).
Thresholding: Determine which edge pixels should be
discarded as noise and which should be retained (i.e.,
threshold edge magnitude).
Localization: Determine the exact edge location. Edge
thinning and linking are usually required in this step.
EDGE DETECTION USING
DERIVATIVE (GRADIENT)
The first derivate of an image can be computed using the
gradient
(or)f
GRADIENT REPRESENTATION
The gradient is a vector which has magnitude and
direction.
or
Magnitude: indicates edge strength.
Direction: indicates edge direction.
| | | |
f f
x y
 

 
(approximation)
EDGE DETECTION STEPS USING
GRADIENT
(i.e., sqrt is costly!)
GENERAL APPROXIMATION
Consider the arrangement of pixels about the pixel [i, j]:
The partial derivatives , can be computed by:
The constant c implies the emphasis given to pixels
closer to the centre of the mask.
3 x 3 neighborhood:
SOBEL OPERATOR
3×3 convolution mask.
Setting c = 2, we get the Sobel operator:
EDGE DETECTOR USING SOBEL
OPERATOR IN C LANGUAGE
#include <stdio.h>
#include <stdlib.h>
#include <float.h>
#include "mypgm.h"
void sobel_filtering( )
/* Spatial filtering of image data */
/* Sobel filter (horizontal differentiation */
/* Input: image1[y][x] ---- Outout: image2[y][x] */
{
/* Definition of Sobel filter in horizontal direction */
int weight[3][3] = { { -1, 0, 1 },
{ -2, 0, 2 },
{ -1, 0, 1 } };
double pixel_value;
double min, max;
int x, y, i, j; /* Loop variable */
/* Maximum values calculation after filtering*/
printf("Now, filtering of input image is performednn");
min = DBL_MAX;
max = -DBL_MAX;
for (y = 1; y < y_size1 - 1; y++) {
for (x = 1; x < x_size1 - 1; x++) {
pixel_value = 0.0;
for (j = -1; j <= 1; j++) {
for (i = -1; i <= 1; i++) {
pixel_value += weight[j + 1][i + 1] * image1[y + j][x + i];
}
}
if (pixel_value < min) min = pixel_value;
if (pixel_value > max) max = pixel_value;
}
}
if ((int)(max - min) == 0) {
printf("Nothing exists!!!nn");
exit(1);
}
/* Initialization of image2[y][x] */
x_size2 = x_size1;
y_size2 = y_size1;
for (y = 0; y < y_size2; y++) {
for (x = 0; x < x_size2; x++) {
image2[y][x] = 0;
}
}
/* Generation of image2 after linear transformtion */
for (y = 1; y < y_size1 - 1; y++) {
for (x = 1; x < x_size1 - 1; x++) {
pixel_value = 0.0;
for (j = -1; j <= 1; j++) {
for (i = -1; i <= 1; i++) {
pixel_value += weight[j + 1][i + 1] * image1[y + j][x + i];
}
}
pixel_value = MAX_BRIGHTNESS * (pixel_value - min) / (max - min);
image2[y][x] = (unsigned char)pixel_value;
}
}
}
main( )
{
load_image_data( ); /* Input of image1 */
sobel_filtering( ); /* Sobel filter is applied to image1 */
save_image_data( ); /* Output of image2 */
return 0;
}
SOBEL EDGE DETECTOR
PREWITT OPERATOR
3×3 convolution mask.
Setting c = 1, we get the Prewitt operator:
PREWITT EDGE DETECTOR
GENERAL EXAMPLE
I
dx
d
I
dy
dI
22
d d
I I
dx dy
  
    
   
100Threshold  
I
PRACTICAL ISSUES
Choice of threshold
Gradient Magnitude
Low Threshold High Threshold
Edge thinning and linking.
CONCLUSION
Reduces unnecessary information in the image while
preserving the structure of the image.
Extract important features of an image like corners, lines
and curves.
Recognize objects, boundaries, segmentation.
Part of computer vision and recognition.
Sobel and prewitt operators are similar.
REFERENCES
Machine Vision – Ramesh Jain, Rangachar Kasturi, Brian
G Schunck, McGraw-Hill, 1995
A Computational Approach to Edge Detection – John
Canny, IEEE, 1986
CS485/685 Computer Vision – Dr. George Bebis
THANK YOU!

More Related Content

What's hot (20)

PPTX
Spatial Filters (Digital Image Processing)
Kalyan Acharjya
 
PPTX
Unit3 dip
Imran Khan
 
PPTX
IMAGE SEGMENTATION.
Tawose Olamide Timothy
 
PPTX
Image Enhancement - Point Processing
Gayathri31093
 
PPTX
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project PPT
Akshit Arora
 
PPTX
Intensity Transformation and Spatial filtering
Shajun Nisha
 
PPSX
Image Processing: Spatial filters
Dr. A. B. Shinde
 
PPTX
Image Compression
Paramjeet Singh Jamwal
 
PPTX
Region based segmentation
ramya marichamy
 
PDF
Image segmentation with deep learning
Antonio Rueda-Toicen
 
PDF
Digital Image Processing: Image Enhancement in the Spatial Domain
Mostafa G. M. Mostafa
 
PPTX
Image segmentation in Digital Image Processing
DHIVYADEVAKI
 
PPTX
Image Sampling and Quantization.pptx
RUBIN (A) JEBIN
 
PPT
Image degradation and noise by Md.Naseem Ashraf
MD Naseem Ashraf
 
PPTX
Image Restoration (Frequency Domain Filters):Basics
Kalyan Acharjya
 
PPTX
Image Restoration (Order Statistics Filters)
Kalyan Acharjya
 
PPTX
Image Filtering in the Frequency Domain
Amnaakhaan
 
PPTX
Image feature extraction
Rushin Shah
 
PPTX
Image enhancement techniques
Arshad khan
 
PPTX
Object Recognition
Eman Abed AlWahhab
 
Spatial Filters (Digital Image Processing)
Kalyan Acharjya
 
Unit3 dip
Imran Khan
 
IMAGE SEGMENTATION.
Tawose Olamide Timothy
 
Image Enhancement - Point Processing
Gayathri31093
 
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project PPT
Akshit Arora
 
Intensity Transformation and Spatial filtering
Shajun Nisha
 
Image Processing: Spatial filters
Dr. A. B. Shinde
 
Image Compression
Paramjeet Singh Jamwal
 
Region based segmentation
ramya marichamy
 
Image segmentation with deep learning
Antonio Rueda-Toicen
 
Digital Image Processing: Image Enhancement in the Spatial Domain
Mostafa G. M. Mostafa
 
Image segmentation in Digital Image Processing
DHIVYADEVAKI
 
Image Sampling and Quantization.pptx
RUBIN (A) JEBIN
 
Image degradation and noise by Md.Naseem Ashraf
MD Naseem Ashraf
 
Image Restoration (Frequency Domain Filters):Basics
Kalyan Acharjya
 
Image Restoration (Order Statistics Filters)
Kalyan Acharjya
 
Image Filtering in the Frequency Domain
Amnaakhaan
 
Image feature extraction
Rushin Shah
 
Image enhancement techniques
Arshad khan
 
Object Recognition
Eman Abed AlWahhab
 

Similar to Edge Detection algorithm and code (20)

PPTX
Notes on image processing
Mohammed Kamel
 
PDF
Ijarcet vol-2-issue-7-2246-2251
Editor IJARCET
 
PDF
Ijarcet vol-2-issue-7-2246-2251
Editor IJARCET
 
PPTX
Computer vision - edge detection
Wael Badawy
 
DOCX
EDGE DETECTION
VIKAS SINGH BHADOURIA
 
PDF
Ed34785790
IJERA Editor
 
PDF
FPGA Implementation for Image Edge Detection using Xilinx System Generator
rahulmonikasharma
 
PDF
Ex4301908912
IJERA Editor
 
PDF
ALGORITHM AND TECHNIQUE ON VARIOUS EDGE DETECTION: A SURVEY
sipij
 
PDF
Hardware Unit for Edge Detection with Comparative Analysis of Different Edge ...
paperpublications3
 
PPTX
08_Lecture -Chapter 10- Image Segmentation_Part I_Edge Detection.pptx
MDYousufALI56
 
PDF
Edge detection
Edi Supriadi
 
PPTX
Lecture 06 - image processingcourse1.pptx
Alaa790395
 
PDF
SINGLE‐PHASE TO THREE‐PHASE DRIVE SYSTEM USING TWO PARALLEL SINGLE‐PHASE RECT...
ijiert bestjournal
 
PDF
Introduction to Digital image processing
Sairam Geethanath
 
PDF
Lec06 edge
BaliThorat1
 
DOCX
Edge detection
Kalyan Srivatsav
 
PPTX
EDGE DETECTION USING SOBEL OPERATOR.pptx
kolaruboys
 
PPTX
Introduction to Edges Detection Techniques
University of Sindh
 
PDF
Comparative Analysis of Common Edge Detection Algorithms using Pre-processing...
IJECEIAES
 
Notes on image processing
Mohammed Kamel
 
Ijarcet vol-2-issue-7-2246-2251
Editor IJARCET
 
Ijarcet vol-2-issue-7-2246-2251
Editor IJARCET
 
Computer vision - edge detection
Wael Badawy
 
EDGE DETECTION
VIKAS SINGH BHADOURIA
 
Ed34785790
IJERA Editor
 
FPGA Implementation for Image Edge Detection using Xilinx System Generator
rahulmonikasharma
 
Ex4301908912
IJERA Editor
 
ALGORITHM AND TECHNIQUE ON VARIOUS EDGE DETECTION: A SURVEY
sipij
 
Hardware Unit for Edge Detection with Comparative Analysis of Different Edge ...
paperpublications3
 
08_Lecture -Chapter 10- Image Segmentation_Part I_Edge Detection.pptx
MDYousufALI56
 
Edge detection
Edi Supriadi
 
Lecture 06 - image processingcourse1.pptx
Alaa790395
 
SINGLE‐PHASE TO THREE‐PHASE DRIVE SYSTEM USING TWO PARALLEL SINGLE‐PHASE RECT...
ijiert bestjournal
 
Introduction to Digital image processing
Sairam Geethanath
 
Lec06 edge
BaliThorat1
 
Edge detection
Kalyan Srivatsav
 
EDGE DETECTION USING SOBEL OPERATOR.pptx
kolaruboys
 
Introduction to Edges Detection Techniques
University of Sindh
 
Comparative Analysis of Common Edge Detection Algorithms using Pre-processing...
IJECEIAES
 
Ad

Recently uploaded (20)

PPTX
Fake Science: Where it comes from and how to avoid beign part of it
Leonid Schneider
 
PDF
Human-to-Robot Handovers track - RGMC - ICRA 2025
Alessio Xompero
 
PPTX
Earthquake1214435435665467576786587867876867888.pptx
JohnMarkBarrientos1
 
PPTX
Chromosomal Aberration (Mutation) and Classification.
Dr-Haseeb Zubair Tagar
 
PDF
Study of Appropriate Information Combination in Image-based Obfuscated Malwar...
takahashi34
 
PDF
Herbal Excipients: Natural Colorants & Perfumery Agents
Seacom Skills University
 
PDF
Disk Evolution Study Through Imaging of Nearby Young Stars (DESTINYS): Eviden...
Sérgio Sacani
 
PPTX
Organisms of oncogenic Potential.pptx
mrkoustavjana2003
 
PDF
POLISH JOURNAL OF SCIENCE №87 (2025)
POLISH JOURNAL OF SCIENCE
 
PDF
Global Health Initiatives: Lessons from Successful Programs (www.kiu.ac.ug)
publication11
 
PPTX
The-Emergence-of-Social-Science-Disciplines-A-Historical-Journey.pptx
RomaErginaBachiller
 
PPTX
atom : it is the building unit of the structure of any matter
abdoy2605
 
DOCX
Accomplishment Report on YES- O SY 2025 2026.docx
WilsonVillamater
 
PDF
The Gender Binary & LGBTI People: Religious Myth and Medical Malpractice
Veronica Drantz, PhD
 
PPSX
Overview of Stem Cells and Immune Modulation.ppsx
AhmedAtwa29
 
PPTX
Cancer
Vartika
 
PPTX
Human-AI Interaction in Space: Insights from a Mars Analog Mission with the H...
Jean Vanderdonckt
 
PPTX
MEDICINAL CHEMISTRY PROSPECTIVES IN DESIGN OF EGFR INHIBITORS.pptx
40RevathiP
 
PPTX
Liquid Biopsy Biomarkers for early Diagnosis
KanakChaudhary10
 
PPTX
Single-Cell Multi-Omics in Neurodegeneration p1.pptx
KanakChaudhary10
 
Fake Science: Where it comes from and how to avoid beign part of it
Leonid Schneider
 
Human-to-Robot Handovers track - RGMC - ICRA 2025
Alessio Xompero
 
Earthquake1214435435665467576786587867876867888.pptx
JohnMarkBarrientos1
 
Chromosomal Aberration (Mutation) and Classification.
Dr-Haseeb Zubair Tagar
 
Study of Appropriate Information Combination in Image-based Obfuscated Malwar...
takahashi34
 
Herbal Excipients: Natural Colorants & Perfumery Agents
Seacom Skills University
 
Disk Evolution Study Through Imaging of Nearby Young Stars (DESTINYS): Eviden...
Sérgio Sacani
 
Organisms of oncogenic Potential.pptx
mrkoustavjana2003
 
POLISH JOURNAL OF SCIENCE №87 (2025)
POLISH JOURNAL OF SCIENCE
 
Global Health Initiatives: Lessons from Successful Programs (www.kiu.ac.ug)
publication11
 
The-Emergence-of-Social-Science-Disciplines-A-Historical-Journey.pptx
RomaErginaBachiller
 
atom : it is the building unit of the structure of any matter
abdoy2605
 
Accomplishment Report on YES- O SY 2025 2026.docx
WilsonVillamater
 
The Gender Binary & LGBTI People: Religious Myth and Medical Malpractice
Veronica Drantz, PhD
 
Overview of Stem Cells and Immune Modulation.ppsx
AhmedAtwa29
 
Cancer
Vartika
 
Human-AI Interaction in Space: Insights from a Mars Analog Mission with the H...
Jean Vanderdonckt
 
MEDICINAL CHEMISTRY PROSPECTIVES IN DESIGN OF EGFR INHIBITORS.pptx
40RevathiP
 
Liquid Biopsy Biomarkers for early Diagnosis
KanakChaudhary10
 
Single-Cell Multi-Omics in Neurodegeneration p1.pptx
KanakChaudhary10
 
Ad

Edge Detection algorithm and code

  • 1. EDGE DETECTION Presented by: Vaddi Manikanta B212053 ETC
  • 2. INTRODUCTION Edges are significant local changes of intensity in an image. Edge Detection is the process of identifying and locating sharp discontinuities in an image. Abrupt change in pixel intensity characterize boundary of an object and usually edges occur on the boundary of two regions. Tulips image Edges of the Tulips image
  • 3. Tulips Image Part of the image Edge of the part of the image Matrix generated by the part of the image
  • 4. CAUSES OF INTENSITY CHANGE Geometric events Discontinuity in depth and surface colour and texture Non-geometric events Reflection of light Illumination shadows Edge formation due to discontinuity of surface Reflectance Illumination Shadow
  • 5. APPLICATIONS Enhancement of noisy images like satellite images, x-rays, medical images like cat scans. Text detection. Traffic management. Mapping of roads. Video surveillance.
  • 6. DIFFERENT TYPES OF EDGES OR INTENSITY CHANGES Step edge: The image intensity abruptly changes from one value on one side of the discontinuity to a different value on the opposite side.
  • 7. Ramp edge: A step edge where the intensity change is not instantaneous but occur over a finite distance. Ridge edge: The image intensity abruptly changes value but then returns to the starting value within some short distance (i.e., usually generated by lines).
  • 8. Roof edge: A ridge edge where the intensity change is not instantaneous but occur over a finite distance (i.e., usually generated by the intersection of two surfaces).
  • 9. MAIN STEPS IN EDGE DETECTION Smoothing: Suppress as much noise as possible, without destroying true edges. Enhancement: Apply differentiation to enhance the quality of edges (i.e., sharpening). Thresholding: Determine which edge pixels should be discarded as noise and which should be retained (i.e., threshold edge magnitude). Localization: Determine the exact edge location. Edge thinning and linking are usually required in this step.
  • 10. EDGE DETECTION USING DERIVATIVE (GRADIENT) The first derivate of an image can be computed using the gradient (or)f
  • 11. GRADIENT REPRESENTATION The gradient is a vector which has magnitude and direction. or Magnitude: indicates edge strength. Direction: indicates edge direction. | | | | f f x y      (approximation)
  • 12. EDGE DETECTION STEPS USING GRADIENT (i.e., sqrt is costly!)
  • 13. GENERAL APPROXIMATION Consider the arrangement of pixels about the pixel [i, j]: The partial derivatives , can be computed by: The constant c implies the emphasis given to pixels closer to the centre of the mask. 3 x 3 neighborhood:
  • 14. SOBEL OPERATOR 3×3 convolution mask. Setting c = 2, we get the Sobel operator:
  • 15. EDGE DETECTOR USING SOBEL OPERATOR IN C LANGUAGE #include <stdio.h> #include <stdlib.h> #include <float.h> #include "mypgm.h" void sobel_filtering( ) /* Spatial filtering of image data */ /* Sobel filter (horizontal differentiation */ /* Input: image1[y][x] ---- Outout: image2[y][x] */ { /* Definition of Sobel filter in horizontal direction */ int weight[3][3] = { { -1, 0, 1 }, { -2, 0, 2 }, { -1, 0, 1 } }; double pixel_value; double min, max; int x, y, i, j; /* Loop variable */
  • 16. /* Maximum values calculation after filtering*/ printf("Now, filtering of input image is performednn"); min = DBL_MAX; max = -DBL_MAX; for (y = 1; y < y_size1 - 1; y++) { for (x = 1; x < x_size1 - 1; x++) { pixel_value = 0.0; for (j = -1; j <= 1; j++) { for (i = -1; i <= 1; i++) { pixel_value += weight[j + 1][i + 1] * image1[y + j][x + i]; } } if (pixel_value < min) min = pixel_value; if (pixel_value > max) max = pixel_value; } }
  • 17. if ((int)(max - min) == 0) { printf("Nothing exists!!!nn"); exit(1); } /* Initialization of image2[y][x] */ x_size2 = x_size1; y_size2 = y_size1; for (y = 0; y < y_size2; y++) { for (x = 0; x < x_size2; x++) { image2[y][x] = 0; } }
  • 18. /* Generation of image2 after linear transformtion */ for (y = 1; y < y_size1 - 1; y++) { for (x = 1; x < x_size1 - 1; x++) { pixel_value = 0.0; for (j = -1; j <= 1; j++) { for (i = -1; i <= 1; i++) { pixel_value += weight[j + 1][i + 1] * image1[y + j][x + i]; } } pixel_value = MAX_BRIGHTNESS * (pixel_value - min) / (max - min); image2[y][x] = (unsigned char)pixel_value; } } } main( ) { load_image_data( ); /* Input of image1 */ sobel_filtering( ); /* Sobel filter is applied to image1 */ save_image_data( ); /* Output of image2 */ return 0; }
  • 20. PREWITT OPERATOR 3×3 convolution mask. Setting c = 1, we get the Prewitt operator:
  • 23. 22 d d I I dx dy             100Threshold   I
  • 24. PRACTICAL ISSUES Choice of threshold Gradient Magnitude Low Threshold High Threshold
  • 26. CONCLUSION Reduces unnecessary information in the image while preserving the structure of the image. Extract important features of an image like corners, lines and curves. Recognize objects, boundaries, segmentation. Part of computer vision and recognition. Sobel and prewitt operators are similar.
  • 27. REFERENCES Machine Vision – Ramesh Jain, Rangachar Kasturi, Brian G Schunck, McGraw-Hill, 1995 A Computational Approach to Edge Detection – John Canny, IEEE, 1986 CS485/685 Computer Vision – Dr. George Bebis