Javatpoint Logo
Javatpoint Logo

Image Edge Detection Operators in Digital Image Processing MATLAB

Introduction:

An essential step in digital image processing is edge detection, which seeks to locate the borders or edges of objects in an image. It is an essential step in many computer vision and image analysis tasks, including object recognition, segmentation, and feature extraction. To complete this objective, several edge detection operators or algorithms have been created over time, each with advantages and disadvantages. In this post, we'll look at a few edge detection techniques frequently employed in digital image processing.

  • Digital images must have edges because they represent important local changes in intensity.
  • They act as boundaries between various areas of an image and offer crucial data for several image processing and computer vision tasks.

Let's explore the three main categories of edges:

  • Horizontal
  • Vertical
  • Diagonal

Horizontal Edges: In an image, a horizontal edge is created when there is a sudden change in hue or intensity. These edges usually denote transitions or borders between regions or primarily horizontal things.

Horizontal Edges Examples:

  • The line separates the sky and the earth in a landscape image.
  • A building's roofline against the background.
  • The lake's tranquil waterline is in a picture.

Edge detection algorithms like the Sobel or Prewitt operators, intended to accentuate horizontal direction changes, are frequently used to identify horizontal edges.

Vertical Edges: Conversely, a vertical edge is a sudden change in hue or intensity within an image. These edges frequently indicate these borders or transitions between regions or objects with mostly vertical properties.

Example of vertical edges:

  • The doorframe's borders in a picture of a room.
  • The limits of tall structures in a city skyline.
  • A tree stems against a background of contrast.

Edge detection algorithms that detect changes in the vertical direction, similar to the horizontal edges, can be used to identify vertical edges.

Diagonal Edges: Diagonal edges show shifts in hue or intensity that aren't strictly horizontal or vertical. Although less frequent, these edges can be significant in some situations, such as photos with oblique objects or intricate textures.

Examples of Diagonal Edges

  • The mountain's sloping edge is in a landscape picture.
  • The coat of a zebra with diagonal stripes.
  • The corners of a signpost with a slant.

It can be trickier to find diagonal edges than horizontal or vertical ones. It might call for more advanced edge detection methods, such as the Canny edge detector or applying Gabor filters, considering various directions or orientations.

Edge Detection:

Edge detection enables digital image processing systems to highlight areas of interest, facilitating analysis and comprehension of image content. Edge detection assists in identifying object borders, textures, and features by highlighting major changes in gray levels or intensity. This technique enables various applications to extract important data from photos effectively.

  • Pattern recognition, picture morphology, and feature extraction all heavily rely on edge detection, a key technique in digital image processing.
  • It is generally used to identify borders and transitions between various objects or regions within an image and segment an image into zones of discontinuity.

The significance and uses of it are briefly explained as follows:

Pattern recognition: Identification and classification of objects or patterns within an image are the objectives of pattern recognition. Thanks to edge detection, finding the edges of items makes it simpler to tell one object from another.

Image Morphology: Manipulating an image's shapes and structures using techniques like erosion and dilatation is known as image morphology.

Feature Extraction: For image analysis tasks, including object tracking, face recognition, and content-based picture retrieval, relevant characteristics must be extracted from an image.

Segmentation: Segmenting an image involves splitting it into useful areas or items. This procedure begins with edge detection, which locates probable borders between objects or locations.

Data Reduction: Edge detection has the potential to minimize the quantity of data in an image while still maintaining important structural information. This is one of its advantages. Subsequent processes can concentrate on regions of interest identified by the discovered edges rather than processing the entire image. This improves the effectiveness of image transmission and storage and speeds up processing.

Image Edge Detection Operators in Digital Image Processing MATLAB

Based on their basic ideas and methods, edge detection operators can be broadly divided into two categories:

Operators for Gradient-Based Edge Detection:

Sobel operator: calculates the gradient approximation of the intensity function of an image for edge detection. The vertical and horizontal derivative approximations are computed using convolution with two kernels, one for detecting vertical edges and another for horizontal edges.

Prewitt Operator: The Prewitt operator, like the Sobel operator, uses convolution with particular kernels to identify an image's vertical and horizontal edges.

Robert operator: Another operator that uses gradients to determine edge gradients is the Robert operator, which adds up the squares of differences between diagonally adjacent pixels in the image.

Operators for Gaussian-Based Edge Detection:

Canny edge detector: This popular edge detection method combines gradient-based edge detection and Gaussian smoothing.

