Digital image processing: steps and components
Digital image processing involves capturing a digital image (sampling and quantisation) and then processing it through a pipeline of preprocessing, enhancement, segmentation, representation, and recognition to extract useful information for engineering applications.
Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.
Why it matters
Digital image processing gives engineers tools to convert real-world light patterns into numeric data, remove noise, enhance important features and extract measurements or decisions (for inspection, medical imaging, robotics, remote sensing). Every computer-vision application—camera systems in industry, medical scanners, satellite imaging—uses the standard processing pipeline described here.
Key ideas
Start from first principles and define terms before using them.
- Pixel — a picture element, the smallest addressable unit in a digital image. It stores an intensity (for grayscale) or a set of component intensities (for colour). Unit: none (counts), typically represented as an integer value.
- Sampling — converting a continuous 2D light field into a grid of discrete spatial samples (pixels). Sampling chooses the spacing (sampling pitch) between pixel centres. Assumption: the continuous image is band-limited (no spatial frequencies above a finite maximum) for perfect reconstruction under Nyquist conditions.
- Quantisation — converting each sampled amplitude (light intensity) into one of a finite set of discrete levels (digital values). Each channel usually uses B bits → 2^B levels.
- Resolution — how many samples (pixels) per unit length or total pixel count (e.g., 1920×1080). Define carefully whether you mean spatial resolution (pixels per mm) or display resolution (pixel count).
- Bit depth — number of bits used per channel per pixel. E.g., 8-bit grayscale has 256 levels (0–255).
- Image acquisition — sensors (CCD/CMOS) and optics form an analog image which is sampled and quantised. This stage introduces noise and blur (point-spread function).
- Preprocessing (Image enhancement) — denoising, contrast stretching, histogram equalisation, linear and non-linear filtering to make subsequent steps more reliable.
- Segmentation — partitioning pixels into meaningful regions (thresholding, edge-based, region growing, clustering) to isolate objects from background. Morphological operations (erosion, dilation, opening/closing) are often used to clean up segmented regions.
- Feature extraction (Representation & description) — converting regions/edges into compact numerical descriptors (shape, boundary, moments, texture features) suitable for classification.
- Recognition (Classification) — assigning a label to an object/region using features and a chosen classifier (statistical, ML-based).
Exact statement (Nyquist sampling theorem for 1D, extended to 2D):
- Theorem: If a continuous signal is band-limited with maximum frequency f_max (Hz) then it can be exactly recovered from samples taken at sampling frequency f_s provided f_s > 2·f_max. Assumptions: signal is strictly band-limited (no frequency components above f_max) and ideal sampling and reconstruction filters are used.
- 2D extension (images): If the image has no spatial frequency components above f_x,max in x and f_y,max in y, sampling intervals Δx and Δy must satisfy 1/Δx > 2·f_x,max and 1/Δy > 2·f_y,max (samples per unit length). In words: sampling rate in each dimension must exceed twice the maximum spatial frequency in that dimension. In practice, apply a low-pass anti-aliasing filter before sampling to enforce the bandlimit and avoid aliasing.
Block-diagram to draw for an exam answer (label each box):
- Draw a left-to-right horizontal chain of boxes: "Acquisition (sensor + optics)" → "Preprocessing (denoise, correct)" → "Enhancement (contrast, sharpen)" → "Segmentation" → "Representation & Feature Extraction" → "Classification / Recognition / Decision".
- Under the Acquisition box draw arrows pointing down for "noise", "blur (PSF)" and annotate typical noise sources (photon noise, sensor read noise).
Derivation universities ask for (sampling memory formula): show how bits per pixel, image size and channels determine storage. Steps: number of pixels = width × height; bits per pixel = channels × bit depth; total bits = pixels × bits per pixel; convert to bytes and MB.
Assumptions behind pipeline effectiveness: noise is approximately additive and independent, objects are separable by chosen features, illumination is controllable or corrected, and sampling satisfies Nyquist for features of interest.
Formulas
N_pixels = W × H — W is image width in pixels, H is image height in pixels; unit: count (applies to any raster image).
bits_total = N_pixels × channels × B — channels is number of separate components (1 for grayscale, 3 for RGB), B is bit depth per channel (bits); unit: bits; use to compute storage before compression.
bytes_total = bits_total / 8 — bytes; convert to megabytes: divide by 10^6 for MB or by 2^20 (1024^2) for MiB.
Δx_max = 1 / (2 × f_x,max) and Δy_max = 1 / (2 × f_y,max) — maximum allowed sampling pitch in x and y (m or mm), f_x,max is maximum spatial frequency (cycles per unit length). Applies under Nyquist assumptions for band-limited images.
MSE = (1 / (W×H)) × Σ_{i=1}^{W} Σ_{j=1}^{H} [I(i,j) - K(i,j)]^2 — mean squared error between original I and processed K; unit: (intensity units)^2. Used when intensities are numeric (e.g., 0–255).
PSNR = 10 × log10( (MAX_I)^2 / MSE ) — Peak signal-to-noise ratio in decibels (dB). MAX_I is maximum possible pixel value (e.g., 255 for 8-bit). Applies when computing fidelity between two images.
Nyquist condition (1D): f_s > 2 × f_max — sampling frequency f_s (samples per second or per unit length) must exceed twice maximum signal frequency.
Worked examples
- Compute storage for a full-HD RGB 8-bit image.
- Given: W = 1920 pixels, H = 1080 pixels, channels = 3 (RGB), B = 8 bits.
- Step 1:
N_pixels = 1920 × 1080 = 2,073,600pixels. - Step 2:
bits_total = 2,073,600 × 3 × 8 = 49,766,400bits. - Step 3:
bytes_total = 49,766,400 / 8 = 6,220,800bytes. - Step 4: Convert to megabytes: 6,220,800 bytes = 6.2208 MB (decimal) or ≈5.9326 MiB (binary, divide by 1024^2).
- Final answer: 6,220,800 bytes (≈6.22 MB or 5.93 MiB).
- Compute PSNR when MSE = 100 for an 8-bit image.
- Given: MAX_I = 255 (for 8-bit), MSE = 100.
- Formula:
PSNR = 10 × log10(255^2 / 100). - Compute: 255^2 = 65,025; quotient = 650.25; log10(650.25) ≈ 2.8129.
- PSNR = 10 × 2.8129 = 28.129 dB.
- Final answer: PSNR ≈ 28.13 dB.
- Sampling pitch from largest spatial frequency: if maximum spatial frequency present is 50 cycles/mm in both axes, what sampling pitch is required?
- Given: f_x,max = f_y,max = 50 cycles/mm.
- From Nyquist: required sampling rate > 2 × 50 = 100 samples/mm.
- Sampling pitch Δx ≤ 1/100 mm = 0.01 mm = 10 µm.
- Final answer: sampling pitch must be ≤ 10 µm (10 × 10^-6 m).
Common mistakes
- Applying Nyquist without stating the band-limited assumption (lead to incorrect claims about aliasing prevention).
- Using MAX_I = 255 for PSNR without checking bit depth; for 10-bit data MAX_I = 1023.
- Confusing MB (10^6 bytes) and MiB (2^20 bytes) and failing to state which unit is used.
- Treating histogram equalisation as a denoising method (it changes contrast but does not remove random noise reliably).
For your exam
Types of questions you will see:
- Definitions: define pixel, sampling, quantisation, bit depth, segmentation, feature extraction.
- Short notes: explain acquisition noise sources; write short note on preprocessing filters.
- Derivations: show memory/storage formula derivation; derive Nyquist condition in words and apply to 2D.
- Numericals: compute storage for given dimensions and bit depth; compute PSNR given MSE; compute sampling pitch from given spatial frequency.
- Diagrams: draw the standard digital image processing pipeline and label each block with examples of methods.
- Long answers: describe steps from acquisition to recognition and how each step handles noise, blur, and illumination.
What a full-marks answer includes:
- Clear definitions (bold the defined term if asked), correct units, and assumptions stated (e.g., band-limited for Nyquist).
- For derivations: show each algebraic step (number of pixels → bits → bytes → MB) and conversions.
- For diagrams: a clean labeled block diagram and short note under each block about typical algorithms.
- For numericals: show substitution into the formula, arithmetic steps, and final answer with units.
Quick check
- What is quantisation in image processing?
- State the Nyquist sampling condition for a 1D band-limited signal.
- How many bytes does a 800×600 grayscale image with 12-bit depth require (uncompressed)?
Answers: 1) Converting sampled amplitudes to a finite set of digital levels (B bits → 2^B levels). 2) Sampling frequency f_s must be greater than twice the maximum signal frequency: f_s > 2·f_max (assumes band-limited signal). 3) N_pixels = 480,000; bits_total = 480,000 × 12 = 5,760,000 bits; bytes_total = 720,000 bytes ≈ 0.72 MB (decimal) or ≈ 0.6866 MiB.
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?