Multimedia & Machine Learning Algorithms · Multimedia Algorithms
Convolutional Filters — Spatial Domain Image Processing
Explanation
Convolutional Filters — Intuition
An image filter replaces each pixel with a weighted average of its neighbors. Different weights produce different effects: blurring, sharpening, edge detection, and more. The mathematical operation behind most filters is called convolution.
2D Discrete Convolution
Given an image and a kernel (a small matrix, typically or ). The cross-correlation operation, used in practice by most image processing frameworks:
The kernel "slides" across the image: at each position , multiply the pixel values under the kernel by the kernel weights and sum.
Common Kernels
Gaussian Blur
Element sum: . Keeping the sum at ensures average brightness is preserved.
Effect: Spreads intensity among neighboring pixels — blurs fine details and smooths noise. This is a low-pass filter — attenuates high frequencies.
Sharpening — Laplacian-Sharpening Kernel
Element sum: . The kernel amplifies the center pixel () and subtracts neighbor contributions ( each). This equals — adding back "detail" that blurring would remove.
Edge Detection — Laplacian Kernel
Element sum: . In a uniform region (all pixels equal), the output is zero; only regions with change (an edge) produce a non-zero response.
Horizontal Gradient — Sobel X
Subtracts the left column and adds the right column — detects horizontal intensity changes (vertical edges). Like the Laplacian, the element sum is 0.
Binary Morphology
For binary images (black-white, values 0/1) and a structuring element :
- **Erosion :** output pixel is if and only if all pixels under are . Shrinks white objects and removes noise.
- **Dilation :** output pixel is if at least one pixel under is . Expands white objects and fills small holes.
Interactive Visualization
Loading visualization
Worked Examples
Practice
Exercise 1 of 6
1
The Gaussian blur kernel — what is the sum of all its elements?
★Quiz
Test your knowledge from this lesson
A mix of questions from the lesson — each attempt varies slightly
Answer at least 4 out of 5 questions correctly to pass (70%)