This guide is derived from the earlier outline (edition not confirmed) for CACS404 (Image Processing). All units and topics follow the outlined sequence; wording and examples are original student study material, not official TU text.

How to use this guide

Image processing is tested through algorithm implementation, transformation understanding, and application scenarios. The exam rewards knowledge of enhancement techniques, filtering, compression, and segmentation methods. Practice implementing common algorithms (edge detection, filtering, histogram equalization) and understanding when to use each technique. Marks are awarded for correct algorithm description, stating assumptions, and explaining trade-offs between different approaches.

Learning Outcomes

By the end of this course, a student should be able to:

  1. Explain the fundamental concepts of digital image representation and basic pixel relationships.
  2. Implement and compare image enhancement techniques including spatial and frequency domain filtering.
  3. Describe image restoration methods including inverse and Wiener filtering.
  4. Design and implement image compression using various coding and standards.
  5. Develop image segmentation algorithms and feature extraction techniques for real-world applications.

Unit 1: Fundamental of Image processing

Teaching hours: 8

Topics in outline order

  1. Image representation
  2. Basic relationship between pixels
  3. Elements of DIP system
  4. Elements of visual perception-simple image formation model
  5. Sampling and Quantization
  6. Color fundamentals and models
  7. File Formats
  8. Image operations. Brightness
  9. contrast
  10. hue
  11. saturation
  12. Mach band effect

