SlideShare una empresa de Scribd logo
1 de 28
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!

Más contenido relacionado

La actualidad más candente

Image enhancement techniques
Image enhancement techniquesImage enhancement techniques
Image enhancement techniques
Saideep
 

La actualidad más candente (20)

Image enhancement techniques
Image enhancement techniquesImage enhancement techniques
Image enhancement techniques
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
Spatial domain and filtering
Spatial domain and filteringSpatial domain and filtering
Spatial domain and filtering
 
Image Filtering in the Frequency Domain
Image Filtering in the Frequency DomainImage Filtering in the Frequency Domain
Image Filtering in the Frequency Domain
 
Basics of edge detection and forier transform
Basics of edge detection and forier transformBasics of edge detection and forier transform
Basics of edge detection and forier transform
 
Spatial Filters (Digital Image Processing)
Spatial Filters (Digital Image Processing)Spatial Filters (Digital Image Processing)
Spatial Filters (Digital Image Processing)
 
Erosion and dilation
Erosion and dilationErosion and dilation
Erosion and dilation
 
Image feature extraction
Image feature extractionImage feature extraction
Image feature extraction
 
Image Enhancement - Point Processing
Image Enhancement - Point ProcessingImage Enhancement - Point Processing
Image Enhancement - Point Processing
 
EDGE DETECTION
EDGE DETECTIONEDGE DETECTION
EDGE DETECTION
 
Chapter10 image segmentation
Chapter10 image segmentationChapter10 image segmentation
Chapter10 image segmentation
 
Edge Detection
Edge Detection Edge Detection
Edge Detection
 
SPATIAL FILTER
SPATIAL FILTERSPATIAL FILTER
SPATIAL FILTER
 
Image Restoration
Image RestorationImage Restoration
Image Restoration
 
From Image Processing To Computer Vision
From Image Processing To Computer VisionFrom Image Processing To Computer Vision
From Image Processing To Computer Vision
 
Computer vision - edge detection
Computer vision - edge detectionComputer vision - edge detection
Computer vision - edge detection
 
Chap6 image restoration
Chap6 image restorationChap6 image restoration
Chap6 image restoration
 
Thresholding.ppt
Thresholding.pptThresholding.ppt
Thresholding.ppt
 
Introduction to Digital Image Processing
Introduction to Digital Image ProcessingIntroduction to Digital Image Processing
Introduction to Digital Image Processing
 
Region based segmentation
Region based segmentationRegion based segmentation
Region based segmentation
 

Similar a Edge Detection algorithm and code

Ijarcet vol-2-issue-7-2246-2251
Ijarcet vol-2-issue-7-2246-2251Ijarcet vol-2-issue-7-2246-2251
Ijarcet vol-2-issue-7-2246-2251
Editor IJARCET
 
Ijarcet vol-2-issue-7-2246-2251
Ijarcet vol-2-issue-7-2246-2251Ijarcet vol-2-issue-7-2246-2251
Ijarcet vol-2-issue-7-2246-2251
Editor IJARCET
 
A Tutorial On Ip 1
A Tutorial On Ip 1A Tutorial On Ip 1
A Tutorial On Ip 1
ankuredkie
 
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
ijceronline
 
De-speckling of underwater ultrasound images
De-speckling of underwater ultrasound images De-speckling of underwater ultrasound images
De-speckling of underwater ultrasound images
ajujohnkk
 

Similar a Edge Detection algorithm and code (20)

Notes on image processing
Notes on image processingNotes on image processing
Notes on image processing
 
Ijarcet vol-2-issue-7-2246-2251
Ijarcet vol-2-issue-7-2246-2251Ijarcet vol-2-issue-7-2246-2251
Ijarcet vol-2-issue-7-2246-2251
 
Ijarcet vol-2-issue-7-2246-2251
Ijarcet vol-2-issue-7-2246-2251Ijarcet vol-2-issue-7-2246-2251
Ijarcet vol-2-issue-7-2246-2251
 
Math behind the kernels
Math behind the kernelsMath behind the kernels
Math behind the kernels
 
Seminar report on edge detection of video using matlab code
Seminar report on edge detection of video using matlab codeSeminar report on edge detection of video using matlab code
Seminar report on edge detection of video using matlab code
 
