CSS 433 Computer Vision: Chapter 5 (Part 1)
Spatial Domain Filtering â Complete Technical & Exam Preparation Guide
Module 1: Foundations of Spatial Domain Filtering
1. Filter Classifications & Definitions
Spatial domain filtering operates directly on the pixel grid of an image:
Filters are categorized along two primary axes:
Frequency Domain Behavior
- Low-Pass Filters (LPFs): Attenuate high spatial frequencies (edges, noise, sharp texture) while passing low spatial frequencies (flat regions, smooth background). Used for smoothing, blurring, and noise suppression.
- High-Pass Filters (HPFs): Attenuate low spatial frequencies and pass high frequencies. Used for edge detection, detail extraction, and image sharpening.
- Band-Pass Filters (BPFs) & Band-Stop / Notch Filters: Pass or attenuate specific frequency bands (e.g., removing periodic hum or grid patterns).
Mathematical Operation
- Linear Filters: The output is a linear combination (weighted sum) of the input neighborhood values. They obey the Superposition Principle:
- Non-Linear Filters: The output cannot be expressed as a linear sum of inputs. They are based entirely or partially on order statistics (e.g., median, min, max, mode) or conditional intensity differences (e.g., bilateral filters).
2. Mechanics of Linear Spatial Filtering
A small matrix called a filter mask, kernel, convolution mask, or impulse response of size (with odd dimensions , ) is scanned over every pixel of the input image.
Image Coordinate System (f) Mask Coordinate System (w)
y (columns) t (horizontal)
+------------------> +------------------>
| | w(-1,-1) w(-1,0) w(-1,1)
| [ f(x,y) ] | w( 0,-1) w( 0,0) w( 0,1)
x | s | w( 1,-1) w( 1,0) w( 1,1)
(rows)| (rows)|
v v
Correlation vs. Convolution
- 2D Cross-Correlation (): Slips the mask across the image without rotation:
- 2D Convolution (): Rotates the mask by prior to computing the weighted sum:
- 1D Vector Notation (Dot Product): Over a window, let and . The response is the vector inner product:
3. Linear Low-Pass Filtering (Weighted Arithmetic Mean)
The general form of a linear smoothing filter is a Weighted Arithmetic Mean (WAM):
Standard LPF Kernels
Gaussian Weight Surface (3x3):
[1/16] [2/16] [1/16]
[2/16] [4/16] [2/16] <--- Peak weight at center (4/16)
[1/16] [2/16] [1/16]
Universal Properties of Linear LPFs
- Sum of normalized coefficients equals 1: . This ensures that a uniform intensity region () is invariant under filtering ().
- Symmetry: Coefficients are symmetric with respect to the mask center ().
- Noise Spreading: A linear LPF suppresses an impulse by attenuating its peak amplitude and spreading its energy into an area equal to the mask dimensions. It does not eliminate the noise energy.
- Mask Size Impact: The larger the mask (), the greater the blurring power and noise reduction, but edge localization is severely degraded.
4. Boundary Padding & Why Filtering Causes Black Frames
When a mask of size () centers on a boundary pixel, the mask overhangs the edge by pixels. MATLABâs imfilter handles boundary values through four distinct modes:
Boundary Extension Modes (for boundary [a b c]):
Zero-Padding (Default): 0 0 | a b c | 0 0 <-- Discontinuity causes black border
Symmetric (Mirror): c b | a b c | c b
Replicate (Clamp/Extend): a a | a b c | c c
Circular (Periodic): b c | a b c | a b
The Root Cause of Black Frames
By default, functions like MATLABâs imfilter(img, mask) pad outer boundary coordinates with zero (X = 0).
- When an averaging mask centers on an outer border pixel, multiple elements of its neighborhood are zero.
- As a result, the weighted sum drops sharply near the border:
- This creates a dark, faded perimeter around the filtered image. Using
'replicate'or'symmetric'avoids this issue because boundary pixels mirror or clamp valid image data.
5. Separable 2-D Filters
A 2D spatial convolution mask of size is separable if and only if it has a matrix rank of 1:
Computational Complexity Proof
Let an image have size , processed with a kernel.
- Direct 2D Convolution: Every pixel requires multiplications and additions:
- Separated 1D Filtering: Convolve row-wise with ( multiplications per pixel), then column-wise with ( multiplications per pixel):
For a filter, the operation is faster; for a filter, it is faster.
Module 2: Exercises 1â4 Solutions & Analysis
Coordinate Grid for Exercises 1 to 4:
Row 1: (1,1) (1,2) (1,3) (1,4) (1,5) (1,6) (1,7)
Row 2: (2,1) (2,2) (2,3) (2,4) (2,5) (2,6) (2,7)
Row 3: (3,1) (3,2) (3,3) (3,4) (3,5) (3,6) (3,7)
Row 4: (4,1) (4,2) (4,3) [4,4] (4,5) (4,6) (4,7) <-- Impulse noise at (4,4)
Row 5: (5,1) (5,2) (5,3) (5,4) (5,5) (5,6) (5,7)
Row 6: (6,1) (6,2) (6,3) (6,4) (6,5) (6,6) (6,7)
Row 7: (7,1) (7,2) (7,3) (7,4) (7,5) (7,6) (7,7)
Exercise 1: Mean Filtering on an Impulse Noise
Input
A image of zeros with an isolated impulse noise of value at central coordinate :
Step-by-Step Calculation
- For any pixel whose neighborhood does not include , all pixel values are zero:
- For any pixel whose neighborhood includes (meaning and ), the neighborhood contains eight zeros and one value of :
Output Matrix
Core Insight: The single sharp spike of was not eliminated. It was dispersed across a area with a lowered amplitude of .
Exercise 2: Gaussian Filtering on an Impulse Noise
Input
The same image with an impulse of at :
Step-by-Step Calculation
The impulse response of a linear filter centered on a unit delta function is the filter mask itself scaled by the impulse amplitude:
- At center , mask coefficient is :
- At 4-neighbors , mask coefficient is :
- At diagonal corners , mask coefficient is :
- All other pixels do not overlap :
Output Matrix
Exercise 3: Mean Filtering on a Ramp Signal with Impulse Noise
Input
A background ramp decreasing by per row, with an impulse noise of located at :
- Row 1: , Row 2: , Row 3: , Row 4: (with ), Row 5: , Row 6: , Row 7: .
Analytical Solution via Principle of Superposition
Because the filter is linear, decompose the image into two additive components:
Where , and elsewhere.
- Response to Linear Ramp (): For any interior row away from boundary limits, the vertical neighbors are , , and . Because the vertical ramp is linear:
The linear filter reconstructs the underlying linear ramp without distortion.
2. Response to Noise (): From Exercise 1, the noise contribution adds across the neighborhood around .
Output Matrix
(Values in bold represent )
Exercise 4: Gaussian Filtering on a Ramp Signal with Impulse Noise
Input
The same ramp background with impulse at , using the Gaussian kernel.
Step-by-Step Calculation
- Response to Linear Ramp:
For each row :
- Row above contributes weight , value
- Center row contributes weight , value
- Row below contributes weight , value
- Add Noise Response (from Exercise 2):
- Row 3:
- Row 4:
- Row 5:
Output Matrix
Module 3: Non-Linear Filters (Bilateral, Median, and Mode)
1. Bilateral Filters (Tomasi & Manduchi, 1998)
Linear Gaussian filtering blurs across boundaries because it computes weights based solely on spatial distance. The Bilateral Filter (BF) preserves edges by incorporating both geometric closeness and photometric similarity.
Standard Gaussian: Weight = f( Spatial Distance ||p - q|| )
Bilateral Filter: Weight = f( Spatial Distance ||p - q|| ) * g( Intensity Difference |I_p - I_q| )
Mathematical Formulation
Where:
Parameter Mechanics
- (Spatial Parameter): Controls the spatial neighborhood scale. Larger averages over wider neighborhoods.
- (Range Parameter): Controls sensitivity to intensity boundaries:
- As , : the bilateral filter converges to a standard linear Gaussian blur.
- As , for any intensity difference: no smoothing occurs, leaving the input unchanged.
- Slide 16 Typo Note: In Slide 16 of the lecture presentation, the top Gaussian mask entry at has a value of . The bottom-left table incorrectly shows a , which the slide explicitly labels as a
"Typo error!".
Exercise 5: Bilateral Filtering in 1-D
Problem
Given 1-D signal:
- Gaussian LPF:
- Median filter: size
- Bilateral filter: . If , the difference is âgreatâ and weight is set to ; otherwise weight is . Spatial weights are .
- Ignore boundaries and .
Signal: [ 1, 9, 2, 8, 1, | 28, 22, 29, 20, 28 ]
Region: <--- Low Intensities (~1-9) --> | <-- High Intensities (~20-29) -->
STEP EDGE
Complete Computation Table
| Index | Window | Gaussian LPF: | Median () | Bilateral Filter Range Differences | Bilateral Filter Effective Weights & Output |
| :------------------- | :------------------------------- | :--------------------------------------------------------- | :------------------------------------- | :----------------------------------- | :-------- | ------------------------------- | ------------------------------------------- | -------------------------- | --------------------------------------------------------------------------------------------------------- |
| () | | | |
| Weights: ,
|
| () | | | |
| Weights: ,
|
| () | | | |
| Weights: ,
|
| () | | (Edge blurred!) | |
| Weights: ,
|
| () | | (Edge blurred!) | |
| Weights: ,
|
| () | | | |
| Weights: ,
|
| () | | | |
| Weights: ,
|
| () | | | |
| Weights: ,
|
Exam Review Comparison
- Notice and at the step boundary between and :
- Gaussian LPF: Strongly blurs across the edge ().
- Bilateral Filter: The weight across the step edge drops to zero (). It keeps the low side low () and the high side high (), preserving the step boundary while smoothing noise on each flat plateau.
Exercise 6: Bilateral Filtering in 2-D
Input Image
A image containing a vertical boundary separating a region on the left from a region on the right:
Filter Specification
- Spatial Gaussian mask:
- Range threshold: Difference ; difference .
- Ignore boundary pixels; evaluate interior grid: rows , cols .
Step-by-Step Pixel Calculations
1. Pixel (Uniform High Region)
- Neighborhood :
- Differences :
- Range weights (threshold ):
- Effective weights :
- Filtered Value:
2. Pixel (Uniform High Region)
- Neighborhood :
- Differences :
- Range weights :
- Effective weights :
- Filtered Value:
3. Pixel (Uniform High Region)
- Neighborhood :
- Differences :
- Range weights :
- Effective weights :
- Filtered Value:
4. Pixel (Step Edge: Low Side)
- Neighborhood :
- Differences :
- Range weights :
- Effective weights :
- Filtered Value:
5. Pixel (Low Side, Neighboring High Region)
- Neighborhood :
- Differences :
- Range weights :
- Effective weights :
- Filtered Value:
6. Pixel (High Side, Neighboring Low Region)
- Neighborhood :
- Differences :
- Range weights :
- Effective weights :
- Filtered Value:
7. Pixel (Uniform Low Region)
- Neighborhood :
- All differences all range weights are .
- Effective weights equal the full Gaussian mask ().
- Filtered Value:
8. Pixel (Low Side, Bordering High Region)
- Neighborhood :
- Differences :
- Range weights :
- Effective weights :
- Filtered Value:
9. Pixel (High Side, Bordering Low Region)
- Neighborhood :
- Differences :
- Range weights :
- Effective weights :
- Filtered Value:
Final Filtered Interior Grid
Conclusion: The boundary between the values and the values remains sharp. No intermediate blurred values (such as ) appear at the transition pixels and .
2. Median Filters
The median filter replaces the center pixel with the statistical median of its neighborhood:
Square Mask (3x3, N=9): Cross Mask (3x3, N=5):
[ * * * ] [ . * . ]
[ * * * ] [ * * * ]
[ * * * ] [ . * . ]
Median is 5th ranked element. Median is 3rd ranked element.
Core Properties & Design Rules
- Outlier Removal: Completely eliminates impulse noise (salt-and-pepper) without blurring sharp step edges, because extreme values sort to the minimum or maximum ends of the array.
- The Geometric Removal Rule: A median filter eliminates any target object or detail whose spatial width is less than half the mask size:
To preserve an object, the mask must be smaller than twice the object width. 3. Square vs. Cross Mask: _ Square Mask (): Better noise suppression ( samples); rounds or erodes sharp corners and thin lines. _ Cross-Shape Mask (): Better preservation of horizontal and vertical lines and sharp corners; weaker noise reduction ( samples).
Exercise 7: Median Filtering on Image A and Image B
1. Processing Image A (Impulse noise at center)
Image A:
5 5 5 5 5
4 4 4 4 4
3 3 13 3 3 <-- Impulse noise of 13 at (3,3)
2 2 2 2 2
1 1 1 1 1
- At Center Pixel :
- Square mask:
- Cross-shape mask:
- Result: Both masks successfully remove the impulse noise, restoring the underlying true value .
2. Processing Image B (Corner Boundary)
Image B:
0 0 0 0 0
0 0 0 0 0
0 0 10 10 10 <-- Corner feature at (3,3)
0 0 10 10 10
0 0 10 10 10
- At Corner Pixel :
- Square mask: (The corner pixel at is eroded to . The square mask cuts the corner).
- Cross-shape mask: (The corner pixel is preserved).
Exercise 8: Median Filtering on Thin Vertical Lines
Inputs
- Image A: 1-pixel wide vertical line of zeros embedded in an image of tens.
- Image B: 1-pixel wide vertical line of tens embedded in an image of zeros.
Image A (Dark Line): Image B (Bright Line):
10 10 0 10 10 0 0 10 0 0
10 10 0 10 10 0 0 10 0 0
10 10 0 10 10 0 0 10 0 0
10 10 0 10 10 0 0 10 0 0
10 10 0 10 10 0 0 10 0 0
Calculations for Center Column ()
1. Square Mask ()
- Image A (Dark Line, Center = 0): Each row contains . Across 3 rows, there are three s and six s. The 1-pixel dark line is completely eliminated.
- Image B (Bright Line, Center = 10): Each row contains . Across 3 rows, there are six s and three s. The 1-pixel bright line is completely eliminated.
2. Cross-Shape Mask ()
- Image A (Dark Line, Center = 0): Neighborhood: . The dark vertical line is preserved.
- Image B (Bright Line, Center = 10): Neighborhood: . The bright vertical line is preserved.
Summary Table
| Input Pattern | Square Result | Cross-Shape Result |
|---|---|---|
| Image A (1-px Dark Line) | Line removed (replaced with ) | Line preserved () |
| Image B (1-px Bright Line) | Line removed (replaced with ) | Line preserved () |
Exercise 9: Shading Correction via Median Filter
Problem Analysis
In the retinal fundus image (Slide 28), non-uniform background illumination (vignetting/shading) causes bright patches on one side and gradual darkening on the other, while thin blood vessels have fine spatial detail.
Retinal Model: f(x,y) = Background_Shading(x,y) + Blood_Vessels(x,y)
Goal: Isolate Blood_Vessels without shading artifacts.
Engineering Solution
- Filter Selection: Apply a large 2D Median Filter to the image:
- Filter Size Design:
- Let the maximum blood vessel width be (typically to pixels).
- Choose a mask dimension (e.g., or ).
- Because the mask is much wider than any vessel, the median filter treats the vessels as outliers and removes them entirely, leaving only the smoothly varying background shading .
- Correction (Background Subtraction / Normalization):
(Where is a constant, such as , to center displayable dynamic range).
Exercise 10: Median Filtering on Lines of Various Geometries
Question 1: Two Crossing Lines of Width 1 Pixel
- Filter: 2D Median Filter:
- Along the lines: 3 line pixels, 6 background pixels line is removed.
- At the intersection : The window contains 5 line pixels (one vertical line of 3, one horizontal line of 3, sharing the center) and 4 background pixels.
- Sorted: four s, five s .
- Result: The crossing lines vanish, leaving a single isolated white dot at the intersection.
- Filter: 2D Median Filter:
- At the intersection: Line pixels within the window form a cross: 5 horizontal + 5 vertical center line pixels.
- Total pixels in . Background pixels .
- Sorted: sixteen s, nine s .
- Result: Both lines and their intersection are completely removed.
Question 2: Applying 1D Median Filters Separately and Sequentially
- 1D horizontal filter ():
- Scans horizontally. For a vertical line of width 1, the cross-section is . The vertical line is removed.
- For a horizontal line, the cross-section along the filter is . The horizontal line is preserved.
- 1D vertical filter ():
- Scans vertically. The horizontal line has cross-section , so it is removed.
- The vertical line has cross-section , so it is preserved.
- Sequential Application ( followed by ):
- Step 1 (): Removes vertical line; keeps horizontal line.
- Step 2 ( applied to output of Step 1): Removes the remaining horizontal line.
- Result: The entire image becomes completely black (all lines removed).
Question 3: Lines of Width 2 Pixels
- 2D Median Filter: To eliminate a 2-pixel wide line, the mask dimension must satisfy use a Square Median Filter.
- 1D Median Filter: To remove a 2-pixel wide line in 1D, use a (or ) filter. In a 5-element window, a 2-pixel line contributes 2 ones and 3 zeros .
Question 4: Three Parallel Lines of Widths 1, 2, and 3 Pixels
Objective: Remove lines of widths 1 and 3, while preserving the line of width 2.
Line 1 (w=1) Line 2 (w=2) Line 3 (w=3)
| || |||
- Step 1: Apply a 1D median filter of size perpendicular to the lines.
- Width 1 line: removed ().
- Width 2 line: preserved ().
- Width 3 line: preserved ().
- Result: Contains lines of width 2 and width 3. Call this .
- Step 2: Apply a 1D median filter of size to (or to the original image).
- Width 1 line: removed ().
- Width 2 line: ones, zeros removed ().
- Width 3 line: ones, zeros preserved ().
- Result: Contains only the line of width 3. Call this .
- Step 3 (Reconstruct Target): Subtract from :
Result: The line of width 2 is isolated, while lines of widths 1 and 3 are eliminated.
3. Mode Filters & The âOil Paintingâ Effect
- Definition: Replaces the center pixel with the statistical mode (the most frequently occurring intensity value) within the neighborhood:
- Visual Characteristic: It clusters local pixel values into piecewise-constant patches. Fine gradients collapse into flat color regions while major boundaries remain fixed.
- The âOil Paintingâ Effect: Because gradual tonal changes are mapped to the locally dominant intensity, the image looks like it was rendered with brushstrokes of uniform paint.
% MATLAB implementation:
fun = @(x) mode(x(:));
OilPainting = nlfilter(double(img), [5 5], fun);Module 4: High-Pass Filters & Gradient Operators
High-Pass Filters are based on spatial derivatives, measuring the rate of change of image intensity.
Edge Model:
Intensity Profile: _____/âūâūâūâūâū (Step / Ramp)
1st Derivative: _____/\_____ (Forms an extreme peak at the slope)
2nd Derivative: ___/\__\/___ (Forms a zero-crossing)
1. Mathematical Approximations of First Derivative
Two-Point Forward Approximation
Centered Difference Approximation
Exercise 11: First & Second Derivatives on a 1D Signal
Input Signal
Given discrete array: Indices .
Operators
- 1st Derivative Kernel: (Centered difference: )
- 2nd Derivative Kernel: (Laplacian: )
Step-by-Step Calculation Table
| Index | 1st Derivative: | 2nd Derivative: | Feature Type | |
|---|---|---|---|---|
| 1 | 5 | Boundary | Boundary | Flat |
| 2 | 5 | Flat | ||
| 3 | 5 | Step onset to isolated spike | ||
| 4 | 17 | Peak of isolated impulse | ||
| 5 | 5 | Step return from spike | ||
| 6 | 5 | Flat | ||
| 7 | 5 | Leading edge of step | ||
| 8 | 14 | Trailing edge of step onset | ||
| 9 | 14 | Flat plateau | ||
| 10 | 14 | Flat plateau | ||
| 11 | 14 | Leading edge of downward step | ||
| 12 | 5 | Trailing edge of downward step | ||
| 13 | 5 | Flat | ||
| 14 | 5 | Boundary | Boundary | Flat |
Key Takeaways for the Exam
- At the isolated noise point (): The 1st derivative produces zero at the peak, flanked by . The 2nd derivative produces a strong negative spike of , showing that the Laplacian responds intensely to isolated noise points.
- At the step edge (): The 1st derivative produces a single-polarity hump (). The 2nd derivative transitions from positive to negative (), producing a zero-crossing.
Exercise 12: Proof of Maximum Gradient Direction
Problem Statement
Prove that the directional derivative of an image reaches its maximum magnitude along the direction of the gradient vector .
Formal Mathematical Proof
- Define Gradient Vector: The gradient of is defined as:
- Define Directional Derivative: Let be an arbitrary unit vector pointing in direction : The directional derivative of in the direction of is:
- Apply Vector Dot Product Properties: Where is the angle between the gradient vector and the unit direction vector .
- Maximize the Function: Because is fixed at any given coordinate: The cosine function reaches its maximum when:
- Conclusion: means is collinear with and points in the exact direction of : The maximum rate of increase equals the gradient magnitude:
2. Standard 2-D Gradient Kernels
Roberts Cross Operators ()
Diagonal differences:
Prewitt Operators ()
Separable edge detectors with a box averaging profile along the orthogonal axis:
Sobel Operators ()
Separable edge detectors with a Gaussian smoothing profile along the orthogonal axis to better suppress noise:
Exercise 13: Prewitt Operators on a Step Edge Image
Input Image
A binary step image:
Kernels
Step-by-Step Calculations for Representative Pixels
- Uniform Regions:
- Any pixel surrounded entirely by s or entirely by s yields and , so .
- Pure Vertical Boundary (e.g., Pixel where column transitions from to ):
- Neighborhood :
- Magnitude:
- Pure Horizontal Boundary (e.g., Pixel where row transitions from to ):
- Neighborhood :
- (columns are symmetric left-to-right)
- Magnitude:
- Corner Junction Pixel :
- Neighborhood :
- Magnitude: (or )
Resulting Gradient Magnitude Matrix
Module 5: Second Derivatives (Laplacian) & Sharpening
1. The Laplacian Operator
The Laplacian is the isotropic, rotationally invariant 2nd-order differential operator:
Finite difference expansions:
4-Neighbor Laplacian: 8-Neighbor Laplacian:
[ 0 1 0 ] [ 1 1 1 ]
[ 1 -4 1 ] [ 1 -8 1 ]
[ 0 1 0 ] [ 1 1 1 ]
Essential Properties
- Zero-Sum: Coefficients sum to zero (). Output in uniform intensity areas is strictly zero.
- Zero-Crossing Edge Localization: A zero-crossing in the Laplacian response marks the inflection point where the first derivative (gradient) reaches its maximum.
- Noise Sensitivity: Second derivatives heavily amplify high-frequency noise. In practice, images are pre-smoothed with a Gaussian filter, forming the Laplacian of Gaussian (LoG) operator:
Exercise 14: Laplacian Operator on a Step Edge
1. Apply the 8-Neighbor Laplacian
Applying this mask to the binary step image from Exercise 13:
Step Image f:
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 1 1 1 1
0 0 0 1 1 1 1
0 0 0 1 1 1 1
0 0 0 1 1 1 1
- Uniform regions (s or s): .
- Just outside the horizontal boundary (e.g., Pixel ):
- Neighborhood has three s in the bottom row:
- Just inside the horizontal boundary (e.g., Pixel ):
- Neighborhood has five s (itself and four neighbors) and three s:
- At the outer corner pixel :
- Only pixel has a value of :
- At the inner corner pixel :
- Three neighbors have value : .
Output Matrix
2. How to Sharpen the Detected Borders
Sharpening restores high-frequency edge details by subtracting the negative-center Laplacian:
(Use addition if the center coefficient is positive).
Verification at Edge Pixels (using ):
- Outer Edge Pixel : (Dark side is pushed darker, creating an undershoot).
- Inner Edge Pixel : (Bright side is boosted higher, creating an overshoot).
This introduces Mach-band overshoot and undershoot along the edge, increasing perceived sharpness.
2. Unsharp Masking & Highboost Filtering
Unsharp masking sharpens images using a low-pass filter:
[Original Image] -----> [Low-Pass Filter] -----> [Blurred Image]
| |
+------------------- (-) <-----------------------+
|
[High-Pass Mask]
|
(x k) Scaling Factor
|
[Original Image] -----> (+) +
|
[Sharpened Image]
Formula
- Obtain smoothed baseline:
- Compute the unsharp detail mask:
- Add scaled mask back to original:
- : Standard Unsharp Masking.
- : Highboost Filtering (amplifies high frequencies over low-frequency background).
Comprehensive Exam Summary
| Filter Name | Type | Weight Constraint | Noise Response | Edge / Boundary Behavior | Computational Complexity |
|---|---|---|---|---|---|
| Mean (Box) Filter | Linear LPF | (Uniform weights) | Spreads impulse noise into a block | Blurs edges; causes square artifacts | or (separable) |
| Gaussian Filter | Linear LPF | (Gaussian bell) | Spreads noise into a smooth Gaussian profile | Blurs edges smoothly; isotropic | (strictly separable) |
| Bilateral Filter | Non-Linear LPF | () | Suppresses noise locally within smooth plateaus | Preserves sharp edges; stops averaging across boundaries | per pixel (non-separable) |
| Median Filter | Non-Linear LPF | Order statistic | Completely removes salt-and-pepper noise | Preserves step edges; erodes objects smaller than | (sorting overhead) |
| Mode Filter | Non-Linear LPF | Order statistic | Replaces values with neighborhood mode | Collapses gradients into flat patches (oil-painting) | (histogram voting) |
| Prewitt / Sobel | Linear HPF | Amplifies high-frequency noise | Computes 1st derivative; produces gradient magnitude peaks | (separable) | |
| Laplacian Filter | Linear HPF | Strongly amplifies noise; requires Gaussian preprocessing (LoG) | Computes 2nd derivative; forms zero-crossings at edges | Non-separable (-neighbor) |