Explanation

  1. Image representation. A digital image is represented as a two-dimensional array of pixels (picture elements), where each pixel holds a numeric value representing intensity (grayscale) or color (RGB or other color models). Grayscale image: each pixel is an integer value typically in the range 0-255, where 0 represents black (minimum intensity) and 255 represents white (maximum intensity). Color image: each pixel has multiple channel values; the most common is RGB (Red, Green, Blue), where each channel is typically 0-255, allowing 2²⁴ ≈ 16.7 million colors. Other color models include Grayscale (single channel), HSV (Hue, Saturation, Value - useful for color-based segmentation), YCbCr (luminance and chrominance components, used in JPEG compression), and CMYK (Cyan, Magenta, Yellow, Key/Black - used in printing). Image dimensions: an M×N image has M rows and N columns of pixels; the total number of pixels is M×N. Pixel grid: pixels are arranged in a rectangular grid; each pixel at position (i, j) has neighbors at (i-1, j), (i+1, j), (i, j-1), (i, j+1) (assuming they exist within the image boundaries). Image types: binary (1 bit per pixel, black and white), grayscale (8 bits per pixel, 256 levels), and color (24-bit or 32-bit with alpha channel).

  2. Basic relationship between pixels. Adjacent pixels: pixels next to each other horizontally, vertically, or diagonally. 4-neighbors: the pixels directly above, below, left, and right of a given pixel (forming a cross shape). 8-neighbors: the 4-neighbors plus the four diagonal pixels (forming a plus-with-diagonals shape). Distance metrics: D4 distance (4-neighbor distance, count of steps in 4-neighbor grid), D8 distance (8-neighbor distance, shorter path but allows diagonal steps), and city-block distance (Manhattan distance, sum of absolute differences of coordinates). Connectivity: two pixels are 4-connected if they are 4-neighbors, 8-connected if they are 8-neighbors, and m-connected (mixed) combines both. Region: a set of pixels that are connected (4- or 8-connected) and share a common property (intensity, color, label). Labeling: assigning a unique label to each connected region for identification and analysis.

  3. Elements of DIP system. The field of Digital Image Processing (DIP) involves: image acquisition (capturing images via cameras, scanners, or other sensors), image enhancement (improving visual quality), image restoration (recovering the original image from a degraded version using a degradation model), image compression (reducing storage size while preserving quality), image segmentation (partitioning an image into meaningful regions), and representation and description (choosing appropriate features to describe measured objects). Key components of a DIP system: input device (camera, scanner, satellite sensor), processing computer (with sufficient CPU, RAM, and specialized hardware like GPUs), software (image processing libraries and algorithms, e.g., OpenCV, MATLAB Image Processing Toolbox), output device (monitor, printer, display), and human (the operator/analyst). Image file formats: BMP (Windows bitmap, uncompressed), TIFF (Tagged Image File Format, flexible, supports compression and layers), JPEG (Joint Photographic Experts Group, lossy compression for photographs), PNG (Portable Network Graphics, lossless compression, web-friendly), GIF (Graphics Interchange Format, limited 256 colors, supports animation), PPM/PGM/PBM (NetPBM formats, raw/ASCII formats for research), and EXR (OpenEXR, high dynamic range for visual effects).

  4. Elements of visual perception-simple image formation model. The human visual system perceives images through: light detection by photoreceptors (rods and cones) in the retina, neural processing in the retina and visual cortex, and perceptual interpretation by the brain. Simple image formation model: light from the scene enters the eye through the cornea and lens, forming an inverted image on the retina; the iris controls the amount of light through the pupil; the lens focuses light onto the retina (accommodation for different distances); photoreceptors (rods for low-light vision, cones for color vision and detail) convert light into electrical signals; optic nerve transmits signals to the brain; and the visual cortex interprets the signals into a perceived image. Perceptual phenomena: Mach band effect (enhanced contrast at edges, perceived brighter/darker than actual), simultaneous contrast (a gray appears different depending on surrounding colors), and color constancy (objects appear consistent color under varying lighting). Image formation in digital cameras: light passes through the lens and aperture, hits the image sensor (CCD or CMOS), each pixel records intensity, and an AA filter (anti-aliasing) prevents moiré patterns. Image metadata includes EXIF data (camera settings, date, time, GPS location).

  5. Sampling and Quantization. Sampling is the process of converting a continuous-domain image to discrete-domain by taking samples at regular intervals. Sampling rate: the number of samples per unit distance; must satisfy the Nyquist criterion (sampling rate ≥ 2× highest frequency in the image to avoid aliasing). Aliasing appears as moiré patterns or jagged edges when the sampling rate is too low. Quantization is the process of mapping continuous amplitude values to discrete levels. Quantization levels: for an 8-bit image, 2⁸ = 256 possible intensity values (0-255). Quantization error (difference between original continuous value and quantized discrete value) contributes to noise; dithering (adding random noise) can reduce visual quantization artifacts. Bit depth: the number of bits per pixel; 1-bit (binary), 8-bit (grayscale/256 levels), 16-bit (65,536 levels, medical/radar), 24-bit (16.7M colors), and 32-bit (including alpha channel). Relationship: bit depth = log₂(number of quantization levels).

  6. Color fundamentals and models. Additive color models: RGB (Red, Green, Blue) combines light to create colors; additive mixing (RGB + RGB → white); used in displays, monitors, and digital cameras. Subtractive color models: CMY (Cyan, Magenta, Yellow) subtracts light (absorbs wavelengths), used in printing; CMYK adds Key/Black to improve dark tones and reduce ink usage. HSV model: Hue (color type, 0-360° on color wheel), Saturation (color purity/intensity, 0% = gray, 100% = full color), Value (brightness, 0% = black, 100% = full intensity). HSL model: Hue, Saturation, Lightness (50% = middle gray). XYZ color space: CIE-standard reference space representing all perceivable colors; basis for other models. Lab color space: L* (lightness), a* (green-red axis), b* (blue-yellow axis) - perceptually uniform, used in color measurement and management. Color transformation: conversion between models (RGB ↔ HSV, RGB ↔ CMYK) using mathematical formulas. Example: H = atan2(√3 × (G - B), 2 × R - G - B) (Hue calculation from RGB).

  7. File Formats. BMP (Bitmap): Windows format, uncompressed, large file size, simple structure (header, info, color table, pixel data). TIFF (Tagged Image File Format): flexible, supports lossless compression (LZW, ZIP), layers, transparency, and multiple images in one file; widely used in printing and publishing. JPEG (Joint Photographic Experts Group): lossy compression, adjustable quality (1-100), good for photographs, supports EXIF metadata, does not support transparency, and suffers from generation loss (degradation on repeated save/edit). PNG (Portable Network Graphics): lossless compression, better compression than GIF, supports transparency (alpha channel), web-friendly, and patent-free. GIF (Graphics Interchange Format): limited to 256 colors, supports animation and simple transparency, commonly used for web icons and simple animations. WebP: modern format by Google, both lossy and lossless compression, smaller file sizes than JPEG/PNG for same quality, and animation support. HEIC/HEIF: high efficiency format (used in iOS), better compression than JPEG, but limited software support outside Apple ecosystem. DICOM: medical imaging format, includes patient data and image metadata, supports lossy and lossless compression.

  8. Image operations. Brightness. Brightness adjustment modifies the overall lightness of an image. Adding a constant: new_pixel = old_pixel + value (clamp to 0-255 range); positive value brightens, negative value darkens. Multiplicative adjustment: new_pixel = old_pixel × factor (factor > 1 brightens, 0 < factor < 1 darkens); preserves relative contrasts better than additive. Linear brightness transformation: s = c × r + d where r is input pixel value, s is output, c and d are constants; c > 0 controls contrast-like effect, d controls brightness shift. Example: brightening a dark photo by adding 30 to each pixel value (with clamping at 255). Global vs. local: global adjustment applies same value to all pixels; local/adaptive adjustment varies the value based on local pixel statistics (e.g., darken only dark regions).

  9. contrast. Contrast enhancement expands the range of pixel intensity values. Linear stretching: s = (l - h) × (r - h) / (l - h) + h where r is input, s is output, h is minimum intensity, l is maximum intensity; stretches the full range to 0-255. Histogram equalization: redistributes pixel intensities so the histogram is approximately uniform; improves contrast for images with narrow intensity range; computed using cumulative distribution function (CDF) of the histogram. Adaptive histogram equalization (CLAHE): divides image into tiles, equalizes each separately, and blends boundaries; avoids over-enhancement at tile edges. Non-linear transformation: power law (gamma) correction: s = c × r^γ; γ < 1 brightens dark regions, γ > 1 darkens bright regions; used to correct monitor gamma. Example: applying histogram equalization to a low-contrast ultrasound image to improve feature visibility.

  10. hue. Hue is the attribute of a color that describes its family (red, blue, green, etc.), expressed as a degree on the color wheel (0°/360° = red, 120° = green, 240° = blue). Hue manipulation in the HSV/HSL color model: convert RGB to HSV, modify the H channel (e.g., H = (H + ΔH) mod 360 for hue shift), and convert back to RGB. Hue rotation: used for color correction, artistic effects, and distinguishing classes in image segmentation. Example: shifting all colors by 30° to create a "warm" or "cool" tone. Challenges: hue wrap-around at 0°/360°, preserving saturation and luminosity during hue changes, and avoiding unnatural colors.

  11. saturation. Saturation describes the purity or intensity of a color; fully saturated colors are vivid, while desaturated colors appear grayish. Saturation adjustment in HSV/HSL: convert to the color model, modify the S channel (S = min(255, S × factor) or S = max(0, S × factor)), and convert back. Desaturation: setting S = 0 produces a grayscale image. Oversaturation: S > 255 is clamped; extreme saturation can produce unnatural colors. Example: increasing saturation for a muted landscape photo, or desaturating a color image for a artistic black-and-white effect.

  12. Mach band effect. The Mach band effect is a perceptual phenomenon where the human visual system enhances contrast at luminance boundaries, making adjacent regions appear to have stronger difference than they physically have. Mechanism: lateral inhibition in the retina's ganglion cells suppresses surrounding activity, making edges appear sharper. Appearance: a bright bar on a dark background appears with a bright edge on the bright side and a dark edge on the dark side (beyond the actual physical edge); similarly, a dark bar on a light background appears with enhanced contrast at the boundaries. Practical implications: image processing should not rely on perceived edge contrasts for critical measurements; digital edge detection (Sobel, Canny) provides objective measurements; display calibration should account for the Mach effect; and the effect is more pronounced with large, uniform regions adjacent to edges. Example: a step function from 20% to 80% luminance appears with brightening at the 20%→80% transition on the lighter side and darkening on the darker side.