image segmentation by ppres.pptx
image segmentation by ppres.pptximage segmentation by ppres.pptx
image segmentation by ppres.pptx
 
Edge detection
Edge detectionEdge detection
Edge detection
 
3 intensity transformations and spatial filtering slides
3 intensity transformations and spatial filtering slides3 intensity transformations and spatial filtering slides
3 intensity transformations and spatial filtering slides
 
A Tutorial On Ip 1
A Tutorial On Ip 1A Tutorial On Ip 1
A Tutorial On Ip 1
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
 
Comparative Analysis of Common Edge Detection Algorithms using Pre-processing...
Comparative Analysis of Common Edge Detection Algorithms using Pre-processing...Comparative Analysis of Common Edge Detection Algorithms using Pre-processing...
Comparative Analysis of Common Edge Detection Algorithms using Pre-processing...
 
Removal of Gaussian noise on the image edges using the Prewitt operator and t...
Removal of Gaussian noise on the image edges using the Prewitt operator and t...Removal of Gaussian noise on the image edges using the Prewitt operator and t...
Removal of Gaussian noise on the image edges using the Prewitt operator and t...
 
Ijcet 06 10_001
Ijcet 06 10_001Ijcet 06 10_001
Ijcet 06 10_001
 
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
 
Image fusion
Image fusionImage fusion
Image fusion
 
Basic image processing techniques
Basic image processing techniquesBasic image processing techniques
Basic image processing techniques
 
Introduction to Digital image processing
Introduction to Digital image processing Introduction to Digital image processing
Introduction to Digital image processing
 
De-speckling of underwater ultrasound images
De-speckling of underwater ultrasound images De-speckling of underwater ultrasound images
De-speckling of underwater ultrasound images
 
Automatic Classification Satellite images for weather Monitoring
Automatic Classification Satellite images for weather MonitoringAutomatic Classification Satellite images for weather Monitoring
Automatic Classification Satellite images for weather Monitoring
 
Image denoising using curvelet transform
Image denoising using curvelet transformImage denoising using curvelet transform
Image denoising using curvelet transform
 

Último

CYTOGENETIC MAP................ ppt.pptx
CYTOGENETIC MAP................ ppt.pptxCYTOGENETIC MAP................ ppt.pptx
CYTOGENETIC MAP................ ppt.pptx
Silpa
 
Digital Dentistry.Digital Dentistryvv.pptx
Digital Dentistry.Digital Dentistryvv.pptxDigital Dentistry.Digital Dentistryvv.pptx
Digital Dentistry.Digital Dentistryvv.pptx
MohamedFarag457087
 
Porella : features, morphology, anatomy, reproduction etc.
Porella : features, morphology, anatomy, reproduction etc.Porella : features, morphology, anatomy, reproduction etc.
Porella : features, morphology, anatomy, reproduction etc.
Silpa
 
The Mariana Trench remarkable geological features on Earth.pptx
The Mariana Trench remarkable geological features on Earth.pptxThe Mariana Trench remarkable geological features on Earth.pptx
The Mariana Trench remarkable geological features on Earth.pptx
seri bangash
 
Reboulia: features, anatomy, morphology etc.
Reboulia: features, anatomy, morphology etc.Reboulia: features, anatomy, morphology etc.
Reboulia: features, anatomy, morphology etc.
Silpa
 
LUNULARIA -features, morphology, anatomy ,reproduction etc.
LUNULARIA -features, morphology, anatomy ,reproduction etc.LUNULARIA -features, morphology, anatomy ,reproduction etc.
LUNULARIA -features, morphology, anatomy ,reproduction etc.
Silpa
 
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptxTHE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
ANSARKHAN96
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
POGONATUM : morphology, anatomy, reproduction etc.
POGONATUM : morphology, anatomy, reproduction etc.POGONATUM : morphology, anatomy, reproduction etc.
POGONATUM : morphology, anatomy, reproduction etc.
Silpa
 
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune WaterworldsBiogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
Sérgio Sacani
 

Último (20)

