Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Aptitude
  • Engineering Mathematics
  • Discrete Mathematics
  • Operating System
  • DBMS
  • Computer Networks
  • Digital Logic and Design
  • C Programming
  • Data Structures
  • Algorithms
  • Theory of Computation
  • Compiler Design
  • Computer Org and Architecture
Open In App
Next Article:
Image Processing in MATLAB | Fundamental Operations
Next article icon

Image Edge Detection Operators in Digital Image Processing

Last Updated : 16 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

In digital image processing edges are places where the brightness or color in an image changes a lot. These changes usually happen at borders of objects. Detecting edges helps us understand the shape, size and location of different parts in an image. Edge detection is used to recognize patterns, understand image structure and pick out important features in images.

Types of Edge Detection Operators

There are main types of edge detection methods: 

1. Gradient-Based Edge Detection Operators

Gradient-based operators detect edges by measuring how quickly the pixel values or brightness changes in a image. These changes are called gradients. If the change is large between two neighboring pixels that indicates an edge. They use first derivative to find edges.

2. Gaussian-Based Edge Detection Operators

Gaussian-based operators combine blurring and edge detection. They reduce the effect of noise by smoothing the image first and then look for changes using the second derivative. These are more advanced and accurate than gradient-based operators.

3. Sobel Operator

The Sobel Operator is a method used to detect edges in an image by checking how pixel values (brightness) change in the horizontal and vertical directions. It uses two 3 x 3 kernels or masks which are convolved with the input image to calculate the vertical and horizontal derivative approximations respectively:

[Tex]M_x = \begin{pmatrix} -1 & -2 & -1 \\ 0 & 0 & 0 \\ 1 & 2 & 1 \end{pmatrix}, \quad M_y = \begin{pmatrix} -1 & 0 & 1 \\ -2 & 0 & 2 \\ -1 & 0 & 1 \end{pmatrix}[/Tex]

where:

  • Mx detect edges from left to right
  • My detect edges from top to bottom

By combining the results from both it finds the overall edge strength and direction.

4. Prewitt Operator

It is very similar to the Sobel Operator but with slight difference is that it calculates the edge gradients. Like Sobel it detects edges in the horizontal and vertical directions using two 3×3 matrices but it uses a uniform averaging technique in its kernel making it less accurate than Sobel but faster and simpler to implement.

[Tex]M_x = \begin{pmatrix} -1 & -1 & -1 \\ 0 & 0 & 0 \\ 1 & 1 & 1 \end{pmatrix}, \quad M_y = \begin{pmatrix} -1 & 0 & 1 \\ -1 & 0 & 1 \\ -1 & 0 & 1 \end{pmatrix}[/Tex]

where: 

  • Mx detect edges from left to right
  • My detect edges from top to bottom

By combining the results from both it finds the overall edge strength and direction.

5. Roberts Operator

It is one of the simplest edge detection methods as it focuses on how pixel values change diagonally in an image. The operator uses a 2×2 kernel to calculate the gradient of intensity between diagonally adjacent pixels and make it suitable for detecting edges that appear along diagonal directions.

[Tex]M_x = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}, \quadM_y = \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}[/Tex]

where:

  • Mx detects diagonal edges that run from top-left to bottom-right.
  • My detects diagonal edges that run from top-right to bottom-left.

By combining the results of both kernels the Roberts operator calculates the gradient magnitude to highlight edges.

6. Marr-Hildreth Operator or Laplacian of Gaussian (LoG)

Marr-Hildreth Operator is also called Laplacian of Gaussian (LoG) and it is a Gaussian-based edge detection method. It works by first smoothing the image using a Gaussian filter to remove noise and then applying the Laplacian operator to detect regions where the intensity changes sharply. The LoG operator first smooths the image using a Gaussian filter to reduce noise then applies the Laplacian to detect edges. It detects edges at zero-crossings where the result changes from positive to negative.

[Tex]LoG(x, y) = \left( \frac{x^2 + y^2 – 2\sigma^2}{\sigma^4} \right) \cdot e^{-\frac{x^2 + y^2}{2\sigma^2}}[/Tex]

Where:

  • [Tex]\sigma[/Tex] = standard deviation of the Gaussian filter
  • [Tex]x,y[/Tex] = pixel coordinates

Use LoG when your image is noisy and you need clean it.

7. Canny Edge Detector

