Image ProcessingUnit 414 min read
Image Restoration & Filtering: Noise Removal, Deconvolution & Frequency-Domain Techniques
Unit 4 of Image Processing covers the mathematical foundations and practical techniques for reversing image degradation (restoration) and applying spatial/frequency-domain filters to improve image quality—essential for medical imaging, satellite photos, and real-world apps like eSewa’s ID verification or Ncell’s photo-
TAKEAWAYS:
- Image restoration reverses known degradation (blur, noise) using inverse models, while enhancement improves subjective quality without modeling the degradation process.
- Wiener filtering balances noise suppression and detail preservation by estimating the degradation function and noise statistics.
- Low-pass filters (e.g., Butterworth) smooth images by attenuating high frequencies, but can blur edges; high-pass filters sharpen edges by amplifying high frequencies.
- Frequency-domain filtering (via FFT) lets you design filters in the Fourier space for tasks like removing periodic noise or enhancing textures.
- Deconvolution (e.g., inverse filtering, constrained least squares) recovers the original image from a blurred version, but is sensitive to noise.
- Real-world tradeoffs: Restoration requires knowing the degradation model; enhancement does not, but may introduce artifacts.
1. Image Degradation and Restoration: The Core Problem
What is Image Restoration?
Key Degradation Models:
- Noise: Random variations in pixel values (e.g., Gaussian noise, salt-and-pepper noise).
- Blur: Loss of sharpness due to motion, defocus, or atmospheric turbulence.
- Geometric Distortions: Warping or misalignment (e.g., lens distortion).
Mathematical Model: The observed image is related to the original by: where:
- : Degradation function (e.g., blur kernel).
- : Noise (additive or multiplicative).
Goal: Estimate from , , and .
Visual: Degradation Pipeline
flowchart LR
A["Original Image \( f(x,y) \)"] -->|"Degradation Function H "| B["Degraded Image \( g(x,y) \)"]
B -->|"Noise n(x,y) "| C["Observed Image (Corrupted)"]
C -->|"Restoration Algorithm"| D["Restored Image \( \hat{f}(x,y) \)"]Worked Example: Motion Blur Restoration
Suppose an image is blurred by a horizontal motion kernel : and the observed image is: Step 1: Assume the original image is constant (for simplicity). The blur equation becomes: Step 2: Solve for . For the center pixel : If is constant (): Step 3: The restored image is (a flat image). In reality, is not constant, so we need deconvolution.
2. Restoration Techniques
A. Inverse Filtering
Idea: Multiply the Fourier transform of by the inverse of to recover : Problem: Amplifies high-frequency noise where is small.
Worked Example: Given (Gaussian blur), and is the Fourier transform of , compute : Visual: Plot and to see noise amplification.
graph TD
A["\( G(u,v) \)"] -->|"Divide by H(u,v) "| B["\( \hat{F}(u,v) \)"]
B -->|"IFFT"| C["Restored Image \( \hat{f} \)"]B. Wiener Filtering
Idea: A statistical approach that minimizes the mean square error between and . It uses:
- : Degradation function in Fourier space.
- : Noise power spectrum (assumed constant).
- : Power spectrum of the original image.
Wiener Filter Formula: where is the complex conjugate of .
Advantages:
- Reduces noise amplification.
- Works well when and are known.
Disadvantages:
- Requires prior knowledge of (often estimated).
- Computationally intensive.
C. Constrained Least Squares (Regularized Inverse Filtering)
Idea: Add a regularization term to stabilize inverse filtering: where controls the tradeoff between noise suppression and detail preservation.
Worked Example: For , compute for the Gaussian blur example above. Compare with inverse filtering.
D. Deconvolution via Iterative Methods
Idea: Solve the linear system iteratively (e.g., Landweber iteration): where is a step size.
Advantages:
- Works for large blur kernels.
- Can incorporate constraints (e.g., non-negativity of pixel values).
Disadvantages:
- Slow convergence.
- Requires tuning .
3. Frequency-Domain Filtering
Why Fourier Domain?
- Separation of frequencies: Low frequencies = smooth regions; high frequencies = edges/textures.
- Efficient computation: FFT reduces filtering time from to .
Key Filters
| Filter Type | Frequency Response | Effect on Image | Use Case |
|---|---|---|---|
| Ideal Low-Pass | → 1; else 0 | Removes high frequencies (blur) | Noise reduction |
| Butterworth LP | Smoother transition than ideal LP | Medical imaging (reducing noise) | |
| Gaussian LP | Gradual falloff | Blur reduction | |
| Ideal High-Pass | → 1; else 0 | Enhances edges (sharpening) | Edge detection |
| High-Boost | Amplifies high frequencies | Sharpening old photos |
Visual: Frequency Responses
graph TD
A["Low-Pass Filter"] -->|"Attenuates high D(u,v) "| B["Smooth Image"]
C["High-Pass Filter"] -->|"Attenuates low D(u,v) "| D["Edge-Enhanced Image"]
Circular passband in Fourier space. (Image: Public domain, via Wikimedia Commons)
Worked Example: Butterworth Low-Pass Filter
Given:
- Cutoff frequency (for a 256×256 image).
- Order .
Compute the filter for : Interpretation: The frequency at is attenuated by 50% (3 dB reduction).
4. Spatial-Domain Filtering
Linear Filters (Convolution)
Idea: Apply a kernel to to produce :
Common Kernels:
| Filter | Kernel (3×3) | Effect |
|---|---|---|
| Mean (Box) | Blurs image (low-pass) | |
| Gaussian | Smooths with edge preservation | |
| Laplacian | Edge detection (high-pass) | |
| Prewitt (Edge) | Horizontal edge detection |
Worked Example: Noise Removal with Mean Filter Given a noisy image: Apply the mean filter to the center pixel :
Nonlinear Filters
Idea: Replace pixel values based on statistical properties of the neighborhood (e.g., median).
Median Filter:
- Replaces with the median of its neighbors.
- Effective against salt-and-pepper noise.
Worked Example: For the same above, the median of the 9 pixels is 51 (same as mean here, but differs for impulse noise).
5. Real-World Applications
In Nepal
eSewa’s ID Verification:
- Problem: Scanned ID photos often suffer from blur (motion) and noise (low-light scanning).
- Solution: Wiener filtering to restore sharpness while reducing noise before OCR (text extraction).
- Example: A blurred NID card image is restored using a known blur kernel (e.g., Gaussian) and estimated noise variance.
Ncell’s Photo-Based Services:
- Problem: Customer-uploaded photos (e.g., for SIM registration) may have low contrast or camera shake blur.
- Solution: Adaptive high-pass filtering to enhance edges (e.g., face contours) before facial recognition.
NTC’s Traffic Monitoring:
- Problem: CCTV footage of traffic signals is often noisy (poor lighting) or motion-blurred (vehicles).
- Solution: Constrained least-squares deconvolution to recover license plates for automated toll systems.
Global Examples
Google Photos’ "Magic Eraser":
- Uses morphological operations + frequency-domain filtering to remove objects (e.g., power lines) from photos.
- Key Idea: Combines low-pass filtering (to smooth the background) with edge-preserving techniques.
WhatsApp’s Sticker Maker:
- Applies Gaussian blur + adaptive thresholding to create smooth, cartoon-like stickers from photos.
- Key Idea: Spatial-domain filtering to reduce texture while preserving outlines.
Medical Imaging (e.g., MRI Scans):
- Problem: MRI images suffer from Gaussian noise and motion artifacts.
- Solution: Wiener filtering to restore diagnostic features (e.g., tumors) while suppressing noise.
6. Comparison: Restoration vs. Enhancement
| Aspect | Image Restoration | Image Enhancement |
|---|---|---|
| Goal | Recover original image from known degradation | Improve subjective quality (no degradation model) |
| Requirements | Needs and | No prior knowledge needed |
| Methods | Inverse filtering, Wiener, deconvolution | Histogram equalization, unsharp masking |
| Output | (enhanced degraded image) | |
| Example | Restoring a blurred satellite photo | Increasing contrast in a dark photo |
7. Exam Tips
Define Key Terms Precisely:
- Ideal Low-Pass Filter: A filter with a rectangular frequency response (passes frequencies , blocks others).
- Wiener Filter: A statistical filter that minimizes MSE by incorporating noise and signal power spectra.
- Deconvolution: The process of removing blur by inverting the degradation function .
Mathematical Formulas:
- Memorize the Wiener filter formula and inverse filtering formula in Fourier space.
- Know the Butterworth filter equation and how its order affects the transition band.
Practical Scenarios:
- When to use Wiener vs. Inverse Filtering:
- Use Wiener if noise is significant and is unknown.
- Use Inverse if is known and noise is negligible.
- Real-World Tradeoffs:
- Restoration requires more computation but gives better results if is accurate.
- Enhancement is faster but may distort features.
- When to use Wiener vs. Inverse Filtering:
Diagrams:
- Draw the block diagram of a restoration system (input , , noise model, filter, output ).
- Sketch frequency responses of low-pass/high-pass filters and label .
Common Pitfalls:
- Assuming is known: Restoration fails without the degradation model.
- Ignoring noise: Inverse filtering amplifies noise; Wiener filtering mitigates this.
- Over-filtering: High-pass filters can introduce ringing artifacts; low-pass filters can over-blur.
Worked Example Patterns:
- For Wiener filtering, always show:
- The Fourier transform of and .
- The power spectra and .
- The filtered result in both domains.
- For spatial filtering, show:
- The kernel applied.
- The convolution operation on a small patch.
- The resulting pixel value.
- For Wiener filtering, always show:
8. Summary Table of Key Techniques
| Technique | Domain | Key Idea | When to Use |
|---|---|---|---|
| Inverse Filtering | Frequency | Known , low noise | |
| Wiener Filtering | Frequency | Minimizes MSE with noise constraints | Unknown , noisy images |
| Constrained LS | Frequency | Regularized inverse filtering | Large blur kernels |
| Mean Filter | Spatial | Averages neighbors | Gaussian noise reduction |
| Median Filter | Spatial | Replaces with median | Salt-and-pepper noise |
| Butterworth LP | Frequency | Smooth frequency cutoff | Medical imaging |
| Laplacian Filter | Spatial | Highlights edges (second derivative) | Edge detection |
Based on the TU BCA syllabus for Image Processing, unit 4.
Discussion
Loading…