Unit 2: Image Enhancement

Teaching hours: 12

Topics in outline order

  1. Image Transforms
  2. Fourier Transform and Discrete Fourier Transform
  3. Fast Fourier Transform. Cosine Transform
  4. Frequency domain image enhancement
  5. low pass filtering
  6. high pass filtering
  7. homomorphic filter
  8. point processing
  9. contrast stretching
  10. clipping and thresholding
  11. digital negative
  12. intensity level slicing. Histogram processing: equalization
  13. modification
  14. Spatial filtering averaging
  15. Smoothing and sharpening
  16. median filtering
  17. spatial low
  18. high and band pass filters

Explanation

  1. Image Transforms. An image transform converts an image from the spatial domain (pixel values as a function of position) to the frequency domain (pixel values as a function of spatial frequency), enabling analysis and processing that is difficult or impossible in the spatial domain. Why transforms: many image enhancement, restoration, and compression operations are simpler in the frequency domain; for example, low-pass filtering for smoothing is intuitive in frequency domain (remove high-frequency components) but requires kernel convolution in spatial domain. Common transforms: Fourier Transform (represents image as sum of sinusoids with varying frequencies, phases, and amplitudes), Discrete Fourier Transform (DFT) (finite, discrete version of FT), Fast Fourier Transform (FFT) (efficient algorithm to compute DFT in O(n² log n) instead of O(n⁴)), Discrete Cosine Transform (DCT) (uses only cosine basis functions, real-valued, used in JPEG compression), Hadamard Transform (binary matrix, fast, used in some image coding), and Wavelet Transform (multi-resolution analysis, both frequency and location information, used in JPEG2000). 2D DFT: F(u, v) = Σₘ₌₀ᴹ⁻¹ Σₙ₌₀ᴺ⁻¹ f(m, n) × e^(-j2π(um/M + vn/N)) and inverse f(m, n) = (1/MN) Σᵤ₌₀ᴹ⁻¹ Σᵥ₌₀ᴺ⁻¹ F(u, v) × e^(j2π(um/M + vn/N)).

  2. Fourier Transform and Discrete Fourier Transform. Fourier Transform (FT) decomposes a continuous spatial function into its sinusoidal frequency components: F(x, y) = ∫∫ f(ξ, η) × e^(-j2π(ξx + ηy)) dξ dη. The inverse Fourier Transform reconstructs the original: f(ξ, η) = ∫∫ F(x, y) × e^(j2π(ξx + ηy)) dx dy. Properties: Linearity (FT of a+b is FT(a) + FT(b)), Shift (shifting the image introduces a phase shift), Scaling (scaling the image compresses/expands the frequency spectrum), Convolution (FT of convolution equals product of FTs, enabling efficient filtering), and Parseval's Theorem (total energy in spatial domain equals total energy in frequency domain). Discrete Fourier Transform (DFT) applies to finite discrete sequences: F(u, v) = Σₘ₌₀ᴹ⁻¹ Σₙ₌₀ᴺ⁻¹ f(m, n) × e^(-j2π(um/M + vn/N)), where M×N is the image size, f(m,n) is the pixel value at (m,n), and F(u,v) is the complex DFT coefficient at frequency (u,v). ** DFT output** is complex: magnitude √(Re² + Im²) represents frequency strength, and phase atan2(Im, Re) represents frequency position/orientation. Power spectrum: |F(u, v)|² shows the energy distribution across frequencies.

  3. Fast Fourier Transform. Cosine Transform. FFT is an algorithm to compute the DFT efficiently; complexity reduces from O(N⁴) to O(N² log N) for an N×N image; the Cooley-Turkey algorithm is the most common FFT algorithm (recursively breaks down DFT into smaller DFTs). Practical considerations: FFT requires image dimensions to be powers of 2 (zero-padding if necessary); FFT shifts the zero-frequency component to the center of the spectrum (fftshift in MATLAB/Python); and inverse FFT (IFFT) reconstructs the spatial image from the frequency domain. DCT (Discrete Cosine Transform) expresses a signal as sum of cosines: F(u) = α(u) × Σₙ₌₀ᴺ⁻¹ f(n) × cos((π × u × (2n + 1)) / (2 × N)), where α(u) = 1/√N for u=0 and √(2/N) for u>0. DCT advantages: real-valued output (no complex numbers), energy compaction (most energy in few low-frequency coefficients), and efficient compression; used as the basis of JPEG (divide image into 8×8 blocks, apply DCT, quantize coefficients, encode). Comparison: FFT provides both magnitude and phase (needed for reconstruction), while DCT is primarily used for compression where phase information is less critical.

  4. Frequency domain image enhancement. Low-pass filtering removes high-frequency components, resulting in smoothing and noise reduction; the image appears blurred. High-pass filtering removes low-frequency components, enhancing edges and detail; the image appears sharpened but noisier. Ideal low-pass filter (ILPF): D0 is the cutoff frequency; D(u, v) = 1 if D(u, v) ≤ D0, else 0, where D(u, v) = √((u - M/2)² + (v - N/2)²) is the distance from the frequency origin; creates a circular cutoff but has ringing artifacts (Gibbs phenomenon). Gaussian low-pass filter (GLPF): D0 is the cutoff, H(u, v) = e^(-D(u,v)² / 2D0²); Gaussian weighting avoids ringing, provides smoother frequency response. Ideal high-pass filter (IHPF): H(u, v) = 1 if D(u, v) > D0, else 0; Gaussian high-pass filter (GHPF): H(u, v) = 1 - e^(-D(u,v)² / 2D0²); both enhance edges. Butterworth filter: H(u, v) = 1 / (1 + (D(u, v) / D0)⁽²ⁿ⁾) where n controls the transition sharpness; provides a smooth transition between pass and stop bands (no ringing). Homomorphic filtering (detailed in Topic 7) addresses illumination and reflectance components simultaneously.

  5. low pass filtering. Spatial domain low-pass filtering uses a low-pass kernel (filter mask) convolved with the image. Averaging filter (box filter): a square or circular mask where each coefficient is 1/N (N = number of mask cells); replaces each pixel with the average of neighbors; simple but blurs uniformly. Gaussian filter: kernel values follow a 2D Gaussian distribution G(x, y) = (1 / 2πσ²) × e^(-(x² + y²) / 2σ²) where σ controls the spread; larger σ gives more blurring; preserves some detail better than averaging. Frequency domain low-pass filtering: multiply the Fourier transform by a low-pass filter function (ILPF, GLPF, or Butterworth), then apply inverse FFT to return to spatial domain. Steps: (1) compute FFT, (2) shift zero frequency to center, (3) multiply by filter, (4) shift back, (5) compute inverse FFT, (6) take magnitude, (7) clip to 0-255. Example: applying a 3×3 averaging filter to reduce noise in a photograph, or a Gaussian σ=2 for mild smoothing.

  6. high pass filtering. Spatial domain high-pass filtering uses high-pass kernels: Laplacian mask [[0, 1, 0], [1, -4, 1], [0, 1, 0]] (second derivative, detects edges in 4 directions), Sobel operator (first derivative approximations for horizontal and vertical edges), and Prewitt operator (similar to Sobble, slightly different coefficients). Frequency domain high-pass filtering: multiply FFT by a high-pass filter function (IHPF, GHPF, or Butterworth high-pass), then inverse FFT. Unsharp masking: a practical technique: sharp_image = original + × (blurred_image - original) where > 1 enhances edges; equivalent to high-pass filtering. Laplacian of Gaussian (LoG): applies Gaussian smoothing first (to reduce noise), then Laplacian (to detect edges); commonly used for blob detection. Example: enhancing edges in a medical X-ray image to improve fracture visibility.

  7. homomorphic filter. The homomorphic filter enhances images with varying illumination and contrast by operating in the frequency domain on the logarithm of the image. Rationale: an image can be modeled as the product of illumination (slowly varying, low-frequency) and reflectance (rapidly varying, high-frequency): i(x, y) = l(x, y) × r(x, y). Taking the logarithm: log(i(x, y)) = log(l(x, y)) + log(r(x, y)), which separates the two components as additive. The Fourier transform of the log-image separates illumination (low-frequency) and reflectance (high-frequency). The homomorphic filter attenuates low frequencies (enhancing reflectance/detail) and amplifies high frequencies (further enhancing detail), while suppressing noise. Steps: (1) compute logarithm of image (add small constant to avoid log(0)), (2) compute FFT, (3) apply homomorphic filter (e.g., Butterworth high-pass with enhancement factor), (4) inverse FFT, (5) exponentiate to return to original range. Applications: enhancing dark areas in backlit photographs, improving readability of text documents, and enhancing medical images with uneven lighting.

  8. point processing. Point processing operations modify each pixel independently based on its current value. Image negative: s = L - r where r is input pixel, s is output, L is maximum intensity (255 for 8-bit); inverts the image (black becomes white, white becomes black). Thresholding: s = L if r ≥ T, else s = 0 (or vice versa); separates image into two classes based on a threshold T; used for image segmentation and binarization. Gray-level slicing: s = r if r₁ ≤ r ≤ r₂, else a different value; highlights a specific intensity range. Power law (gamma) correction: s = c × r^γ; adjusts overall brightness/contrast non-linearly; γ < 1 brightens dark regions, γ > 1 darkens bright regions. Contrast stretching: linear mapping from input range [min, max] to [0, L-1]. Example: applying image negative to radiography for film review, or thresholding a microscope image to count cells.

  9. contrast stretching. (Detailed as in Unit 1, Topic 9: linear and non-linear stretching, histogram equalization, CLAHE, and gamma correction. Emphasis on practical implementation and when to use each technique.)

  10. clipping and thresholding. Clipping forcibly limits pixel values: s = max(0, min(L-1, r)); discards values outside [0, L-1]; used to prevent overflow/underflow. Hard thresholding: s = T if r ≥ T else 0; binary segmentation based on a fixed threshold. Otsu's method: automatically determines the optimal threshold by minimizing intra-class variance; maximizes between-class variance; implemented by scanning all possible thresholds and selecting the one that maximizes σ_between² = ω₁ω₂(μ₁ - μ₂)² where ω are class probabilities and μ are class means. Example: binarizing a document scan for OCR, or separating tumors from healthy tissue in medical images.

  11. digital negative. (Same as Topic 8: image negative s = L - r; detailed explanation and examples.)

  12. intensity level slicing. Histogram processing: equalization. (Detailed as in Unit 1, Topic 9 and Unit 2, Topic 12: intensity level slicing selects a range of intensity levels, histogram equalization redistributes intensities for uniform histogram. Practical implementation using cumulative distribution function.)

  13. modification. (General image modification operations including pixel-level transformations, color adjustments, and format conversions.)

  14. Spatial filtering averaging. (Detailed as in Topic 5: averaging filter, spatial convolution, and frequency domain equivalent.)

  15. Smoothing and sharpening. Smoothing reduces noise and detail; techniques include Gaussian filtering, median filtering, and averaging. Sharpening enhances edges and detail; techniques include Laplacian filtering, unsharp masking, and high-pass filtering. Compromise: Laplacian of Gaussian (LoG) smooths then sharpps; Difference of Gaussians (DoG) approximates LoG with less computation. Example: smoothing a noisy photograph vs. sharpening a blurry scan of a document.

  16. median filtering. Median filtering is a nonlinear filter particularly effective against salt-and-pepper noise (random white and black pixels). Process: for each pixel, replace its value with the median of neighboring pixel values within a window (e.g., 3×3, 5×5). Advantages: preserves edges better than averaging filter (median is robust to outliers); effective for salt-and-pepper, speckle, and impulse noise. Disadvantage: more computationally expensive than averaging; may distort fine details if window is too large. Example: removing salt-and-pepper noise from a scanned document image.

  17. spatial low. (Refer to Topic 5: low pass filtering in spatial domain.)

  18. high and band pass filters. (Detailed as in Topic 6: high-pass filtering, unsharp masking, Laplacian, and band-pass filtering (passes a specific frequency band, rejects both very low and very high frequencies). Band-pass used for texture analysis and band-limited feature enhancement.)