Laplacian of Gaussian operator (LoG): This is a Gaussian-based operator that smoothes the image with a Gaussian function before computing the Laplacian to look for edges. It can detect edges at various scales and is sensitive to rapid intensity changes.

  • These two edge detection operators are ideal for various image processing settings because each has advantages and disadvantages.

Sobel Operator:

The Sobel Operator is a popular gradient-based edge detection method in digital image processing. It is used to locate edges inside an image by emphasizing areas where the intensity varies quickly. It is named after its creator, Irwin Sobel. The vertical (along the y-axis) and horizontal (along the x-axis) are the main directions in which the Sobel Operator concentrates on finding edges. This is accomplished by computing the intensity function of the image's gradient approximation.

The Sobel Operator is Explained in detail below:

Representation in Mathematics:

The Sobel Operator convolves the picture with two 3x3 convolution kernels or masks: Sobel Y for horizontal edges and Sobel X for vertical edges.

The following describes these kernels:

Vertical Edge Detection Sobel X:

M_x = -1 0 1

-2 0 2

-1 0 1

Sobel Y (Horizontal Edge Detection):

M_y = -1 -2 -1

  • 0 0
  • 2 1

Operation:

Convolution: The Sobel Operator conducts convolution between these kernels and the input picture. This convolution operation is applied to each image pixel to calculate the approximate vertical and horizontal derivatives.

Calculating the magnitude of a gradient involves creating two gradient pictures, one for vertical changes (Sobel Y) and one for horizontal changes (Sobel X), after convolution. These pictures show how quickly the intensity shifts in each direction.

Combining Magnitudes: The Sobel Operator commonly combines the magnitude data from the vertical and horizontal gradients to produce a single gradient image

Advantages:

Simplicity: The Sobel Operator is rather easy to comprehend and use.

Computing Effectiveness: It is computationally effective and only requires simple arithmetic calculations.

Sobel offers directional information about edges, making identifying edges with a certain orientation practical.

It is efficient at identifying continuous, smooth edges.

Limitations:

  • The Sobel Operator can be susceptible to image noise, which could result in erroneous detections.
  • It might be less effective at recognizing diagonal edges or edges with more complicated orientations.
  • Sobel can detect thick and rough edges, which may only be appropriate for some applications.

A fundamental and popular technique for edge detection is the Sobel Operator. It offers a simple method for locating edges in digital images by computing gradient approximations. When selecting an edge detection technique for a particular task, it is important to consider its susceptibility to noise and limits in detecting diagonal edges, even though it is useful for many applications.

Prewitt Operator:

Another gradient-based edge detection method used in digital image processing to find edges in an image is the Prewitt Operator. The Prewitt Operator, like the Sobel Operator, draws attention to areas where the intensity or color changes dramatically, signaling the existence of edges. It is incredibly good at distinguishing vertical and horizontal borders in photographs and is named for its creator, Judith M. S. Prewitt.

The Prewitt Operator is explained in full below:

Representation in Mathematics:

With the Prewitt Operator, the image is convolved using two 3x3 convolution kernels or masks, one for identifying edges on the horizontal (Prewitt X) and one on the vertical (Prewitt Y). The following describes these kernels:

Horizontal edge detection using Prewitt X:

M_x = [-1 0 1

-1 0 1

-1 0 1]

Prewitt Y (Vertical Edge Detection):

M_y = [-1 -1 -1

  • 0 0

1 1 1]

Operation:

Convolution: The input image and these kernels are convolved by the Prewitt Operator. This convolution procedure calculates the vertical and horizontal derivative approximations for each image pixel.

Gradient Magnitude Calculation: Two gradient pictures are created during convolution, one for identifying vertical changes (Prewitt Y) and the other for identifying horizontal changes (Prewitt X). These pictures show how quickly the intensity shifts in each direction.

Combining Magnitudes: To produce a single gradient magnitude image, the Prewitt Operator typically combines the magnitude data from the vertical and horizontal gradients. Like the Sobel Operator, the square root of a sum of the square gradient values in the vertical and horizontal directions is used to calculate the gradient magnitude at each pixel.

Advantages:

  • The Prewitt Operator is very good at spotting vertical and horizontal edges, making it appropriate for situations where the edge's orientation is important.
  • Edge orientation inside a picture can be ascertained using orientation detection.
  • Like the Sobel Operator, the Prewitt Operator is straightforward to comprehend and use.

Limitations:

Fixed Coefficients: In contrast to several other edge detection methods, the Prewitt Operator's coefficients are fixed and cannot be modified in response to the unique properties of an image.

Diagonal Edges: It might be less effective in identifying diagonal or other types of edges. The Prewitt Operator can be sensitive to image noise, resulting in erroneous edge detections.

Robert Operator:

In digital image processing, the Robert Operator, the Roberts Cross Operator, is a straightforward gradient-based edge detection method for locating edges in an image.

  • It is especially helpful for seeing diagonal edges and is named after its creator, Lawrence Roberts.
  • The Robert Operator determines edge gradients by adding the squares of a difference between diagonally adjacent pixels in the image.

The Robert Operator is explained in detail below:

Representation in Mathematics:

The Robert Operator employs two 2x2 convolution kernels or masks, Robert X and Robert Y, which are used to detect diagonal edges from top-left to bottom-right and from top-right to top-left, respectively:

Robert X (Top-left to Bottom-right Diagonal Edge Detection):

M_x = [1 0

0 -1]

Robert Y (Diagonal Edge Detection - Top-right to Bottom-left):

M_y = [0 1

-1 0]

Operation:

Convolution: The Robert Operator applies convolution to the input picture and these kernels. This convolution procedure calculates The diagonal derivative estimates for each image pixel.

Gradient Magnitude Calculation: Following convolution, two gradient pictures are created, one for identifying diagonal edges from top-left to bottom-right (Robert X) and the other for identifying diagonal edges from top-right to bottom-left (Robert Y).

Combining Magnitudes: Typically, the Robert Operator creates a single gradient magnitude image by combining the magnitude data from both diagonal gradients.

Advantages:

The Robert Operator is efficient in applications where diagonal features dominate since it is specifically built to detect diagonal edges.

Simplicity: The Robert Operator is easy to use, just like other fundamental gradient-based operators.

Preservation of Diagonal Edges: Due to its design, it effectively preserves diagonal edges.

Limitations:

The Robert Operator can be sensitive to image noise, resulting in erroneous edge detections.

Limited to Diagonal Edges: It may be less adaptable than other edge detection techniques and could be more effective at detecting vertical or horizontal edges.

  • A gradient-based edge detection technique called Robert Operator focuses on spotting diagonal edges in digital images.
  • Although it is a very straightforward method, it can be useful when diagonal edge features are interesting.
  • The performance of any edge detection approach should be evaluated in light of the particular image and application requirements.

Laplacian of Gaussian (LoG):

The Laplacian of Gaussian (LoG) operator, sometimes called the Marr-Hildreth operator, is a common edge detection method in digital image processing. It combines the Laplacian operator and Gaussian smoothing, two crucial ideas in image processing. The LoG operator highlights areas where the intensity or color abruptly changes to detect edges in a picture.

  • The Marr-Hildreth Operator, also known as the Laplacian of Gaussian (LoG), combines Gaussian smoothing and the Laplacian operator to detect edges in digital images.
  • It is a useful tool for many image processing applications due to its multi-scale capabilities and rotation invariance. At the same time, it may need careful parameter optimization to address susceptibility to noise and localization issues.

A thorough explanation of the Marr-Hildreth Operator (LoG) is given below:

Representation in Mathematics:

The two primary phases of the Marr-Hildreth Operator are as follows:

Gaussian Smoothing: The input image is first convolved with a Gaussian kernel to lessen noise and highlight progressive intensity changes. Here, the smoothing of the image is controlled by the standard deviation of a Gaussian distribution, represented by the symbol. A higher value produces more robust smoothing.

Laplacian Operation: The image is smoothed using a Gaussian kernel, and then the Laplacian operator is used to determine the image's Laplacian. The sum of the second derivatives concerning a picture's spatial coordinates (x and y) is used to determine its Laplacian.

The image smoothed out in the first stage is G(x,y).

Operation:

The input image is convolved using a Gaussian kernel with a specified value to produce a smoothed, noise-reduced image.

Laplacian Operation: The smoothed image is subjected to the Laplacian operator to produce the Laplacian of Gaussian (LoG) image.

Advantages:

  • Edge detection at several scales is possible with the LoG operator, making it possible to find edges with a range of thickness and intensity.
  • Fixed Properties in All Directions: It is rotationally invariant since its properties are fixed in all directions.

Limitations:

Sensitivity to Noise: The LoG operator, like other edge detection techniques, is susceptible to noise, which could result in erroneous detections or noisy replies.

Localization mistakes can be made by the LoG operator along curved edges, which could compromise the precision of edge detection.

Complex Computation: Compared to other edge detection techniques, the LoG operator requires more computer work due to the convolution with a Gaussian kernel and subsequent Laplacian operation.

Canny Operator:

A highly acclaimed edge detection method in digital image processing is the Canny Edge Detector, often known as the Canny Operator. It was created by John F. Canny in 1986 and is still a preferred option because of its precision in detecting edges, reduction of noise, and generation of thin, well-defined edge outlines. The Canny Operator uses a multi-step procedure to detect edges precisely.

  • A powerful edge detection method recognized for accurately identifying edges in digital images is the Canny Edge Detector.
  • A useful tool for numerous image processing applications, its multi-stage procedure aids in eliminating noise, producing thin edge contours, and connecting edge segments.

The Canny Operator is explained in detail below:

The method for detecting Canny Edges

The Canny Edge Detector has numerous stages, including:

Gaussian Smoothing: In the first step, the input image must undergo Gaussian smoothing. The image noise is reduced by Gaussian smoothing, but the important edges are kept. The image is convolves with a Gaussian kernel. The amount of smoothing is influenced by the kernel size selection (defined by the standard deviation). This process results in a blurred image with less noise.

Calculating a gradient: To assess the size and direction of intensity changes, the gradient of the smoothed image is determined at this stage. The gradient of the image in a x and y directions is frequently determined using the Sobel operator.

Each pixel's gradient magnitude is calculated by Combining the x and y gradients while applying the Pythagorean theorem.

Insufficient Suppression:

Non-maximum suppression is used to produce edges that are narrow and well-defined.

  • Non-maximum suppression compares the gradient magnitude of each pixel to the gradients of its neighbors in the gradient's direction.
  • The gradient's largest pixels, known as the local maximum, are kept, while the rest are suppressed. This makes sure that just the most noticeable edges are kept.

Hysteresis-Based Edge Tracking:

Hysteresis-based edge tracking makes it easier to join edge segments and eliminate weak, erroneous edges.

  • The double thresholding technique defines a high threshold (T_high) and a low threshold (T_low).
  • Strong edges are regarded as pixels with gradient magnitudes greater than T_high and are unquestionably present in the edge map. Potential weak edges are pixels with gradient magnitudes between T_low and T_high.

Edge tracking is used to follow prospective weak edges and include them in the edge map if they connect to strong edges.

Advantages:

  • The Canny Operator is renowned for its accurate edge detection, which results in clearly defined edges in the image.
  • Edge detection is made more accurate thanks to the Gaussian smoothing step's image noise reduction.
  • The operator produces narrow edge outlines, making it perfect for various image processing jobs.

Limitations:

Complex Computation: The Canny Operator requires more computation than simpler edge detection methods because it goes through multiple phases.

Parameter tuning: For the best results, it may be necessary to experiment with different values for the high and low thresholds and the size of the Gaussian kernel.

Sensitive to Thresholds: The Canny Operator's performance depends heavily on selecting appropriate threshold values, which can be difficult.

Image Edge Detection Applications in the Real World:

A fundamental method in digital image processing, edge detection has numerous practical uses in various industries.

Here are some thorough illustrations of edge detection in action:

  • Anatomical Structure Detection: In medical imaging, edge detection is essential for locating and highlighting anatomical structures in X-ray, CT, and MRI images. Planning effective diagnoses and treatments is made easier by it.
  • Object Recognition and Detection:

Edge detection is a satellite and aerial imaging technique to discover and recognize objects or structures. This is crucial for jobs like urban planning, disaster relief, and environmental monitoring.

  • Commercial inspection: Edge detection is a quality control technique used in manufacturing to check products for flaws or anomalies. It can spot surface flaws, cracks, and missing parts on manufactured goods.
  • Robotics: Robots employ edge detection to find objects and barriers in their environment. Object localization. This facilitates automated assembly, object manipulation, and navigation.
  • Lane detection: Self-driving cars employ edge detection to locate lane markers on roads. For safe navigation and vehicle control, this information is essential.
  • Biometrics: Edge detection is utilized in facial recognition systems as a preprocessing step. It aids in separating individual facial features and improves the precision of facial recognition algorithms.
  • JPEG Compression: Edge information is kept when images are compressed using the JPEG format. Through the preservation of important features, this helps sustain image quality.
  • Recognition of fingerprints: Analysis of fingerprints: Edge detection is used to recover the ridges and minute points specific to each person's fingerprints and for biometric identification.
  • Document evaluation Text extraction: Edge detection in OCR (Optical Character Recognition) systems helps to distinguish text from the backdrop in scanned documents, making it simpler to recognize and digitize text.
  • Crop Health Monitoring: Edge detection is utilized in remote sensing applications to track crop health and spot changes in vegetation, which supports precision farming.
  • Forensics: Edge detection algorithms examine photos in forensic investigations and spot possible tampering or modifications.






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA




news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news