Exam card
- Arithmetic works pixel by pixel on images of the same size: add min(255, A+B) · subtract max(0, A−B), or |A−B| for change · multiply A·B for masking · divide A/(B+ε) · average (1/N)ΣIi for noise.
- Logical (AND, OR, NOT, XOR) works on binary images and masks: region selection and segmentation. Arithmetic risks overflow and clipping; logical loses the intensity range.
- Geometric: p′ = T(p). Scale [Sx 0; 0 Sy] · rotate [cos −sin; sin cos] · shear [1 kx; ky 1] · reflect Fx, Fy · translate x+tx, y+ty.
- Homogeneous coordinates (x, y, 1) turn translation into a matrix multiply, so a chain of transforms becomes one product (affine).
- Forward mapping leaves holes. Inverse mapping asks where each output pixel came from, then interpolates: nearest neighbour (fast, jagged) or bilinear (4 neighbours, smooth).
- Aliasing = sampling too coarsely gives jagged edges and moiré. Anti-aliasing reduces it.
Key diagram
Key terms
What this topic covers
- Arithmetic operations
- Logical operations
- Geometric operations
- Resampling and interpolation
- Aliasing and anti-aliasing
Deep summary
Everything here follows the Topic 3 slides; each part shows its slide numbers. Parts marked added are study aids we wrote, not lecture content.
1 · Arithmetic, pixel by pixel, with numbers Topic 3 · slides 3–13
Slide 3: arithmetic works pixel by pixel on two images A and B of equal size, so each row above is one or two pixel positions.
Add (slide 4) clips at 255: 200 + 100 = 300 → 255. Subtract (slide 5) clips at 0: 40 − 70 = −30 → 0, so that change is lost; |A − B| keeps it (30). Slide 7 subtracts a smooth bright-to-dark background from a microscope image to flatten the lighting.
Multiply by a 0/1 mask M (slides 8–9: a white circle keeps the region of interest). Divide A/(B + ε) (slides 10–11): the same surface lit 200 or 100 gives 100/200 = 50/100 = 0.5, so uneven light cancels; ε stops a divide by zero. Average N frames of a still scene (slides 12–13, 500 images): noise of +4, −3, +1, −2 cancels to the true 100.
2 · Logical operations as truth tables on pixels Topic 3 · slides 14–16
Slide 14: logical operations are for binary images and masks; 1 = foreground (true), 0 = background (false). Read each column of the grid as one pixel.
AND is 1 only where both are 1 · OR where either is 1 · XOR where they differ · NOT flips. Slide 15 does this with a square A and a circle B: AND leaves the small overlap, OR the union, XOR the union minus the overlap, NOT turns each mask inside out.
Slide 16 sums up the trade-off: arithmetic changes intensities by an amount but can overflow or clip; logical selects regions precisely but keeps only two states and needs a good threshold or mask.
3 · One point through the four 2 × 2 transforms Topic 3 · slides 18–22
Slide 18: a geometric operation moves the coordinates: p′ = T p with p = (x, y). Take one point p = (2, 1) and apply each 2 × 2 matrix from slides 19–22.
Scale Sx=2, Sy=3: (2·2, 3·1) = (4, 3); Sx ≠ Sy, so the aspect ratio changes. Rotate θ = 90°: (cos·2 − sin·1, sin·2 + cos·1) = (−1, 2). Shear kx=1, ky=0: (2 + 1·1, 1) = (3, 1).
Reflect: Fx negates x → (−2, 1); Fy negates y → (2, −1). The general F with θ = 45° becomes [0 1; 1 0], which swaps x and y → (1, 2): a mirror in the line y = x.
4 · Translation and homogeneous coordinates Topic 3 · slides 23–24
Slide 23: translation x′ = x + tx, y′ = y + ty adds a constant, and a 2 × 2 matrix cannot do that. Slide 24’s fix: write the point with a third coordinate equal to one, (x, y, 1), and use a 3 × 3 matrix.
① The last column holds tx, ty, so (2, 1, 1) → (5, 5, 1). ② Because every transform is now a matrix multiply, a chain collapses into one matrix (slide 24: affine transformations). The 2 × 2 rotation sits in the top-left corner.
added The order of multiplication matters: rotate-then-translate (T · R) and translate-then-rotate (R · T) land on different points.
5 · Inverse mapping, one row at a time Topic 3 · slides 25–29
Slides 25–27: after a transform the new coordinates rarely fall on whole pixels. Forward mapping pushes each source pixel to (2x, 2y), so in a 4 × 4 output only 4 pixels are hit and the rest are holes. Inverse mapping asks, for each output pixel, “where did this pixel come from?” (T−1, slide 27).
For scale 2 the inverse is “divide by 2”. added We measure from pixel centres, x = (x′ + 0.5)/2 − 0.5, a common convention the slides don’t specify. Then nearest neighbour (slide 29) rounds: I′(x, y) = I(round x, round y). Row 0 becomes 10 10 20 20, matching the 4 × 4 result in the Discussion.
Slide 28: because x = 0.25 or 0.75 is between pixels, the value must be estimated by interpolation; NN and bilinear are the two main ways.
6 · Bilinear interpolation: weights worked out Topic 3 · slides 30–31
Slide 30: bilinear interpolation estimates a pixel lying between four neighbours, weighting each by how close it is:
I(x, y) = (1−a)(1−b)·I(x₀,y₀) + a(1−b)·I(x₀+1,y₀) + (1−a)b·I(x₀,y₀+1) + ab·I(x₀+1,y₀+1).
Output pixel (1, 1) maps back to (0.25, 0.25), so a = b = 0.25. Weights: 0.75·0.75 = 0.5625, 0.25·0.75 = 0.1875 (twice), 0.25·0.25 = 0.0625 (they add to 1). Value = 5.625 + 3.75 + 5.625 + 2.5 = 17.5. Nearest neighbour just copies 10.
Bilinear makes new in-between values (12.5, 22.5 …) and a smooth ramp; NN keeps only 10/20/30/40 in blocks. Slide 31 compares the two on a photo (and also shows bicubic). Note: slide 30 prints all four terms as I(x₀, y₀); the four different neighbours are meant.
7 · Aliasing: when sampling invents a pattern Topic 3 · slides 29, 32–34
Slide 32: aliasing happens when an image is sampled at too low a resolution for its fine detail. In images it shows as jagged edges on diagonals and curves, false patterns (moiré), and lost or distorted detail.
added The diagram is a 1-D example: stripes that repeat every 2 pixels, kept at only every 3rd pixel, come out as stripes 6 pixels wide. Slide 33 shows the same thing on a striped shirt: the left copy has coloured wavy bands that aren’t on the shirt.
Slide 29 links this to resampling: nearest neighbour “can cause noticeable aliasing”. Anti-aliasing (slide 34) is the process of reducing these artefacts; the slides define it without naming a method.
8 · Exam traps Topic 3 · slides 5, 12, 14, 22–24, 26–30 added
- max(0, A−B) is not change detection: where B is brighter the change clips to 0. Use |A − B| (slide 5).
- Averaging needs a still scene (slide 12): anything that moves between frames blurs.
- Logical ops are for binary masks (slide 14), not grey-level intensities.
- Fx negates x (mirror across the y-axis); Fy negates y (slide 22). Don’t swap them.
- Translation is not a 2 × 2 matrix (slide 23): it needs (x, y, 1) and a 3 × 3 matrix (slide 24). When combining, the order of the matrices matters.
- Forward mapping leaves holes; inverse mapping + interpolation fills every pixel (slides 26–28).
- NN keeps the original values, bilinear creates new ones (slides 29–30).
9 · Quick check Topic 3 · slides 5, 23–24, 30 added
Q1. A pixel is 100 in frame A and 180 in frame B. What do max(0, A − B) and |A − B| give?
Q2. Translate (1, 2) by tx = 4, ty = −1 using homogeneous coordinates.
Q3. A point sits exactly in the middle of four pixels 0, 100, 100, 200. What does bilinear interpolation give?
Exam questions · 16 Practise these 16
Q1Define image addition and subtraction for 8-bit images and give two applications of each.
Q2How does image averaging reduce noise, and when does it work?
Q3Compare arithmetic and logical operations on images.
Q4Why can’t translation be written as a 2 × 2 matrix? How do homogeneous coordinates help?
Q5Scale I = [10 20; 30 40] by a factor of 2. Explain forward vs inverse mapping and the result with nearest-neighbour interpolation.
Q6Compare nearest-neighbour and bilinear interpolation, and explain aliasing.
Q7Calculate · For 8-bit images A = [250 120; 30 80] and B = [20 140; 60 80], compute A + B, max(0, A − B) and |A − B|. Which pixels were clipped?
Q8Match · Match each task to the arithmetic operation the slides give for it: (a) spotting a moving car between two video frames (b) keeping only a circular region of interest (c) correcting non-uniform illumination (d) reducing random noise in still astronomical images (e) making the whole image brighter.
Q9Apply · Two binary masks along one row are A = 1 1 0 1 0 and B = 0 1 1 1 0. Work out A AND B, A OR B, A XOR B and NOT B. Which result is a simple “where do they differ” map?
Q10Calculate · Rotate the point p = (4, 0) by θ = 30° about the origin using the rotation matrix. Give the new coordinates to two decimals.
Q11Calculate · A sample point lies at a = 0.4, b = 0.3 inside the four pixels I(x₀,y₀) = 50, I(x₀+1,y₀) = 100, I(x₀,y₀+1) = 150, I(x₀+1,y₀+1) = 200. Find its value by bilinear and by nearest-neighbour interpolation.
Q12Classify · Name the transform each matrix performs: (a) [1 0.5; 0 1] (b) [−1 0; 0 1] (c) [0.5 0; 0 0.5] (d) [0 −1; 1 0] (e) [3 0; 0 1] (f) [1 0 5; 0 1 −2; 0 0 1].
Q13Describe · Describe what shearing does, using the square with corners (0,0), (2,0), (2,2), (0,2) and kx = 0.5, ky = 0. Give two uses of shearing.
Q14Compare · A 400 × 300 image is scaled with (Sx, Sy) = (0.5, 0.5) and, separately, with (2, 1). Give each new size and compare the two kinds of scaling.
Q15Outline · Outline the steps to rotate an image by θ using inverse mapping and an interpolation method from the slides.
Q16Explain · Slide 7 shows a microscope image minus a smooth bright-to-dark image giving a cleaner result. Explain why subtraction helps here, using a cell edge of 180 on the bright side (background 160) and 100 on the dark side (background 80).
Quick MCQs · 14 MCQs in Practise
Not the exam format: quick checks that you understood the topic. Choose 1 or all that apply, then Check.