Unit 3: Image Restoration

Teaching hours: 9

Topics in outline order

  1. Image Restoration – Image degradation model – Noise modeling – Blur
  2. Inverse filtering- removal of blur caused by uniform linear motion
  3. Wiener filtering
  4. Morphological operation
  5. erosion and dilation

Explanation

  1. Image Restoration. Image restoration aims to recover an original clean image from a degraded observed image, using a mathematical model of the degradation process. Degradation model: g(x, y) = H{f(x, y)} + n(x, y) where f(x, y) is the original image, H is the degradation operator (typically convolution with point spread function PSF), n(x, y) is noise, and g(x, y) is the degraded image. Key difference from enhancement: enhancement improves visual appearance without a model; restoration uses a known degradation model to recover the original. Assumptions: the degradation function H is known (or can be estimated), and the noise n is characterized (mean, variance, distribution). Common degradation types: blur (motion blur, out-of-focus), noise (Gaussian, salt-and-pepper, speckle), and geometric distortion.

  2. Inverse filtering. Inverse filtering attempts to reverse the degradation by applying the inverse of the degradation transfer function: F⁻¹{G(u, v) / H(u, v)} where F is FFT, G is the degraded image's FFT, H is the degradation transfer function, and F⁻¹ is inverse FFT. Problem: noise amplification; since H(u, v) may be very small (near zero) at some frequencies, dividing by H amplifies noise enormously. Regularization: add a small constant to the denominator: G(u, v) / (H(u, v) + ε) to limit noise amplification. Example: deblurring a motion-blurred image when the motion path is known (e.g., camera panning at known speed).

  3. Wiener filtering. Wiener filter is a optimal linear filter that minimizes the mean square error between the estimated and original images, balancing deblurring and noise suppression: H_W(u, v) = H*(u, v) / (|H(u, v)|² + K) where H* is the complex conjugate of H, and K = S_n / S_f is the noise-to-signal power ratio (ratio of noise power S_n to signal power S_f). Advantage over inverse filtering: Wiener filtering does not amplify noise as aggressively because of the K term; when K is large (high noise), the filter approaches identity (pass-through, less deblurring); when K is small (low noise), it approaches inverse filtering. Practical estimation: K is often estimated from the image statistics or set empirically. Example: restoring astronomical images (removing atmospheric turbulence blur) and document scans (removing scanner noise and blur).

  4. Morphological operation. Morphological operations process binary images based on shape and structure, using a structuring element (a small binary matrix, e.g., 3×3 cross or square). Fundamental operations: dilation and erosion, from which others are derived. Global morphology assumes the structuring element slides across the image; local morphology considers only pixel neighborhoods. Applications: noise removal, boundary detection, hole filling, and object separation. Noiseless morphology preserves gray-level information (morphological gradient, top-hat, bottom-hat).

  5. erosion and dilation. Erosion shrinks foreground objects: (f ⊖ B)(x, y) = min_{(s, t) ∈ B} f(x-s, y-t) where f is the image, B is the structuring element, and min takes the minimum pixel value under the structuring element; erodes bright regions on dark background (removes small bright details). Dilation expands foreground objects: (f ⊕ B)(x, y) = max_{(s, t) ∈ B} f(x-s, y-t); dilates bright regions on dark background (fills small holes, connects nearby objects). Opening: erosion followed by dilation (f ∘ B = (f ⊖ B) ⊕ B); removes small bright objects while preserving shape; useful for noise removal. Closing: dilation followed by erosion (f • B = (f ⊕ B) ⊖ B); removes small dark holes while preserving shape; useful for closing gaps. Morphological gradient: dilation minus erosion, highlights object boundaries. Top-hat: original minus opening, highlights small bright features. Bottom-hat: closing minus original, highlights small dark features. Example: removing salt-and-pepper noise from a binary image (opening), filling small holes in a text character (closing), and detecting cell boundaries in a microscopy image (gradient).


