Image ProcessingUnit 411 min read
Frequency Domain Enhancement: Filters, Transforms & Real-World Apps
Unit 4 of Image Processing covers frequency-domain techniques for image enhancement, including Fourier transforms, low/high-pass filtering, and histogram equalization in frequency space—explaining how they work, their mathematical foundations, and practical applications in medical imaging, satellite data, and digital p
TAKEAWAYS:
- Frequency domain separates an image into sine/cosine components (frequencies) for targeted enhancement, unlike spatial-domain methods that operate directly on pixels.
- Low-pass filters smooth images by attenuating high frequencies (e.g., blurring noise), while high-pass filters sharpen edges by amplifying high frequencies.
- Fourier Transform (FT) converts spatial-domain images to frequency-domain spectra, enabling frequency-specific operations (e.g., removing periodic noise).
- Ideal vs. Butterworth filters trade off sharpness and ripple effects: Butterworth filters are smoother but less aggressive in frequency cutoff.
- Homomorphic filtering combines low/high-pass filters to simultaneously enhance illumination and detail in images (e.g., medical X-rays).
- Real-world impact: From Khalti’s OCR (cleaning scanned receipts) to NTC’s traffic cameras (reducing blur in license plate recognition), frequency-domain techniques are invisible but critical in modern systems.
1. Why Frequency Domain? Spatial vs. Frequency Domains
- Spatial domain: Direct pixel manipulation (e.g., contrast stretching, convolution).
- Frequency domain: Representing images as combinations of sine/cosine waves (frequencies), enabling selective enhancement.
graph LR A["Spatial Domain"] -->|"Direct pixel operations"| B["Contrast Stretching, Convolution"] C["Frequency Domain"] -->|"Frequency-based operations"| D["Fourier Transform, Filtering"] A -->|"2D DFT"| C C -->|"Inverse 2D DFT"| A
Key Idea:
- Low frequencies = smooth regions (e.g., sky in a photo).
- High frequencies = edges/textures (e.g., tree branches).
- Frequency-domain filters let you amplify/dampen specific frequencies without affecting others.
2. The Fourier Transform: From Pixels to Frequencies
The 2D Discrete Fourier Transform (DFT) converts an image into its frequency spectrum :
- Magnitude spectrum shows energy at each frequency.
- Phase spectrum preserves spatial structure.
Worked Example: 2D DFT of a Simple Image
Given: A image (zero-padded to for DFT):
1 1 1 0
1 1 1 0
1 1 1 0
0 0 0 0
Steps:
- Compute for each .
- For (DC component):
- For : (Result: All non-DC terms cancel out due to symmetry.)
Visualization: Interpretation:
- The DC component (9) dominates—this image is mostly uniform.
- High frequencies (edges) are absent, so the spectrum is sparse.
3. Frequency-Domain Filters
Filters modify the Fourier spectrum to enhance specific features.
A. Low-Pass Filters (Smoothing)
- Goal: Remove high-frequency noise (e.g., salt-and-pepper noise).
- Ideal Low-Pass Filter (ILPF): where is the distance from the origin.
Problem: Sharp cutoff causes ringing artifacts (Gibbs phenomenon). Solution: Butterworth Filter (smoother transition):
- : Order (higher = smoother cutoff).
Worked Example: Butterworth Filter on Noisy Image Given: A image with salt-and-pepper noise:
50 52 50 50
50 255 50 50
50 50 50 50
50 50 50 50
Steps:
- Compute DFT .
- Apply Butterworth filter with , :
- For , .
- For , tapers to 0.
- Inverse DFT to get smoothed image.
Before/After:
B. High-Pass Filters (Sharpening)
- Goal: Enhance edges/textures by amplifying high frequencies.
- Ideal High-Pass Filter (IHPF):
- Laplacian Filter in Frequency Domain: Equivalent to subtracting a smoothed version of the image.
Worked Example: High-Pass Filtering for Edge Enhancement Given: A blurred image:
100 102 100 100
100 100 100 100
100 100 100 100
100 100 100 100
Steps:
- Compute DFT.
- Apply IHPF with .
- Inverse DFT to get edge-enhanced image.
Result: (Note: The output is near-zero except at the edge pixel (102), showing edge enhancement.)
C. Band-Pass Filters
- Goal: Isolate specific frequency bands (e.g., removing periodic noise).
- Example: Remove power-line interference (50/60 Hz) from medical images.
4. Homomorphic Filtering: Enhancing Illumination and Reflectance
Problem: Images often have uneven illumination (e.g., shadows in X-rays). Solution: Separate the image into:
- Illumination component (low frequencies).
- Reflectance component (high frequencies).
Homomorphic Filter:
- : Low-frequency gain (boost illumination).
- : High-frequency gain (enhance detail).
- : Controls the transition sharpness.
Worked Example: Homomorphic Filtering on a Medical X-Ray Given: An X-ray with uneven lighting:
Steps:
- Compute DFT.
- Apply homomorphic filter with:
- (reduce illumination).
- (enhance edges).
- , .
- Inverse DFT to get balanced image.
Before/After:
5. Practical Applications in Nepal and Globally
## In the Real World
Khalti’s OCR System:
- Problem: Scanned receipts often have noise or low contrast.
- Solution: Frequency-domain filtering (low-pass to smooth, high-pass to sharpen text) before OCR.
- Example: A receipt with handwritten notes is processed to extract clean text for transaction verification.
NTC’s Traffic Camera Surveillance:
- Problem: License plates are blurred due to motion or low light.
- Solution: Homomorphic filtering to enhance plate edges while reducing glare from headlights.
- Example: A car’s plate at night:
Nepal Rastra Bank’s Currency Validation:
- Problem: Counterfeit notes may have subtle frequency artifacts.
- Solution: Band-pass filters to detect missing high-frequency details (e.g., microprinting).
- Example: A NPR note’s security thread is analyzed in the frequency domain to verify authenticity.
Google Photos’ "Enhance" Feature:
- Problem: Photos taken in low light or with camera shake appear noisy.
- Solution: Adaptive Butterworth filtering to reduce noise while preserving edges.
- Example: A blurry selfie becomes sharp without losing detail.
Pathao’s Driver App:
- Problem: GPS coordinates may have high-frequency jitter.
- Solution: Low-pass filtering to smooth driver location data for accurate route tracking.
6. Comparison Table: Frequency-Domain Techniques
| Technique | Purpose | Filter Type | Advantages | Disadvantages | Example Use Case |
|---|---|---|---|---|---|
| Low-Pass Filtering | Noise reduction, blurring | Butterworth, Gaussian | Preserves edges, smooths noise | May blur fine details | Medical imaging (removing artifacts) |
| High-Pass Filtering | Edge enhancement, sharpening | Laplacian, IHPF | Enhances textures/edges | Amplifies noise | Satellite image analysis |
| Band-Pass Filtering | Isolating specific frequencies | Custom bands | Targets periodic noise | Complex design for specific bands | Power-line interference removal |
| Homomorphic Filtering | Illumination correction | Combined low/high-pass | Balances lighting and detail | Computationally intensive | X-ray/endoscopy images |
7. Step-by-Step: Frequency-Domain Enhancement Pipeline
flowchart LR
A["Input Image"] --> B[Compute 2D DFT
(F("u,v") = DFT{"f(x,y)"})]
B --> C[Design Filter
(e.g., Butterworth, Ideal High-Pass)]
C --> D[Apply Filter
(H("u,v") * F("u,v"))]
D --> E["Inverse 2D DFT"]
E --> F["Enhanced Image"]Worked Example: End-to-End Filtering Given: A image with noise:
50 55 50 50
50 255 50 50
50 50 50 50
50 50 50 50
Task: Remove the noise pixel (255) using a Butterworth low-pass filter (, ).
Steps:
- DFT: Compute for all . The noisy pixel contributes high-frequency components.
- Filter Design:
- For : .
- For : .
- Filter Application: Multiply by . High frequencies (noise) are attenuated.
- Inverse DFT: Reconstruct the image. The 255 pixel is reduced to ~50.
Result:
8. Common Pitfalls and Exam Tips
## Exam Tip
DFT vs. FFT:
- Always mention that FFT (Fast Fourier Transform) is used for efficient computation in practice, but exams may ask for the DFT formula.
- Example: "The DFT converts spatial pixels to frequency coefficients, while FFT computes it in time."
Filter Design:
- Butterworth is preferred over ideal filters because it avoids ringing artifacts.
- Memorize the Butterworth formula and its parameters (, ).
Homomorphic Filtering:
- This is a high-scoring topic. Explain it as combining low-pass (illumination) and high-pass (detail) filters.
- Example: "Homomorphic filtering is used in medical imaging to separate shadows from actual structures."
Numerical Problems:
- For DFT calculations, zero-pad small images to simplify computation (e.g., → ).
- Example: "Given a image, pad it to before computing DFT."
Real-World Applications:
- Link theory to Nepali contexts (e.g., "NTC uses frequency-domain filtering to enhance CCTV footage").
- Example: "A Daraz delivery photo with motion blur can be sharpened using high-pass filtering."
Common Mistakes:
- Forgetting inverse DFT: Always reconstruct the image after filtering.
- Incorrect filter application: Multiply the filter with the spectrum , not the original image.
- Units: Ensure is in the same units as (usually normalized to image dimensions).
9. Summary Checklist
Before the exam, ensure you can:
- Define DFT and explain its role in frequency-domain processing.
- Derive a simple 2D DFT for a small image (e.g., ).
- Design Butterworth and ideal filters and explain their differences.
- Apply homomorphic filtering to a given image (describe steps).
- List two real-world applications of frequency-domain techniques in Nepal.
- Solve a numerical problem involving DFT and filtering (e.g., noise removal).
Based on the TU BSc CSIT syllabus for Image Processing (CSC332), unit 4.
Discussion
Loading…