0% found this document useful (0 votes)
13 views4 pages

Linear Filtering

Uploaded by

yuvan.yuvan2004
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views4 pages

Linear Filtering

Uploaded by

yuvan.yuvan2004
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Linear Filtering

1. Introduction
- Linear filtering processes an image by convolving it with a kernel (filter mask) to enhance
or extract
features.
- It helps in noise reduction, edge detection, and image sharpening.
- The output pixel value is computed as a weighted sum of the pixel's neighborhood defined
by the filter
kernel.
2. Types of Linear Filters
- Low Pass Filters: Used for smoothing and noise reduction by averaging pixel values.
- High Pass Filters: Used for edge detection by highlighting intensity changes in the image.
A. Low Pass Filters (Smoothing Filters)
1. Mean Filter
- Replaces each pixel with the average of its surrounding pixels, reducing noise.
- Results in image blurring due to smoothing of details.
Mean Filter Kernel (3x3):
[111
111
1 1 1 ] x 1/9
Example Image Patch:
[ 10 20 30
40 50 60
70 80 90 ]
Sum = 450
Average = 450 / 9 = 50
Advantages:
- Simple and easy to implement.
- Effectively reduces random noise.
Disadvantages:
- Blurs sharp edges and fine details.
- Not good for images requiring edge preservation.

2. Gaussian Filter
- Uses weighted average giving more importance to central pixels, preserving edges better.
- More effective in smoothing while maintaining image structure.
Gaussian Filter Kernel (3x3):
[121
242
1 2 1 ] x 1/16
Example Image Patch:
[ 100 100 100
100 200 100
100 100 100 ]
Weighted sum = 2000
Output = 2000 / 16 = 125
Advantages:
- Better at preserving edges than mean filter.
- Reduces noise while keeping image features intact.
Disadvantages:
- More complex computation than mean filter.
- Slight blurring still occurs.
B. High Pass Filters (Edge Detection)
1. Laplacian Filter
- Detects edges by calculating the second derivative of the image.
- Highlights regions with rapid intensity changes in all directions.
Laplacian Kernel:
[ 0 -1 0
-1 4 -1
0 -1 0 ]
Example:
[ 0 0 0
0 255 0
0 0 0]

Output = 4 × 255 = 1020 (clipped to 255 in 8-bit images)


Advantages:
- Detects edges in all directions.
- Simple and effective for edge detection.
Disadvantages:
- Sensitive to noise.
- Does not provide edge direction information.
2. Sobel Filters
- Approximates the first derivative to detect horizontal and vertical edges.
- Combines smoothing and differentiation, reducing noise sensitivity.
Sobel X (Vertical Edges):
[ -1 0 1
-2 0 2
-1 0 1 ]
Sobel X Example:
[ 10 10 10
20 20 20
30 30 30 ]
Output = 0 (No vertical edge)
Sobel Y (Horizontal Edges):
[ -1 -2 -1
0 0 0
1 2 1]
Sobel Y Example:
[ 10 10 10
20 20 20
30 30 30 ]
Output = 80 (Horizontal edge)
Advantages:
- Less sensitive to noise due to smoothing.
- Provides edge magnitude and direction.

Disadvantages:
- More computationally intensive than Prewitt.
- May miss fine edges.
3. Prewitt Filters
- Similar to Sobel with simpler weights.
- Detects vertical and horizontal edges using uniform difference.
Prewitt X (Vertical Edges):
[ -1 0 1
-1 0 1
-1 0 1 ]
Prewitt X Example:
[ 10 10 10
20 20 20
30 30 30 ]
Output = 0 (No vertical edge)
Prewitt Y (Horizontal Edges):
[ -1 -1 -1
0 0 0
1 1 1]
Prewitt Y Example:
[ 10 10 10
20 20 20
30 30 30 ]
Output = 60 (Horizontal edge)
Advantages:
- Simpler and faster than Sobel.
- Effective for edge detection.
Disadvantages:
- More sensitive to noise than Sobel.
- Less accurate edge direction information.

You might also like