Bhiwandi Bhiwandi ❤CALL GIRL 7870993772 ❤CALL GIRLS ESCORT SERVICE In Bhiwan...
Bhiwandi Bhiwandi ❤CALL GIRL 7870993772 ❤CALL GIRLS  ESCORT SERVICE In Bhiwan...Bhiwandi Bhiwandi ❤CALL GIRL 7870993772 ❤CALL GIRLS  ESCORT SERVICE In Bhiwan...
Bhiwandi Bhiwandi ❤CALL GIRL 7870993772 ❤CALL GIRLS ESCORT SERVICE In Bhiwan...
 
CYTOGENETIC MAP................ ppt.pptx
CYTOGENETIC MAP................ ppt.pptxCYTOGENETIC MAP................ ppt.pptx
CYTOGENETIC MAP................ ppt.pptx
 
Digital Dentistry.Digital Dentistryvv.pptx
Digital Dentistry.Digital Dentistryvv.pptxDigital Dentistry.Digital Dentistryvv.pptx
Digital Dentistry.Digital Dentistryvv.pptx
 
Porella : features, morphology, anatomy, reproduction etc.
Porella : features, morphology, anatomy, reproduction etc.Porella : features, morphology, anatomy, reproduction etc.
Porella : features, morphology, anatomy, reproduction etc.
 
Thyroid Physiology_Dr.E. Muralinath_ Associate Professor
Thyroid Physiology_Dr.E. Muralinath_ Associate ProfessorThyroid Physiology_Dr.E. Muralinath_ Associate Professor
Thyroid Physiology_Dr.E. Muralinath_ Associate Professor
 
The Mariana Trench remarkable geological features on Earth.pptx
The Mariana Trench remarkable geological features on Earth.pptxThe Mariana Trench remarkable geological features on Earth.pptx
The Mariana Trench remarkable geological features on Earth.pptx
 
Reboulia: features, anatomy, morphology etc.
Reboulia: features, anatomy, morphology etc.Reboulia: features, anatomy, morphology etc.
Reboulia: features, anatomy, morphology etc.
 
LUNULARIA -features, morphology, anatomy ,reproduction etc.
LUNULARIA -features, morphology, anatomy ,reproduction etc.LUNULARIA -features, morphology, anatomy ,reproduction etc.
LUNULARIA -features, morphology, anatomy ,reproduction etc.
 
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptxTHE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Selaginella: features, morphology ,anatomy and reproduction.
Selaginella: features, morphology ,anatomy and reproduction.Selaginella: features, morphology ,anatomy and reproduction.
Selaginella: features, morphology ,anatomy and reproduction.
 
TransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRings
TransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRingsTransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRings
TransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRings
 
Genome sequencing,shotgun sequencing.pptx
Genome sequencing,shotgun sequencing.pptxGenome sequencing,shotgun sequencing.pptx
Genome sequencing,shotgun sequencing.pptx
 
module for grade 9 for distance learning
module for grade 9 for distance learningmodule for grade 9 for distance learning
module for grade 9 for distance learning
 
Chemistry 5th semester paper 1st Notes.pdf
Chemistry 5th semester paper 1st Notes.pdfChemistry 5th semester paper 1st Notes.pdf
Chemistry 5th semester paper 1st Notes.pdf
 
Factory Acceptance Test( FAT).pptx .
Factory Acceptance Test( FAT).pptx       .Factory Acceptance Test( FAT).pptx       .
Factory Acceptance Test( FAT).pptx .
 
POGONATUM : morphology, anatomy, reproduction etc.
POGONATUM : morphology, anatomy, reproduction etc.POGONATUM : morphology, anatomy, reproduction etc.
POGONATUM : morphology, anatomy, reproduction etc.
 
GBSN - Microbiology (Unit 3)Defense Mechanism of the body
GBSN - Microbiology (Unit 3)Defense Mechanism of the body GBSN - Microbiology (Unit 3)Defense Mechanism of the body
GBSN - Microbiology (Unit 3)Defense Mechanism of the body
 
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune WaterworldsBiogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
 
300003-World Science Day For Peace And Development.pptx
300003-World Science Day For Peace And Development.pptx300003-World Science Day For Peace And Development.pptx
300003-World Science Day For Peace And Development.pptx
 

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