What each question type wants, which method each story word points to, every formula with a worked line, and the theory points to write. Fall 2024 papers are left out.
| question | what it wants | choice | how you write it |
|---|---|---|---|
| Q1 theory · 25 | define, compare, list effects | any 5 of 6 (one per chapter) | definition → formula → 2–3 points → small sketch |
| Q2 math · 24 | numbers: histogram, filter, compression, chain code / morphology | about 3 of 4 | formula → table of every step → final grid / code → one-line comment |
| Q3 case · 21 | a real problem; pick and justify methods | any 3 of 4 | problem → method → why → steps (with equation) → result |
Time: about 2.5 minutes per mark. A 7-mark case = 17 minutes. Never spend more than 20 minutes on one part.
Where marks hide: the formula line, the working table and the final labelled answer each carry marks on their own. A right answer with no table loses about half.
sampling, quantization, bits, pixels, neighbours, distance
point ops (negative, log, gamma, stretch, slice, bit-plane) → histogram → smooth → sharpen
edges (gradient, Laplacian, Canny) or regions (threshold, region growing)
erosion, dilation, opening, closing, boundary, hit-or-miss
chain code → CFD → shape number
Huffman, Golomb, LZW, RLE, RMSE · RGB, CMY, HSI
| first meeting | second meeting | the link |
|---|---|---|
| thresholding s = 1 if r > k (deck 04) | global / iterative threshold (deck 09), binary input for morphology (deck 11) | one cut turns gray into object vs background |
| contrast stretching (deck 04) | histogram equalization (deck 05) | both spread values over 0…L−1; HE does it automatically from the CDF |
| mean / Gaussian smoothing (deck 06) | Canny step 1, LoG (deck 08) | smooth first so noise doesn't make fake edges |
| Laplacian ∇²f (deck 07) | LoG / zero crossings (deck 08) | 2nd derivative: thin double edges, sensitive to noise |
| Sobel / Prewitt gradient (deck 07) | Canny step 2 (deck 08) | 1st derivative: edge strength and direction |
| median filter (deck 06) | salt-and-pepper case questions (Q3) | median ignores extreme 0/255 values and keeps edges |
| boundary β(A) = A − (A ⊖ B) (deck 11) | chain code walks that boundary (deck 10) | first find the outline, then code it |
| erosion (deck 11) | hit-or-miss = two erosions (deck 12) | HMT erodes the object with B1 and the background with B2 |
| entropy H (deck 13) | Huffman Lavg (deck 13) | H is the floor: Lavg ≥ H, efficiency = H / Lavg |
| histogram p(rk) = nk/N (deck 05) | probabilities for Huffman and entropy (deck 13) | same counting table, different use |
| intensity I in HSI (deck 14) | gray-level methods (decks 04–06) | enhance I only, keep H and S, colours stay true |
| you read | it means | you write / use |
|---|---|---|
| too dark, underexposed X-ray / MRI, details hidden in shadows | dark values squashed together | log or gamma γ < 1; or histogram equalization |
| washed out, too bright, aerial photo, faded | bright values squashed together | gamma γ > 1 (3.0–4.0 on the slides) |
| low contrast, dull, narrow histogram | values use only part of 0…L−1 | contrast stretching or histogram equalization |
| highlight a range: tumor, bone [120, 200], water in satellite | one band of gray levels matters | gray-level slicing: give both approaches (background 0, or keep r) |
| huge dynamic range, Fourier spectrum | values 0 to 10⁶ won't fit 0–255 | log transform |
| negative film, white lesions in dark mammogram | dark ↔ light swap helps viewing | negative s = L−1−r |
| hidden watermark, which bits matter, compress by bits | image = stack of bit planes | bit-plane slicing: top planes carry the shape |
| want the look of another image | target histogram given | histogram matching (specification) |
| you read | it means | you write / use |
|---|---|---|
| salt-and-pepper, impulse noise, black and white dots | isolated extreme 0 / 255 pixels | median filter 3×3 (keeps edges) |
| Gaussian noise, grainy, random noise | every pixel slightly off | mean / weighted average / Gaussian filter (blurs a bit) |
| only pepper (black dots) / only salt (white dots) | one-sided impulses | max filter removes pepper, min filter removes salt |
| blurred, fine detail, sharpen, faded ink edges | edges too soft | Laplacian g = f − ∇²f, or unsharp masking / high-boost |
| find edges / outline of an organ, crack, road edge | big change in intensity | Sobel / Prewitt gradient, best: Canny |
| noisy image but need thin, clean, connected edges | edge detector that resists noise | Canny (smooth, gradient, NMS, double threshold, hysteresis) |
| straight lines: roads, lanes, fracture lines | pixels lying on a line | line masks (−1 −1 −1 / 2 2 2) or Hough transform (one line: votes in (ρ, θ)) |
| you read | it means | you write / use |
|---|---|---|
| separate object from background, text from paper | two intensity groups | thresholding; iterative T = ½(μ₁ + μ₂) |
| uneven illumination, shadow on the document | one T can't fit everywhere | local / adaptive threshold (T from each neighbourhood) |
| group similar pixels from a seed point, tumor region | grow from a known pixel | region growing: |neighbour − pixel it grows from| ≤ T |
| "partition pixels depending on intensity" | the words for thresholding | thresholding (SP23 Q1(b)ii) |
| "groups similar pixels" | the words for region-based | region growing or split & merge (SP23 Q1(b)iv) |
| you read | it means | you write / use |
|---|---|---|
| broken characters, gaps in roads, cracks to join | small breaks in the object | dilation (or closing to keep thickness) |
| small bright spots, specks, small particles to remove | objects smaller than the SE | opening (erode, then dilate) |
| small holes inside objects, reflections to fill | background specks inside the object | closing (dilate, then erode) |
| touching coins, count objects | thin necks join the objects | erosion to split, then count connected components |
| outline / boundary of roads, organ edge (binary) | the object's border pixels | boundary β(A) = A − (A ⊖ B) |
| find corners, end points, a fixed pattern | match object AND background | hit-or-miss A ⊛ B = (A ⊖ B₁) ∩ (Aᶜ ⊖ B₂) |
| recognise a shape whatever its rotation / start | describe the boundary by numbers | chain code → CFD → NCFD (shape number) |
| you read | it means | you write / use |
|---|---|---|
| medical, legal, must not lose any detail | lossless only | Huffman, LZW, RLE, Golomb, arithmetic |
| many repeating patterns / colours, bitmap, fixed-length codes | the same sequences come back | LZW (dictionary, 9-bit codes) |
| long runs of the same value, fax, binary documents | consecutive equal pixels | RLE (value, run length) |
| some gray levels far more common than others | unequal probabilities | Huffman (short codes for frequent values) |
| small integers / prediction errors, geometric spread | small values common | Golomb Gm(n) |
| whole message as one number | non-block code | arithmetic coding |
| how good is the decompressed image? | fidelity criterion | RMSE (objective) or rating scale (subjective) |
| printing, ink, printer | subtractive colour | CMY / CMYK |
| monitor, camera, display | additive colour | RGB |
| segment by colour, lighting changes, describe colour like humans | separate colour from brightness | HSI (use Hue) |
Write each case as 4–6 short lines in that order. Name the method in bold in the first line; the examiner looks for it.
(i) Remove noise: median filter (scan noise is impulse-like; median keeps tumor edges) or Gaussian/mean for random noise.
(ii) Partition by intensity: thresholding, g = 1 if f > T else 0; T found iteratively.
(iii) Highlight a range of values: gray-level slicing, [A, B] → L−1, others 0 (or unchanged).
(iv) Group similar pixels: region growing from a seed inside the tumor, add 8-neighbours with |difference| ≤ T.
(i) Enhance: contrast stretching or histogram equalization (faded ink = low contrast) and median filter (background specks).
(ii) Laplacian over Sobel: text is thin strokes and fine detail; the 2nd derivative gives thin, sharp response and g = f − ∇²f sharpens in one mask. Sobel gives thick edges and needs two masks.
(iii) Segment: local (adaptive) thresholding, because illumination is uneven; then horizontal projection to split text lines.
(i) Opening A ∘ B = (A ⊖ B) ⊕ B: erosion deletes spots smaller than B, dilation restores the roads' size.
(ii) Closing A • B = (A ⊕ B) ⊖ B: dilation bridges small gaps, erosion returns the road width. Use a line-shaped SE along the road.
(iii) Boundary β(A) = A − (A ⊖ B): subtract the eroded road from the road; one-pixel outline remains.
(i) Erosion with a disk SE larger than the necks: touching coins split into separate blobs; count with connected-component labeling. (Follow with dilation if size matters = opening.)
(ii) Opening with an SE just larger than the small particles: they cannot contain the SE, so erosion removes them; dilation restores the large particles to their size.
(i) Median filter 3×3 on the object region (mask from thresholding), background untouched: impulses sort to the ends, the median ignores them, edges stay sharp.
(ii) Morphology: opening removes white (salt) specks, closing fills black (pepper) dots inside the object.
Power-law: γ < 1 brightens a dark X-ray so thin cracks show; limitation: also brightens noise.
Histogram analysis / equalization: spreads bone gray levels for contrast; limitation: may over-enhance soft tissue.
Hough transform: finds straight fracture lines by voting in (ρ, θ); limitation: curved cracks are missed.
Chain code: codes the bone outline; a break shows as an irregular CFD (sudden turns); limitation: noise-sensitive, needs a clean boundary.
| what | formula | one worked line |
|---|---|---|
| gray levels | L = 2k, range 0 … L−1 | k = 12 → L = 4096, range 0–4095 |
| image size | b = M × N × k bits (÷ 8 = bytes) | 1024 × 768 × 12 = 9,437,184 bits = 1,179,648 bytes |
| nearest-neighbour zoom | position = ⌈i × old / new⌉, i = 1…new | 3×3 → 5×5: ⌈0.6 i⌉ = 1 2 2 3 3 (copy those rows / columns) |
| city-block D4 | |x − s| + |y − t| | p(1,2), q(4,6): 3 + 4 = 7 |
| chessboard D8 | max(|x − s|, |y − t|) | max(3, 4) = 4 |
| Euclidean De | √[(x − s)² + (y − t)²] | √(9 + 16) = 5 |
| method | formula | worked line | use |
|---|---|---|---|
| negative | s = (L−1) − r | 8-bit, r = 100 → 155 | white detail in dark areas |
| log | s = c · log(1 + r), c = (L−1)/log(L) | c = 255/log 256 = 105.89; r = 50 → 105.89 × log 51 = 181 | expand dark, compress bright |
| gamma | s = (L−1) · (r / (L−1))γ | 3-bit, r = 3: γ = 0.5 → 7 × 0.6547 = 5; γ = 2 → 7 × 0.1837 = 1 | γ < 1 brighter, γ > 1 darker |
| min–max stretch | s = (r − rmin)(L−1) / (rmax − rmin) | [50, 150] → [0, 255]: r = 100 → 50 × 255/100 = 127.5 → 128 | fill the whole range |
| threshold | s = L−1 if r > k, else 0 | k = 127: 90 → 0, 200 → 255 | binary object vs background |
| bit plane n | bitn = ⌊r / 2n−1⌋ mod 2 (weight 2n−1) | 13 = 1101: planes 4,3,2,1 = 1,1,0,1 | top planes = shape, bottom = noise |
Three special settings: r₁ = s₁ and r₂ = s₂ → identity (no change). r₁ = r₂, s₁ = 0, s₂ = L−1 → thresholding. r₁ ≤ r₂ and s₁ < s₂ in between → contrast stretching. Draw all three graphs.
r = 100 → 0 / 100 · r = 150 → 255 / 255 · r = 220 → 0 / 220. Approach 1 = binary, background gone; approach 2 = background kept.
Worked (3-bit, N = 64, nk = [8, 10, 10, 2, 12, 16, 4, 2]). Do every row like the first two:
r = 0: p = 8/64 = 0.125, CDF = 0.125, 7 × 0.125 = 0.875 → 1. r = 1: p = 10/64 = 0.15625, CDF = 0.28125, 7 × 0.28125 = 1.969 → 2.
| r | nk | p | CDF | 7 × CDF | s |
|---|---|---|---|---|---|
| 0 | 8 | 0.1250 | 0.1250 | 0.875 | 1 |
| 1 | 10 | 0.1562 | 0.2812 | 1.969 | 2 |
| 2 | 10 | 0.1562 | 0.4375 | 3.062 | 3 |
| 3 | 2 | 0.0312 | 0.4688 | 3.281 | 3 |
| 4 | 12 | 0.1875 | 0.6562 | 4.594 | 5 |
| 5 | 16 | 0.2500 | 0.9062 | 6.344 | 6 |
| 6 | 4 | 0.0625 | 0.9688 | 6.781 | 7 |
| 7 | 2 | 0.0312 | 1.0000 | 7.000 | 7 |
New histogram: add the counts that land on the same s: s = 3 gets 10 + 2 = 12; s = 7 gets 4 + 2 = 6. Total stays 64.
Matching (if asked): equalize the input → H, equalize the target → S, map each r to the z whose S is closest to its H (ties → higher S).
One window, every filter. Centre pixel = 200 (a noise spike):
| 10 | 20 | 30 |
| 40 | 200 | 60 |
| 70 | 80 | 90 |
| 1 | 2 | 1 |
| 2 | 4 | 2 |
| 1 | 2 | 1 |
| filter | rule | result at the centre |
|---|---|---|
| mean (box) | Σ / 9 | 600 / 9 = 66.67 → 67 |
| weighted average | Σ w·f / 16 | 1400 / 16 = 87.5 |
| median | sort 9, take the 5th | 10 20 30 40 60 70 80 90 200 → 60 (spike gone) |
| min / max | smallest / largest | 10 / 200 |
| 10 | 10 | 10 |
| 10 | 50 | 10 |
| 10 | 10 | 10 |
| 0 | 1 | 0 |
| 1 | -4 | 1 |
| 0 | 1 | 0 |
∇²f = 10 + 10 + 10 + 10 − 4×50 = -160. Centre negative, so g = f − ∇²f = 50 + 160 = 210: the bright dot gets brighter, detail stands out. One-pass mask: [0 −1 0; −1 5 −1; 0 −1 0].
| 10 | 10 | 10 |
| 10 | 10 | 10 |
| 90 | 90 | 90 |
| -1 | 0 | 1 |
| -2 | 0 | 2 |
| -1 | 0 | 1 |
| -1 | -2 | -1 |
| 0 | 0 | 0 |
| 1 | 2 | 1 |
Gx = (10 + 20 + 90) − (10 + 20 + 90) = 0. Gy = (90 + 180 + 90) − (10 + 20 + 10) = 320. |∇f| ≈ |Gx| + |Gy| = 320: a strong horizontal edge. Direction α = tan⁻¹(Gy / Gx).
Unsharp masking: mask = f − blurred f; g = f + k · mask. k = 1 unsharp, k > 1 high-boost.
| 1st derivative (gradient) | 2nd derivative (Laplacian) |
|---|---|
| thick edges, non-zero along ramps | thin double edges, zero on ramps, zero crossing at the edge |
| less noise-sensitive | very noise-sensitive, strong on isolated points |
| gives direction | no direction, one mask |
Criteria: low error rate (find real edges only), good localisation (on the true edge), single response (one pixel per edge).
Iterative T, values 10 20 30 200 210 220: start T₀ = mean = 115. Group above: mean 210; group at or below: mean 20. T₁ = ½(210 + 20) = 115 = T₀, so stop.
Region growing: start at a seed, add a 4- or 8-neighbour when |neighbour − the pixel it grows from| ≤ T, repeat until nothing joins. Split & merge: split a block into 4 while (max − min) > T, merge neighbours that are similar.
Line masks (sum 0, the 2s lie along the line): horizontal [−1 −1 −1; 2 2 2; −1 −1 −1], vertical [−1 2 −1; −1 2 −1; −1 2 −1], ±45° with the 2s on a diagonal.
Compass: 0 = right, counting anticlockwise: 1 ↗, 2 ↑, 3 ↖, 4 ←, 5 ↙, 6 ↓, 7 ↘ (4-direction: 0 →, 1 ↑, 2 ←, 3 ↓).
Worked (slide 12 / SP24): CC = 0 0 7 7 5 6 5 5 4 3 2 2 2 1 2
CFD: 0→0 = 0 steps, 0→7 = 7 steps, 7→7 = 0, 7→5 = 6, … last 2→0 = 6. CFD = 070617077700716
0s at places 1, 3, 7, 11, 12. Longest run = places 11–12 (two 0s). Start there: 0 0 7 1 6 | 0 7 0 6 1 7 0 7 7 7 → NCFD = 007160706170777
| what | invariant to |
|---|---|
| CC | translation |
| smallest shift of CC | + start point |
| CFD | + rotation (45° steps) |
| NCFD = shape number | start point + rotation |
| operation | equation | plain rule | effect |
|---|---|---|---|
| erosion | A ⊖ B = {z | (B)z ⊆ A} | SE must fit (all 1s on object) | shrink, delete specks, split joins |
| dilation | A ⊕ B = {z | (B̂)z ∩ A ≠ ∅} | SE must hit (any 1 on object) | grow, fill holes, join gaps |
| opening | A ∘ B = (A ⊖ B) ⊕ B | erode, then dilate | remove small objects and thin bridges, size kept |
| closing | A • B = (A ⊕ B) ⊖ B | dilate, then erode | fill small holes and gaps, size kept |
| boundary | β(A) = A − (A ⊖ B) | object minus its eroded self | 1-pixel inner outline |
| hit-or-miss | A ⊛ B = (A ⊖ B₁) ∩ (Aᶜ ⊖ B₂) | 1s match object AND 0s match background; × ignored | corners, end points, patterns |
| thinning / thickening | A − (A ⊛ B) / A ∪ (A ⊛ B) | subtract / add the matches | skeleton / grow outline |
1-D worked, row 1 0 0 0 1 1 1 0 1 1, SE [1 1 1] (ends ignored):
Erosion takes the minimum under the SE: windows 100, 000, 001, 011, 111, 110, 101, 011 → 0 0 0 0 1 0 0 0.
Dilation takes the maximum: → 1 0 1 1 1 1 1 1 (only the 000 window stays 0).
Memory hook: Erosion Eats, Dilation Deposits. Opening = E then D (opens gaps between things, removes specks). Closing = D then E (closes holes).
| what | formula | worked line |
|---|---|---|
| compression ratio | CR = n₁ / n₂ (original / compressed) | 512×512×8 = 2,097,152 bits; 64 KB = 524,288 bits → CR = 4 |
| relative redundancy | RD = 1 − 1/CR | 1 − 1/4 = 0.75 → 75% redundant |
| average length | Lavg = Σ l(rk) p(rk) | Huffman below: 1.9 bits/symbol |
| entropy | H = −Σ p log₂ p | 0.4·1.322 + 0.3·1.737 + 0.2·2.322 + 0.1·3.322 = 1.8464 |
| efficiency | η = H / Lavg | 1.8464 / 1.9 = 97.2% |
| RMSE | erms = √[ (1/MN) Σ (f̂ − f)² ] | every pixel +2: √(36/9) = 2 |
| SNR (ms) | Σ f̂² / Σ (f̂ − f)² | 248 / 36 = 6.889 |
Reduce: sort, merge the two smallest: C + D = 0.3 → list 0.4, 0.3, 0.3 (the sum goes below the equal value) → merge 0.3 + 0.3 = 0.6 → list 0.6, 0.4.
Code back: upper branch 0, lower 1: 0.6 = 0, 0.4 = 1 → A = 1; B = 00, (CD) = 01 → C = 010, D = 011.
Lavg = 0.4·1 + 0.3·2 + 0.2·3 + 0.1·3 = 1.9 ≥ H = 1.8464. Fixed 2-bit code → CR = 2 / 1.9 = 1.053.
G₄(9): q = 2 → 110; r = 1, k = 2, c = 0 → r ≥ c → 1 + 0 = 1 in 2 bits = 01 → 11001.
G₅(12): q = 2 → 110; r = 2, k = 3, c = 3 → r < c → 2 in 2 bits = 10 → 11010.
| symbol | range before | low | high |
|---|---|---|---|
| a1 | 1 | 0 | 0.2 |
| a2 | 0.2 | 0.04 | 0.08 |
| a3 | 0.04 | 0.056 | 0.072 |
| a3 | 0.016 | 0.0624 | 0.0688 |
| a4 | 0.0064 | 0.06752 | 0.0688 |
Any number in [0.06752, 0.0688) codes the message: the slide picks 0.068.
Dictionary starts with 0–255. Read a pixel: if (current + pixel) is in the dictionary, keep extending; if not, output the code of current, add (current + pixel) at the next location (256, 257, …), restart from the pixel.
| recognized | pixel | output | location | entry |
|---|---|---|---|---|
| 39 | ||||
| 39 | 39 | 39 | 256 | 39-39 |
| 39 | 126 | 39 | 257 | 39-126 |
| 126 | 126 | 126 | 258 | 126-126 |
| 126 | 39 | 126 | 259 | 126-39 |
| 39 | 39 | |||
| 39-39 | 126 | 256 | 260 | 39-39-126 |
| 126 | 126 |
Full output: 39 39 126 126 256 258 260 259 257 126 → 10 codes × 9 bits = 90 bits vs 128 → CR = 1.42.
RLE: write (value, run length). Row 10 10 10 10 12 12 → (10, 4)(12, 2). Short runs make the file bigger (CR < 1): say so.
| redundancy | what it is | removed by |
|---|---|---|
| coding | codes longer than needed | Huffman, Golomb, arithmetic |
| spatial / inter-pixel | neighbours repeat or predict each other | LZW, RLE, predictive coding |
| irrelevant (psychovisual) | detail the eye ignores | quantization (lossy) |
| temporal | frames in a video repeat | frame differencing |
| what | formula / fact |
|---|---|
| RGB → CMY | C = 1 − R, M = 1 − G, Y = 1 − B (normalise to 0–1 first) |
| θ | cos⁻¹ { ½[(R − G) + (R − B)] / √[(R − G)² + (R − B)(G − B)] } |
| H | θ if B ≤ G, else 360° − θ (red 0°, green 120°, blue 240°) |
| S | 1 − 3·min(R, G, B) / (R + G + B) |
| I | (R + G + B) / 3 |
| 24-bit colours | 2²⁴ = 16,777,216 |
Worked (R, G, B) = (0.8, 0.4, 0.2): numerator ½(0.4 + 0.6) = 0.5; denominator √(0.16 + 0.6 × 0.2) = √0.28 = 0.5292; θ = cos⁻¹(0.9449) = 19.1°. B ≤ G, so H = 19.1°. S = 1 − 3 × 0.2 / 1.4 = 0.5714. I = 1.4 / 3 = 0.4667.
| if asked | write |
|---|---|
| sampling vs quantization; why more levels look finer | coordinates vs amplitude; few pixels → blocky, few levels → false contours; bits = M·N·k |
| 4-, 8-, m-connectivity; distance properties | the three adjacency rules; m removes double paths; D ≥ 0, symmetric, triangle inequality |
| image enhancement; spatial vs frequency domain | make an image more useful for a task; spatial works on pixels directly (point, neighbourhood), frequency on the Fourier transform |
| piecewise linear: identity, threshold, stretch | the 3-piece formula with (r₁,s₁),(r₂,s₂) and the 3 settings, each with a graph |
| histogram; 4 types; can you rebuild the image? | h(rk) = nk; dark / bright / low / high contrast sketches; no, it holds no positions |
| why is the equalized histogram not flat? | discrete levels: several r map to one s, some s stay empty |
| smoothing vs sharpening | averaging (integration) blurs, removes noise; derivatives (differentiation) bring out edges |
| 1st vs 2nd derivative | thick vs thin double edge; ramp non-zero vs zero; 2nd strong on points, noise-sensitive |
| edge detection steps; Canny | smooth → gradient → threshold; Canny's 3 criteria and 5 steps |
| segmentation approaches | discontinuity (points, lines, edges) and similarity (threshold, region growing, split & merge) |
| structuring element; erosion vs dilation | small shape with an origin; fit vs hit; shrink vs grow; one application each |
| opening vs closing | equations, order of operations, specks vs holes, idempotent |
| chain code; why CFD and NCFD | boundary as direction numbers; CFD removes rotation, smallest shift removes start point |
| data vs information; three redundancies | data = what is stored, information = what it tells; coding, spatial, irrelevant (+ temporal) |
| lossless vs lossy | exact rebuild (Huffman, LZW, RLE) vs some loss for higher CR (quantization); judge lossy with RMSE |
| why is Huffman optimal / entropy | shortest codes for most likely symbols, prefix-free; H is the lower bound on Lavg |
| additive vs subtractive; which model for printing, display, segmentation | light vs pigment; CMYK, RGB, HSI |
| RGB cube; how gray is formed | axes R, G, B 0–1; black origin, white (1,1,1); gray on the diagonal |
Every formula above has a full lesson page with past questions solved and a step-by-step simulator: