Image ProcessingUnit 911 min read
Transform Techniques & Frequency Domain Analysis
Unit 9 of Image Processing: Explores mathematical transforms (Fourier, Hadamard, wavelet), frequency domain analysis, and their applications in filtering, compression, and pattern recognition—with step-by-step derivations and real-world examples like audio compression and medical imaging.
TAKEAWAYS:
- Frequency domain reveals image patterns (edges, textures) as sinusoidal components, enabling selective filtering (e.g., noise removal).
- Discrete Fourier Transform (DFT) converts spatial-domain pixels into frequency-domain coefficients, where high frequencies = sharp changes (edges).
- Fast Fourier Transform (FFT) accelerates DFT computation from O(N²) to O(N log N), critical for real-time processing (e.g., video streaming).
- Wavelet transforms localize frequency information in time/space, ideal for multi-scale analysis (e.g., seismic data, speech signals).
- Hadamard transform offers faster computation than DFT for specific applications like image compression.
- Hough transform detects geometric shapes (lines, circles) by transforming edge points into parameter space.
1. Spatial vs. Frequency Domain
- Spatial domain: Pixels and their intensities (e.g., a grayscale image as a matrix).
- Frequency domain: Image decomposed into sine/cosine waves (frequencies).
Why switch domains?
- Filtering: Remove noise (high frequencies) or enhance edges (mid frequencies).
- Compression: Discard high-frequency components (e.g., JPEG).
- Pattern recognition: Detect periodic structures (e.g., textures, repeating patterns).
2. Discrete Fourier Transform (DFT)
The DFT converts a finite sequence of equally-spaced samples into components of different frequencies.
1D DFT Formula
For a signal of length :
- : Frequency-domain coefficient for frequency .
- : Complex exponential (rotating vector in the complex plane).
2D DFT (for Images)
For an image :
Visualization of 2D DFT Consider a 2×2 image (simplified for clarity):
1 1
1 1
Its 2D DFT (computed via formula) yields:
- Interpretation: Only the DC component (constant frequency) is non-zero; no high-frequency edges.
3. Fast Fourier Transform (FFT)
The FFT algorithm reduces DFT computation from O(N²) to O(N log N), enabling real-time processing.
Key Properties of FFT
| Property | Description |
|---|---|
| Linearity | DFT of |
| Circular Convolution | Multiplication in frequency domain = circular convolution in spatial domain |
| Parseval’s Theorem | Energy in spatial domain = energy in frequency domain: |
Example: FFT of a 4-point sequence Given , compute its DFT using FFT steps:
- Divide into even/odd:
- Even:
- Odd:
- Recursively compute DFTs of even/odd sequences.
- Combine results using twiddle factors .
Output:
4. Hadamard Transform
A binary transform (uses ±1 instead of complex exponentials) with faster computation than DFT for certain applications.
Hadamard Matrix
For :
Hadamard Transform of
Multiply input by and normalize:
Advantages:
- No complex arithmetic (faster for some hardware).
- Used in image compression (e.g., Hadamard coding).
Disadvantages:
- Less accurate for smooth signals compared to DFT.
5. Wavelet Transform
Unlike Fourier, wavelets provide time-frequency localization, useful for multi-scale analysis.
Wavelet Decomposition
A signal is decomposed into:
- Approximation coefficients (low-frequency, smoothed version).
- Detail coefficients (high-frequency, edges/transients).
Example: Haar Wavelet For :
- First level:
- Approximation: (average of pairs).
- Detail: (differences).
- Second level:
- Approximation: .
- Detail: .
Applications:
- Medical imaging: Localize tumors in MRI scans.
- Speech processing: Isolate phonemes in audio.
6. Hough Transform
Detects geometric shapes (lines, circles) by transforming edge points into parameter space.
Line Detection
For an edge point , the line equation is:
- Hough space: Accumulate votes for pairs where the edge lies on the line.
Example: Collinearity Check Given points :
- For , compute for all .
- Repeat for other points; check if any has 3 votes.
Result: All points lie on the line .
7. Frequency Domain Filtering
Filters operate in the frequency domain to modify image properties.
Types of Filters
| Filter Type | Effect | Example Use Case |
|---|---|---|
| Low-pass | Smooths image (removes high frequencies) | Noise reduction |
| High-pass | Enhances edges (removes low frequencies) | Edge detection |
| Band-pass | Preserves mid frequencies (e.g., textures) | Sharpening |
| Laplacian | Highlights zero-crossings (edges) | Edge detection (spatial domain) |
Example: Laplacian Filter in Frequency Domain The Laplacian kernel in spatial domain: In frequency domain, it corresponds to:
- Effect: Amplifies high frequencies (edges).
In the Real World
eSewa/Khalti (Payment Apps)
- Idea: Wavelet transforms compress transaction logs to detect fraud patterns (e.g., sudden spikes in payments).
- How: Wavelets isolate anomalies in time-series data (e.g., a sudden 100x increase in transactions at 3 AM).
NEPSE (Stock Market)
- Idea: Fourier analysis smooths stock price data to remove noise and identify trends.
- How: Low-pass filtering in the frequency domain removes high-frequency volatility, revealing long-term patterns.
Pathao (Ride-Hailing)
- Idea: Hough transform detects traffic bottlenecks by analyzing GPS data points.
- How: Edge points (stagnant vehicles) are transformed into lines representing traffic jams.
Worked Example: Daraz Order Queue
- Scenario: Daraz’s warehouse uses FFT-based pattern recognition to predict order peaks.
- Steps:
- Collect hourly order counts as a time-series signal.
- Apply FFT to decompose into frequency components.
- Identify dominant frequencies (e.g., daily peak at 10 AM).
- Allocate staff dynamically to reduce delays.
8. Comparison Table: Transform Techniques
| Transform | Basis Functions | Speed | Localization | Key Use Case |
|---|---|---|---|---|
| DFT | Complex exponentials | Slow | No | General frequency analysis |
| FFT | Complex exponentials | Fast (O(N log N)) | No | Real-time processing |
| Hadamard | ±1 (binary) | Very fast | No | Image compression |
| Wavelet | Wavelets (localized) | Moderate | Yes | Multi-scale analysis |
| Hough | Geometric parameters | Moderate | Yes | Shape detection |
Exam Tip
DFT vs. FFT:
- Always mention that FFT is an algorithm to compute DFT efficiently.
- For 2D DFT, show the double-sum formula and emphasize symmetry (real images have conjugate symmetry).
Frequency Domain Filtering:
- Link high-pass/low-pass filters to real-world examples (e.g., "A high-pass filter in medical imaging enhances bone edges").
- For Laplacian, state it’s a second derivative in spatial domain → high-frequency emphasis in frequency domain.
Wavelet Transform:
- Highlight its multi-resolution property: "Wavelets decompose an image into scales (e.g., coarse to fine details)."
- Compare with Fourier: "Fourier tells you what frequencies are present; wavelets tell you where."
Hough Transform:
- For collinearity, show the parameter space (r-θ plane) and explain how peaks indicate lines.
- Mention circular Hough transform for detecting circles (if time permits).
Hadamard Transform:
- Emphasize its binary nature: "No complex arithmetic → faster for some hardware."
- Relate to compression: "Used in lossless coding (e.g., image files)."
Numerical Problems:
- For DFT/FFT computations, show all steps (even if simplified). Use small matrices (2×2 or 4×4) to avoid errors.
- For histogram equalization in frequency domain, assume the question implies contrast stretching via FFT-based filtering.
Final Visual Recap
Based on the TU BSc CSIT syllabus for Image Processing (CSC332), unit 9.
Discussion
Loading…