CHAPTER 5 AND 6
Digital Image Processing tutorial · PySpark.in
CHAPTER 5 – IMAGE RESTORATION & RECONSTRUCTION
(From pages 317–398)
Image Restoration = Recovering an image that has been degraded
Objective, model-based, mathematical.
Different from enhancement (which is subjective).
5.1 IMAGE DEGRADATION / RESTORATION MODEL
The degradation process is modeled as:
Spatial domain:
g ( x , y ) = h ( x , y ) ∗ f ( x , y ) + η ( x , y ) g(x,y)= h(x,y) * f(x,y) + \eta(x,y)
Where:
-
f(x,y) → Original image
-
h(x,y) → Degradation (blur) function
-
* (convolution)
-
η(x,y) → Additive noise
-
g(x,y) → Degraded image
Frequency domain:
G ( u , v ) = H ( u , v ) F ( u , v ) + N ( u , v ) G(u,v)= H(u,v)F(u,v)+N(u,v)
This is the foundation of all restoration techniques.
⭐ 5.2 NOISE MODELS
(From pp. 318–327)
Common noise types:
1. Gaussian Noise
-
Distributed normally.
-
Smooth appearance.
-
Most common in sensors.
2. Rayleigh Noise
Occurs in radar images.
3. Gamma / Erlang Noise
Occurs when many small processes add.
4. Exponential Noise
5. Salt–and–Pepper Noise
-
Random black & white dots.
-
Caused by faulty memory, bit errors.
6. Uniform Noise
⭐ 5.3 RESTORATION USING SPATIAL FILTERS
(Noise only)
1. Mean Filters
-
Arithmetic mean
-
Harmonic mean
-
Geometric mean
Smooth image but blur edges.
2. Order-Statistics Filters
-
Median filter → Very good for salt-pepper
-
Max/Min filters
-
Midpoint filter
-
Alpha-trimmed mean
⭐ 5.4 PERIODIC NOISE REMOVAL (Frequency Domain)
(From p. 340)
Periodic noise appears as sharp spikes in Fourier domain.
Use:
-
Notch reject filters
-
Bandstop filters
Steps:
-
Compute DFT
-
Identify spikes
-
Place notches
-
Apply filter
-
Compute IDFT
⭐ 5.5 LINEAR, POSITION-INVARIANT DEGRADATION
(From pp. 348–351)
If blur is uniform and linear,
g ( x , y ) = h ( x , y ) ∗ f ( x , y ) g(x,y)= h(x,y) * f(x,y)
Important: Spatial invariance → convolution → simple frequency multiplication.
⭐ 5.6 ESTIMATING THE DEGRADATION FUNCTION
(From p. 352)
Methods:
-
Observation – look at PSF
-
Experimentally – use test patterns
-
Mathematical modeling – motion blur, out-of-focus blur
-
Using inverse filtering concepts
⭐ 5.7 INVERSE FILTERING
(From p. 356)
Idea:
F ^ ( u , v ) = G ( u , v ) H ( u , v ) \hat F(u,v)= \frac{G(u,v)}{H(u,v)}
Very sensitive to noise → not used alone.
⭐ 5.8 WIENER FILTER (MMSE FILTER)
(From p. 358)
A robust alternative.
F ^ ( u , v ) = H ∗ ( u , v ) ∣ H ( u , v ) ∣ 2 + S η ( u , v ) S f ( u , v ) G ( u , v ) \hat F(u,v)= \frac{H^*(u,v)}{|H(u,v)|^2 + \frac{S_\eta(u,v)}{S_f(u,v)}}G(u,v)
Where:
-
Uses power spectra of noise and image
-
Minimizes mean square error
-
Most widely used practical restoration method.
⭐ 5.9 CONSTRAINED LEAST SQUARES FILTER
(From p. 363)
Uses Laplacian for smoothness.
F ^ ( u , v ) = H ∗ ( u , v ) ∣ H ( u , v ) ∣ 2 + γ P ( u , v ) G ( u , v ) \hat F(u,v)= \frac{H^*(u,v)}{|H(u,v)|^2+\gamma P(u,v)} G(u,v)
Where P(u,v) is Laplacian in frequency domain.
Better than inverse; slightly different than Wiener.
⭐ 5.10 GEOMETRIC MEAN FILTER
(From p. 367)
Generalizes Wiener + Inverse:
F ^ = [ H ∗ ∣ H ∣ 2 ] a [ H ∗ ∣ H ∣ 2 + S η S f ] 1 − a G \hat F= \left[\frac{H^*}{|H|^2}\right]^a \left[\frac{H^*}{|H|^2 + \frac{S_\eta}{S_f}}\right]^{1-a} G
When:
-
a=1 → inverse filter
-
a=0 → parametric Wiener
-
a=0.5 → geometric mean
⭐ 5.11 IMAGE RECONSTRUCTION FROM PROJECTIONS
(From pp. 368–398)
Important for Computed Tomography (CT).
Key steps:
-
Take multiple projections (raysums)
-
Backprojection – smear each projection
-
Filtered Backprojection (FBP)
-
Convolution with a filter
-
Removes blurring
-
Used in medical imaging widely.
⭐ CHAPTER 6 – COLOR IMAGE PROCESSING
(Pages 399–458)
Two motivations:
-
Humans perceive thousands of colors
-
Color is a powerful descriptor → segmentation, recognition
6.1 COLOR FUNDAMENTALS
(From pp. 400–404)
Visible Spectrum: 400–700 nm
-
Violet → Blue → Green → Yellow → Orange → Red
-
No sharp boundaries (smooth transitions)
Achromatic Light
-
No color (only intensity): black → gray → white
Chromatic Light
Three quantities:
-
Radiance – energy leaving source
-
Luminance – perceived brightness
-
Brightness – subjective sensation
⭐ 6.2 COLOR MODELS
(From pp. 405–420)
Popular color models:
-
RGB – hardware, monitors
-
CMY/CMYK – printing
-
HSI (Hue, Saturation, Intensity) – human perception
-
CIE XYZ, Chromaticity diagram
-
Based on color matching experiments
-
Fundamental for representing color
-
Equation:
x + y + z = 1 x+y+z=1
-
Color Gamut
Triangle inside chromaticity diagram shows all colors a device can display (Fig. 6.6).
⭐ 6.3 PSEUDOCOLOR IMAGE PROCESSING
(From p. 420)
Assigning colors to grayscale images.
Methods:
-
Intensity Slicing
-
Assign color to specific ranges.
-
-
Color Coding
-
Map grayscale value → color based on lookup table.
-
Used in: Medical imaging, astronomy, satellite imagery.
⭐ 6.4 BASICS OF FULL-COLOR IMAGE PROCESSING
(From pp. 429–430)
Two approaches:
-
Per-component processing
-
Process R, G, B separately
-
Works only if operations are independent
-
-
Vector processing
-
Treat a pixel as a 3D vector
-
Needed for:
-
Median filtering
-
Smoothing
-
Sharpening
-
Segmentation
-
-
⭐ 6.5 COLOR TRANSFORMATIONS
(From p. 430)
General model:
s i = T ( r i ) s_i = T(r_i)
Includes:
-
Contrast stretching
-
Tone correction
-
Intensity/color correction
-
Gamma correction
Used for fixing over/under-saturation, key type, etc.
⭐ 6.6 COLOR IMAGE SMOOTHING & SHARPENING
(From p. 442)
Two ways:
-
Apply filters on each channel (R, G, B)
-
Use vector filters on color voxels
⭐ 6.7 USING COLOR IN IMAGE SEGMENTATION
(color-based clustering)
Popular methods:
-
K-means in color space
-
Thresholding in HSI
-
Region growing based on chromaticity
⭐ 6.8 NOISE IN COLOR IMAGES
(From p. 452)
• Noise may be independent across channels or correlated
• Use:
-
Vector median
-
Alpha-trimmed vector filter
-
K-nearest color neighborhood
⭐ 6.9 COLOR IMAGE COMPRESSION
(From p. 455)
• RGB converted to YCbCr (JPEG standard)
• Chrominance subsampling (4:2:0) to reduce data
• Quantization + entropy coding
All tutorials · Try the free PySpark compiler · Practice challenges