Image Processing Basics
Filtering and Transforms
About This Level
The basic level covers the core filtering techniques of image processing. You learn smoothing and sharpening by spatial filtering, edge detection, and processing in the frequency domain via the Fourier transform.
Learning Objectives
- Understand the principle of the convolution operation
- Use the various filters (mean, Gaussian, Sobel, and so on) with confidence
- Understand the principle and implementation of edge detection
- Learn the Fourier transform and processing in the frequency domain
- Understand the types of noise and the appropriate removal methods
Diagram: The Convolution Operation
Table of Contents
1. Introduction to Spatial Filtering
Fundamentals of convolution.
- What convolution is
- The kernel (filter) concept
- Border handling
- Implementation in OpenCV
2. Smoothing Filters
Noise reduction and blurring.
- Mean filter
- Gaussian filter
- Median filter
- Bilateral filter
3. Sharpening Filters
Edge enhancement.
- Laplacian filter
- Unsharp masking
- High-boost filtering
- Applications of sharpening
4. Edge Detection
Extracting contours.
- Sobel filter
- Prewitt filter
- Canny edge detection
- Applications of edge detection
5. Fourier Transform
Frequency-domain processing.
- Principles of the 2D DFT
- Frequency spectrum
- Low-pass / high-pass filters
- Band-pass filters
6. Noise Reduction
Techniques for image quality.
- Types of noise (Gaussian, S&P)
- Removal with spatial filters
- Removal with frequency filters
- Non-local means (NLM)
Diagram: Edge Detection
Diagram: The Fourier Transform
Key Theorems and Formulas
2D Convolution
The output image $g(x,y)$ is obtained as the convolution of the input image $f(x,y)$ with the kernel $h(x,y)$:
$$g(x,y) = \displaystyle\sum_{i=-k}^{k} \displaystyle\sum_{j=-k}^{k} f(x-i, y-j) \cdot h(i,j)$$
In practice, most implementations call the cross-correlation $\sum_{i,j} f(x+i, y+j)\, h(i,j)$ “convolution”; it does not flip the kernel. The two coincide for symmetric kernels (mean, Gaussian), but differ for asymmetric kernels such as Sobel. In fact, most image-processing libraries — including OpenCV’s filter2D — compute cross-correlation rather than true convolution (see Convolution vs. Correlation).
The Sobel Operator
Gradient magnitude: $|\nabla I| = \sqrt{G_x^2 + G_y^2}$; gradient direction: $\theta = \arctan(G_y / G_x)$.
The Convolution Theorem
Convolution in the spatial domain corresponds to multiplication in the frequency domain: $\mathcal{F}\{f * g\} = \mathcal{F}\{f\} \cdot \mathcal{F}\{g\}$.
Supplementary Reading
Readings that explore the "why" of filters and transforms one step at a time, with diagrams and equations.
Convolution vs. Correlation
Understand the single difference between convolution and correlation (flipping the kernel) and its consequences.
Border Handling (Padding) Methods
Understand the problem of a kernel running off the edge, and four representative padding schemes.
Integral Images and the Box Filter
Understand why an integral image can compute the sum over any rectangle in constant time.
Image Gradients and Derivative Filters
Understand how edges correspond to peaks of the first derivative and zero-crossings of the second.
DoG and LoG (Derivatives of a Gaussian)
Understand how LoG and DoG are "smoothing + second derivative" and can be used for blob detection.
Gabor Filters
Understand how a Gabor filter is a "Gaussian window × sinusoid", selective in orientation and frequency.
Reading a 2D FFT Spectrum
Learn to read what the center, the periphery, and orientation mean in a 2D FFT spectrum image.
The Sampling Theorem and Aliasing
Understand the Nyquist condition and the aliasing (folding) that occurs when it is violated.
Noise Models and Statistics
Understand the statistical properties of representative noise types and the filters suited to each.
Ringing and the Gibbs Phenomenon
Understand how ringing originates from the Gibbs phenomenon and can be suppressed with a smooth window.
Prerequisites
- The introductory-level content (pixels, color spaces, histograms)
- Foundations of linear algebra (matrix operations)
- Basic operation of Python / OpenCV