The Canny operator is one of the most advanced and widely used edge detection methods. It uses a multi-step process to detect sharp and clean edges while minimizing noise. Before detecting edges we remove noise using a Gaussian Blur and smoothens the image.

[Tex]G(x, y) = \frac{1}{2\pi\sigma^2} \cdot e^{-\frac{x^2 + y^2}{2\sigma^2}}[/Tex]

 1. Find Intensity Gradient: In this step we find where the image changes the most this helps detect edges. We use Sobel filters to find gradients in x and y directions:

[Tex]G x​ =Sobel in x-direction,G y​ =Sobel in y-direction[/Tex]

2. Non-Maximum Suppression: We thin the edges by keeping only the local maximum gradient in the direction of the edge. It removes pixels that are not part of a strong edge.

3. Double Thresholding: Here we classify pixels into:

  • Strong edges (above high threshold)
  • Weak edges (between low and high threshold)
  • Non-edges (below low threshold)

4. Edge Tracking by Hysteresis: The final step connects weak edges to strong edges if they are part of the same structure. Isolated weak edges are removed.

It’s good for applications needing precise and reliable edge detection like medical imaging, facial recognition or object tracking. 



Next Article
Image Processing in MATLAB | Fundamental Operations
author
goodday451999
Improve
Article Tags :
  • Digital Logic
  • Image-Processing

Similar Reads

  • Image Processing in Java - Face Detection
    Prerequisites: Image Processing in Java - Read and WriteImage Processing In Java - Get and Set PixelsImage Processing in Java - Colored Image to Grayscale Image ConversionImage Processing in Java - Colored Image to Negative Image ConversionImage Processing in Java - Colored to Red Green Blue Image C
    3 min read
  • MATLAB - Image Edge Detection using Sobel Operator from Scratch
    Sobel Operator: It is a discrete differentiation gradient-based operator. It computes the gradient approximation of image intensity function for image edge detection. At the pixels of an image, the Sobel operator produces either the normal to a vector or the corresponding gradient vector. It uses tw
    3 min read
  • Image Processing in MATLAB | Fundamental Operations
    1. Reading Images Images are read into the MATLAB Environment using imread() function which takes filename with applicable extension as the argument For Example: >> I=imread('nature.jpg'); This will read JPEG image 'nature' into the image array. Note: The semicolon(;) at the end of command lin
    3 min read
  • Digital Image Processing Chain
    A digital camera image processing chain is constituted to imitate the major functions of the Human Visual System (HVS). The above figure explains the chain. The camera sensor produces a “raw” Colour Filter Array (CFA) which is the input to this chain. Autofocus, auto exposure and automatic white bal
    3 min read
  • Difference between Opening and Closing in Digital Image Processing
    Opening and Closing are dual operations used in Digital Image Processing for restoring an eroded image. Opening is generally used to restore or recover the original image to the maximum possible extent. Closing is generally used to smoother the contour of the distorted image and fuse back the narrow
    2 min read
  • Image Processing in Java - Comparison of Two Images
    Prerequisites: Image Processing in Java - Read and WriteImage Processing In Java - Get and Set PixelsImage Processing in Java - Colored Image to Grayscale Image ConversionImage Processing in Java - Colored Image to Negative Image ConversionImage Processing in Java - Colored to Red Green Blue Image C
    4 min read
  • Denoising techniques in digital image processing using MATLAB
    Denoising is the process of removing or reducing the noise or artifacts from the image. Denoising makes the image more clear and enables us to see finer details in the image clearly. It does not change the brightness or contrast of the image directly, but due to the removal of artifacts, the final i
    6 min read
  • Digital Image Processing Basics
    Digital Image Processing means processing digital image by means of a digital computer. We can also say that it is a use of computer algorithms, in order to get enhanced image either to extract some useful information. Digital image processing is the use of algorithms and mathematical models to proc
    7 min read
  • Python | Morphological Operations in Image Processing (Gradient) | Set-3
    In the previous articles, the Opening operation and the Closing operations were specified. In this article, another morphological operation is elaborated that is Gradient. It is used for generating the outline of the image. There are two types of gradients, internal and external gradient. The intern
    2 min read
  • Digital Image Processing Algorithms using MATLAB
    Like it is said, "One picture is worth more than ten thousand words "A digital image is composed of thousands and thousands of pixels. An image could also be defined as a two-dimensional function, f(x, y), where x and y are spatial (plane) coordinates and therefore the amplitude of f at any pair of
    8 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences