Exp 6
Exp 6
AIM: Implementation of Image Sharpening filters and Edge Detection using Gradient Filters.
THEORY:
1) Image Sharpening Filters: Image sharpening is a technique used to enhance the details and edges
in an image, making it appear clearer and more defined. Sharpening filters work by increasing the
contrast of edges and high-frequency components in the image. There are various sharpening filters,
but two common ones are the Laplacian filter and the Unsharp Masking (USM) filter.
1.1) Laplacian Filter: The Laplacian filter is a high-pass filter that enhances the edges and details
in an image by emphasizing the second derivative of the image intensity. It is often used for
edge detection and image sharpening.
1.2) Unsharp Masking (USM) Filter: The Unsharp Masking (USM) filter is a sharpening
technique that works by subtracting a blurred version of the image from the original image.
This enhances the edges and details in the image while reducing noise.
2) Edge Detection using Gradient Filters: Edge detection is a fundamental operation in image
processing that aims to identify the boundaries between objects in an image. Gradient-based edge
detection methods compute the rate of change of pixel intensity values in the image to locate edges.
Common gradient-based edge detection filters include the Sobel, Prewitt, and Roberts operators.
2.1) Sobel Operator: The Sobel operator is a widely used edge detection filter that enhances
edges by computing intensity changes in both horizontal and vertical directions using 3×3
convolution kernels. It emphasizes edges more than Prewitt and produces thicker,
smoother edges, making it suitable for detecting significant boundaries while reducing noise
sensitivity.
2.2) Prewitt Operator: The Prewitt operator is similar to Sobel but uses simpler, uniform-
weighted kernels. It also detects edges in horizontal and vertical directions but with less
emphasis on intensity variation. It is computationally faster than Sobel and provides
sharper but thinner edges, making it better for noisy images.
2.3) Roberts Operator: The Roberts operator is the simplest gradient-based edge detector,
using 2×2 convolution kernels to detect diagonal edges. It works best for sharp, fine
details in high-contrast images but is more sensitive to noise compared to Sobel and
Prewitt. It is the fastest among the three but may not handle smooth edges well.
PROCEDURE:
1. Read the Image: Read the image you want to process using the imread function.
2. Convert to Grayscale: Convert the image to grayscale if it is in RGB format using the rgb2gray
function.
3. Apply Image Sharpening Filters:
• Display the original image along with the images after sharpening and edge detection.
• Modify the sharpening filter kernels and gradient filter kernels to observe different effects
Code:
% Read the image
i = imread('edge_detection.jpeg');
Result:
Learning Outcome:
Students learned how to apply image sharpening filters such as the Laplacian to enhance edges and
details. They understood the principles of gradient-based edge detection using Sobel, Prewitt, and
Roberts operators and how these methods differ in detecting edges in various directions. Additionally,
they gained hands-on experience in implementing these techniques in MATLAB and analyzing their
effects on images.