Before any processing, a continuous scene has to become numbers. It is sampled onto a grid of positions, and each sample is quantized to a limited set of values. This first lab looks at what that costs, how to estimate values between the grid points, and what it means for two pixels to be neighbours. It then adds colour: the models used to describe it, and what changes when you process three channels instead of one. It follows Chapters 2 and 6 of Gonzalez & Woods.
Gonzalez & Woods, 4th ed. §2.4: Basic Concepts in Sampling and Quantization (p. 63), Representing Digital Images (p. 65), Spatial and Intensity Resolution (p. 71), eqs. 2-11 to 2-13
Two separate decisions turn a scene into an image. Sampling decides how many positions you measure. Quantization decides how many values each measurement can take. Lower either one and watch what breaks. Too few samples and fine patterns turn into false, coarser patterns, which is called aliasing. Too few levels and smooth shading splits into visible bands, called false contours.
A k-bit image has L = 2k intensity levels (eq. 2-11), and storing it takes b = MNk bits (eq. 2-12). Here the image is sampled at every s-th pixel in each direction, then enlarged back by pixel replication so you can compare it at the same size. The row profile below shows both steps at once: sampling turns the curve into steps along the x axis, and quantization turns it into steps along the value axis.
Gonzalez & Woods, 4th ed. §2.4: Image Interpolation (p. 77), eqs. 2-17 and 2-18
Enlarging an image, rotating it or correcting its geometry all need values at positions between the original samples. Here the image is shrunk by a factor, then enlarged back to full size, and compared with the original. Nearest neighbour copies the closest sample. Bilinear blends the four nearest samples. Bicubic fits a smooth surface through the nearest sixteen.
The book writes bilinear as v(x, y) = ax + by + cxy + d (eq. 2-17), with the four coefficients fixed by the four neighbours. That is the same as blending the neighbours with weights (1 − Δx)(1 − Δy) and so on. Bicubic (eq. 2-18) uses sixteen coefficients from sixteen neighbours. It is computed here with the standard cubic-convolution kernel (a = −0.5), one common way to set those coefficients.
Gonzalez & Woods, 4th ed. §2.5: Neighbors of a Pixel (p. 79), Adjacency, Connectivity, Regions, and Boundaries (p. 79), Distance Measures (p. 82), eqs. 2-19 to 2-21
A pixel p has four horizontal and vertical neighbours, N4(p), and four diagonal ones, ND(p). Together they make N8(p). Choosing between 4- and 8-adjacency decides how many objects an image contains, and every labelling, flood fill and region-growing step in labs 06 and 07 depended on that choice. Paint on the grid, then choose Pick p and click a cell.
These are the Euclidean, city-block and chessboard distances (eqs. 2-19 to 2-21). The cells are shaded by their distance from p, so each metric draws its own shape: a circle for De, a diamond for D4, a square for D8. D4 counts the steps of a 4-connected path and D8 the steps of an 8-connected one.
Gonzalez & Woods, 4th ed. §6.2: The RGB Color Model (p. 407), The CMY and CMYK Color Models (p. 408), The HSI Color Model (p. 411), eqs. 6-5 to 6-30
The same colour can be described in several ways. RGB describes how a screen mixes light, and CMY(K) how a printer mixes ink. HSI separates what a person would call the colour (hue), how vivid it is (saturation) and how bright it is (intensity). That separation is why HSI suits image processing: you can change brightness without touching the hue. Each component is shown below as a grayscale image. Point at the colour image to see every conversion worked out.
Gonzalez & Woods, 4th ed. §6.3: Intensity Slicing and Color Coding (p. 420); §6.5: Color Slicing (p. 436), Histogram Processing of Color Images (p. 439), eqs. 6-43, 6-44; §6.7: Segmentation in RGB Space (p. 446), eq. 6-48
Three ways colour changes processing. Pseudocolour gives a grayscale image false colours, because the eye can tell apart far more colours than grey levels. Colour slicing keeps only the pixels close to a chosen colour. Click the image to choose it. Histogram equalization of a colour image shows why the colour model matters: equalizing R, G and B separately changes the hues, while equalizing only the intensity I does not.