Unit 4: Image coding and compression

Teaching hours: 9

Topics in outline order

  1. Need for compression
  2. redundancy
  3. pixel coding
  4. run length coding
  5. Hufknancoding
  6. Elements of information theory
  7. Error free compression
  8. Lossy compression
  9. Image compression standards- JPEG & MPEG
  10. wavelet based image compression.

Explanation

  1. Need for compression. Digital images can be very large: an uncompressed 1024×1024 24-bit color image requires 1024 × 1024 × 3 = 3,145,728 bytes ≈ 3 MB; a 4K (4096×2160) frame requires ~64 MB per frame; video at 30 fps would require ~1.9 GB/s uncompressed. Storage constraints: limited disk space, especially for archival collections of millions of images. Transmission bandwidth: limited network capacity; uncompressed video cannot stream in real time over most connections. Processing efficiency: many image processing algorithms are faster on compressed data; compressed data requires less I/O. Compression goals: lossless (perfect reconstruction, used for medical, archival, and graphics), lossy (approximate reconstruction, higher compression ratio, used for photography, video, web), and progressive (initially low quality that improves with more data). Rate-distortion tradeoff: higher compression ratio (lower rate) generally means higher distortion; the optimal point depends on the application (archival vs. web preview).

  2. redundancy. Redundancy refers to data that can be predicted or is unnecessary for perception. Spatial redundancy: adjacent pixels are often highly correlated (neighboring pixels have similar values); e.g., in a smooth sky, most pixels have nearly the same color. Temporal redundancy: in video, consecutive frames are often very similar (only a few pixels change); video compression exploits this. Spectral redundancy: in multispectral images, bands often contain correlated information (e.g., visible and near-infrared). Coding redundancy: the way pixel values are represented uses more bits than necessary; e.g., using 8 bits per pixel when many images only need 4 bits (16 levels). Compression techniques target one or more types of redundancy.

  3. pixel coding. Pixel coding methods reduce the number of bits needed to represent each pixel. Variable-length coding (VLC): assigns shorter codes to more frequent pixel values and longer codes to less frequent ones; Huffman coding and Arithmetic coding are examples. Run-length coding (covered in Topic 4) exploits spatial redundancy by encoding repeated values. Quantization reduces the number of intensity levels (bit depth reduction); 24-bit color → 8-bit indexed color reduces data by 66%. Color palette: a subset of colors (e.g., 256 colors) is stored, and each pixel references the palette index (8 bits per pixel regardless of original color depth). Example: GIF format uses a 256-color palette; JPEG uses quantization of DCT coefficients.

  4. run length coding. Run-length encoding (RLE) encodes sequences of repeated pixel values: instead of storing value, count pairs; for a row of 50 white pixels followed by 10 black pixels, RLE might store (white, 50), (black, 10). 2D RLE: encodes runs in both horizontal and vertical directions; effective for images with large uniform areas (e.g., fax documents, computer screens). Limitations: ineffective for natural images where pixel values change frequently; a photo of a forest has few long runs. Modified READ (Run-Length Encoding with End-of-Information) is used in CCITT Group 3/G4 fax standards. Example: compressing a binary image of text where many white pixels surround black characters.

  5. Hufknancoding. Huffman coding is a prefix-free variable-length coding method: build a frequency table of source symbols (pixel values, DCT coefficients, etc.), build a binary tree (leaf nodes are symbols, weighted by frequency), assign codes (left branch = 0, right branch = 1; shorter codes for more frequent symbols); no code is a prefix of another code, enabling unique decodability. Optimality: Huffman code minimizes the expected codeword length for a given symbol alphabet and probability distribution. Example: encoding a set of symbols {A: 0.4, B: 0.3, C: 0.2, D: 0.1} might produce codes A=0, B=10, C=110, D=111. Adaptive Huffman coding: dynamically updates the frequency table as data is encoded/decoded; useful when symbol probabilities are unknown beforehand. JPEG usage: Huffman coding is the second stage of JPEG compression (after DCT and quantization).

  6. Elements of information theory. Information theory, founded by Claude Shannon, provides the mathematical framework for data compression. Key concepts: bit (binary digit, the fundamental unit of information), entropy (H = -Σ p(i) log₂ p(i)) measures the average information content or uncertainty of a source; higher entropy means more information per symbol and limits compression ratio; redundancy = 1 - (entropy / maximum possible entropy); channel capacity (maximum rate of information transmission over a noisy channel); source coding theorem (no lossless compression can achieve a rate below the source's entropy); and lossy compression can operate below entropy at the cost of distortion. Practical implication: entropy provides a theoretical lower bound on lossless compression ratio; natural images have entropy around 5-7 bits/pixel, while 8 bits/pixel is the uncompressed representation, leaving room for compression.

  7. Error free compression. Lossless compression guarantees perfect reconstruction; the decompressed image is bit-for-bit identical to the original. Run-length coding (Topic 4), Huffman coding (Topic 5), and Arithmetic coding (encodes a whole message into a single floating-point number, achieving compression closer to entropy limit) are examples. LZW (Lempel-Ziv-Welch) dictionary-based method: builds a dictionary of variable-length codes encountered in the data; used in GIF and TIFF. Predictive coding: predicts the current pixel from previous pixels (e.g., predicted = left_pixel + above_pixel - diagonal_pixel), and encodes the residual (actual - predicted); used in PNG and lossless JPEG. Example: lossless compression of a medical image where diagnosis requires exact pixel values, or archival of original artwork.

  8. Lossy compression. Lossy compression achieves higher compression ratios by discarding "unimportant" information; the decompressed image is not identical to the original, but the differences are often not perceptible. Psychovisual modeling: human vision is less sensitive to high-frequency details, color resolution (chrominance can be subsampled), and subtle intensity variations; compression exploits these limitations. Quantization: reduces the precision of DCT coefficients (JPEG) or wavelet coefficients (JPEG2000); larger quantization steps → higher compression, more degradation. Transform coding: apply transform (DCT, Wavelet), quantize coefficients, and encode (Huffman/Arithmetic); most energy is preserved in a few coefficients, allowing aggressive quantization of the rest. Example: JPEG at quality 70 (high compression, minor artifacts) vs. quality 95 (low compression, near-lossless).

  9. Image compression standards- JPEG & MPEG. JPEG (Joint Photographic Experts Group) for still images: process (divide image into 8×8 blocks, apply DCT, quantize coefficients, apply Huffman coding), baseline JPEG (most common, supports color YCbCr 4:2:2 or 4:4:4 subsampling, progressive mode), JPEG-LS (lossless/near-lossless predictive compression), JPEG 2000 (wavelet-based, better compression efficiency, supports lossless and lossy, hierarchical transmission). MPEG (Moving Picture Experts Group) for video: MPEG-1 (VCD quality, ~1.5 Mbps, 352×240 or 352×288, 30 fps), MPEG-2 (DVD quality, 4-10 Mbps, 720×480 or 720×576), MPEG-4 AVC/H.264 (common modern video, efficient, high definition), MPEG-H/ISO-HEVC (current standard, 8K, HDR, and immersive audio). MPEG process: inter-frame compression exploits temporal redundancy (store only differences between frames: I-frames intraframes, P-frames predicted, B-frames bidirectional); intra-frame compression within each frame uses JPEG-like DCT/quantization/huffman. Example: a 2-hour movie on a DVD (MPEG-2, ~4-5 GB) vs. the same uncompressed (~400-800 GB).

  10. wavelet based image compression. Wavelet transform decomposes an image into different frequency sub-bands at multiple resolutions (scales): approximation (LL) low-low sub-band (low frequencies, overall shape), horizontal detail (LH), vertical detail (HL), and diagonal detail (HH) (high frequencies, edges, textures). Wavelet compression process: apply 2D wavelet transform (e.g., Daubechies, Haar), quantize wavelet coefficients (small coefficients set to zero, larger ones quantized), encode using Huffman or arithmetic coding. Advantages over JPEG: better compression ratio at same quality, no blocking artifacts (wavelets have global support), progressive transmission (transmit approximation first, then details), and multi-resolution analysis. JPEG 2000 (Kakadu, OpenJPEG) is the standard using wavelets. Example: compressing a 10MP photograph at equivalent quality to JPEG at 10:1 ratio, but JPEG 2000 achieves 20:1 with equivalent visual quality.


Unit 5: Image segmentation and feature extraction

Teaching hours: 10

Topics in outline order

  1. Image Segmentation: Thresholding, Region based segmentation, edges, lines and curve detection, edge operators, Image Features and Extraction, Texture, Feature reduction algorithms, Image classification, clustering techniques.
  2. Case Studies in Image Security, Steganography and Digital watermarking, Visual effects, Case studies in Medical Imaging and remote sensing.

Explanation

  1. Image Segmentation. Image segmentation partitions an image into meaningful regions (sets of pixels with similar properties) to facilitate further analysis or object recognition. Thresholding: global thresholding uses a single threshold T applied to all pixels: s = 1 if r ≥ T else 0 (binary) or s = T if r ≥ T else 0 (level); Otsu's method automatically selects T by minimizing intra-class variance; local/ adaptive thresholding uses different thresholds for different image regions (based on local mean/variance); multithresholding uses multiple thresholds for >2 classes. Region-based segmentation: region growing starts from seed points and adds neighboring pixels that satisfy a criterion (similar intensity, texture, or color); region splitting and merging (quadtree approach: recursively split into quadrants, merge if homogeneous); watershed transformation treats image as a topographic surface, flooding from markers to segment; split-and-merge recursively divides region based on homogeneity test. Edge detection: Sobel operator uses 3×3 kernels for horizontal and vertical gradient approximation: Gx = [[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]] and Gy = [[-1, -2, -1], [0, 0, 0], [1, 2, 1]]; gradient magnitude G = √(Gx² + Gy²) and direction θ = atan2(Gy, Gx). Canny edge detector: optimal edge detector (maximizes signal-to-noise ratio, thin edges, good localization); steps: (1) Gaussian smoothing, (2) gradient computation (Sobel), (3) non-maximum suppression (thin edges), (4) hysteresis thresholding (keep strong edges, discard weak). Line and curve detection: Hough transform identifies lines by transforming edge points to parameter space (ρ, θ); circle detection extends Hough to (center x, center y, radius); example: detecting lane lines in road images or circles in microscopy. Image features and extraction: local features (SIFT - Scale-Invariant Feature Transform, SURF - Speeded Up Robust Features, ORB - Oriented FAST and Rotated B descriptor, invariant to scale, rotation, and partially to affine distortions); global features (color histogram, texture statistics, shape moments); texture analysis (gray-level co-occurrence matrix GLCM: contrast, correlation, energy, homogeneity; and local binary patterns LBP: rotation-invariant texture classification). Feature reduction: principal component analysis (PCA) reduces dimensionality while preserving variance; linear discriminant analysis (LDA) maximizes class separation. Image classification: assigns each pixel or region to a land cover/class category using supervised classification (training samples, e.g., maximum likelihood, minimum distance, k-NN) or unsupervised classification (cluster analysis, e.g., k-means, ISODATA). Example: land cover classification (forest, water, urban, agriculture) from a satellite image using maximum likelihood classification with training polygons.

  2. Case Studies in Image Security, Steganography and Digital watermarking, Visual effects, Case studies in Medical Imaging and remote sensing. Image Security: protecting image content from unauthorized access or modification; encryption transforms the image so only authorized parties can recover it (symmetric encryption like AES, asymmetric like RSA; stream ciphers block ciphers; permutation-substitution networks). Steganography hides the existence of a message within an image; techniques include LSB (Least Significant Bit) substitution (replace low-order bits of pixel values with message bits), masking and filtering (hide message in frequency domain), and container selection (choosing appropriate cover image). Capacity: number of bits that can be hidden; LSB in 24-bit RGB can hide ~2 bits per pixel (e.g., 500 KB message in 1 MB image). Digital watermarking embeds a identifying mark into an image for ownership verification or content authentication; fragile watermarks detect any modification (tamper evidence), semi-fragile detect significant modifications only, and robust watermarks survive common image processing (resize, compression, format conversion). Watermark embedding: spread spectrum (spread watermark across entire image spectrum), LSB watermarking, and DWT (Discrete Wavelet Transform) domain watermarking. Visual effects: image filtering (blur, sharpen, emboss), color grading, special effects (edge detection highlighting, sketch conversion), and morphing (smooth transition between two images). Medical Imaging case studies: tumor detection using thresholding and region growing on MRI/CT slices; bone fracture detection using edge enhancement and feature extraction; organ segmentation using watershed and level-set methods; quantity: PACS (Picture Archiving and Communication System) stores and shares medical images. Remote sensing case studies: land cover classification (classified satellite imagery into forest, water, urban, agriculture); change detection (compare images from different times to identify deforestation, urban expansion, or disaster damage); crop health monitoring ( multispectral indices like NDVI = (NIR - Red) / (NIR + Red) ); and disaster assessment (flood mapping using thresholding on post-event imagery).


Key Terms (Comprehensive)

digital image processing · DIP · pixel · picture element · grayscale · RGB · color model · HSV · YCbCr · CMYK · Mach band effect · image enhancement · image restoration · degradation model · PSF · point spread function · Wiener filter · homomorphic filter · point processing · image negative · thresholding · contrast stretching · histogram equalization · CLAHE · power law · gamma correction · clipping · digital negative · spatial filtering · averaging filter · Gaussian filter · Laplacian · unsharp masking · median filtering · salt-and-pepper noise · high pass filtering · low pass filtering · frequency domain · Fourier Transform · DFT · FFT · DFT · DCT · homomorphic filter · image restoration · inverse filtering · morphological operation · erosion · dilation · structuring element · opening · closing · morphological gradient · top-hat · bottom-hat · image compression · redundancy · spatial redundancy · temporal redundancy · spectral redundancy · pixel coding · variable-length coding · Huffman coding · arithmetic coding · Run-length encoding · RLE · modified READ · Huffman coding · entropy · Shannon · source coding theorem · lossless compression · lossy compression · JPEG · JPEG-LS · JPEG 2000 · MPEG · MPEG-1 · MPEG-2 · MPEG-4 AVC/H.264 · wavelet · wavelet based compression · JPEG 2000 · image segmentation · thresholding · Otsu's method · region growing · watershed · edge detection · Sobel · Canny · Hough transform · SIFT · SURF · ORB · GLCM · LBP · PCA · LDA · supervised classification · unsupervised classification · maximum likelihood · minimum distance · k-NN · image security · encryption · steganography · LSB · steganography · digital watermarking · fragile watermark · semi-fragile watermark · robust watermark · spread spectrum · Medical Imaging · PACS · Remote sensing · NDVI · change detection


References from the Source Syllabus

  • CACS404 Image Processing course outline (2018), TU FOHSS PDF pp. 117-119
  • Rafael C. Gonzalez, Richard E. Woods, "Digital Image Processing", Pearson, 3rd or 4th edition
  • William K. Pratt, "Digital Image Processing", Wiley, 4th edition
  • John C. Russ, "The Image Processing Handbook", CRC Press
  • Alan C. Bovik, "Handbook of Image Quality", Academic Press, 2009

End of Guide