Every idea this chapter reviewed exists for one reason: to make a single sentence completely unsurprising. A digital image is a matrix, and a matrix is a function of its row and column numbers. Section 1 built the matrix. Section 2 built the function-of-coordinates reading, with its flipped y-axis. Section 3 built the double sum needed to combine every pixel into one number. This section puts the three together and hands the result to Chapter 1, which spends its own length on exactly what that matrix is allowed to hold.
Everything in this course is one move, over and over. Start with a grid of numbers. Follow some rule. End up with a different grid of numbers: a blurrier one, a sharper one, an edge-only one, a smaller one. That's it. The rule changes from chapter to chapter, but the shape of what's happening never does: numbers in, a rule, numbers out.
Keeping that one picture in mind, "this technique is a rule for turning one grid of numbers into another," is worth more than memorizing any single formula. Every formula this course teaches is just one more example of that same move.
Formally, a digital image is a function I : \{0,\dots,H-1\}\times\{0,\dots,W-1\} \to V where V is the set of legal pixel values (for now, \{0,\dots,255\} for grayscale). Every technique this course builds, a point operation, a convolution, a Fourier transform, a segmentation rule, is without exception a rule for producing a new function I' from I. Sometimes that rule changes the domain's size (a resized image). Sometimes it changes the codomain (a binary image after thresholding, or a color image with V = \{0,\dots,255\}^3). This is the one unifying idea the rest of the course hangs on: every operation just builds a new function from an old one.
One image, read as one function
This is a real (tiny) grayscale image. Click a few cells and notice: each click asks the SAME question -- 'what number sits at this coordinate?' -- which is exactly what it means to evaluate a function at a point.
Loading interactive…
Worked example
Naming what a technique does to domain and codomain
-
1
Chapter 2 will teach thresholding. Every pixel below 128 becomes 0; every pixel at or above 128 becomes 255. Describe this as a function I \to I'. Thresholding does not change the domain. Same H, same W: every pixel still has a value after the operation.
-
2
It changes the codomain. The input I maps coordinates to \{0,\dots,255\}. The output I' only ever takes the two values 0 or 255. So thresholding is the function I'(x,y) = \begin{cases} 255 & I(x,y)\ge 128 \\ 0 & I(x,y) < 128\end{cases} Same domain as I, but a smaller codomain: \{0, 255\} instead of \{0,\dots,255\}.
Loading interactive…
Worked example
A resize's effect on domain and codomain
-
1
Shrinking the 2\times 2 image above to a single 1\times 1 pixel (one averaged value): describe the effect on domain and codomain. The coordinate grid shrinks from four valid coordinates to one.
-
2
The domain changes: fewer valid coordinates. The codomain stays \{0,\dots,255\}, since the single output pixel is still an ordinary brightness value in that same range.
Loading interactive…
Where this goes next
Scientific visualization
A satellite records a raw grid of light readings that is not a "picture" in any visual sense at all. It often stores 12 or 16 bits per pixel, values carrying real physical units, with no upper limit of 255. Turning that raw grid into a colored image a scientist can read takes several steps: fixing the scale, stretching the contrast, choosing which colors mean which values. Each step is exactly the "old function in, new function out" move this section names. The underlying math never cares whether the final result looks like an ordinary photograph. The function-of-coordinates structure stays identical, whether V is \{0,\dots,255\} or a real physical reading.
Check your understanding (counts toward your progress)
A color-to-grayscale conversion changes...
Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.
The coordinate grid (which (x,y) pairs are valid) is exactly the same before and after -- only what's stored AT each coordinate changes.
The set of legal pixel coordinates doesn't shrink during a color-to-grayscale conversion.
The output clearly differs from the input -- a single grayscale number replaces each three-number color triple.
Why
Every (x,y) coordinate is still valid (same domain), but each pixel's output now lives in \{0,\dots,255\} instead of \{0,\dots,255\}^3 -- a different codomain.
Describe thresholding (mapping every pixel below 128 to 0 and every pixel at or above 128 to 255) as a function I \to I', stating exactly what changes -- the domain, the codomain, or both.
AI grading isn't configured on this deployment.
Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.
First mistake
Correct answer
Also accepted:
Why
Why
Thresholding leaves the domain unchanged (same coordinate grid) but shrinks the codomain from \{0,\dots,255\} down to just \{0, 255\}, since the output only ever takes two possible values.
Name one everyday photo-editing operation that changes NEITHER the domain nor the codomain of the image function -- only the values themselves.
Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.
Cropping changes the domain -- fewer valid coordinates remain after cropping.
Grayscale conversion changes the codomain, from three-valued color to single-valued brightness.
Resizing changes the domain -- a different, and typically smaller, coordinate grid.
Why
Brightening (with clamping to keep values legal) keeps every original coordinate valid (same domain) and keeps values within the same legal range \{0,\dots,255\} (same codomain) -- only the specific stored numbers change.
Practice: Domain, codomain, and what a technique changes (3 problems · doesn’t affect your progress)
For a resize operation that shrinks a 100\times 100 image to 50\times 50, does it change the domain, the codomain, both, or neither?
AI grading isn't configured on this deployment.
Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.
First mistake
Correct answer
Also accepted:
Why
Why
The domain -- the coordinate grid shrinks -- while the codomain (legal pixel values) stays \{0,\dots,255\}.
For a color-to-grayscale conversion, does it change the domain, the codomain, both, or neither?
AI grading isn't configured on this deployment.
Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.
First mistake
Correct answer
Also accepted:
Why
Why
The codomain -- each pixel now takes one value in \{0,\dots,255\} instead of a triple in \{0,\dots,255\}^3 -- while every coordinate stays valid (same domain).
Give an example of a photo edit that leaves both the domain and the codomain of the image function untouched, changing only the stored values.
AI grading isn't configured on this deployment.
Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.
First mistake
Correct answer
Also accepted:
Why
Why
Brightening every pixel by a fixed amount (with clamping to stay in range) is a clean example -- same coordinates, same legal value range, only the stored numbers change.