Data Quantization and Processing: Sampling, Quantization, Linear Systems and Convolution
2. Quantization
Quantization maps each sampled value to one of a finite set of integers, the digital numbers (DN). With n bits there are 2ⁿ levels, DN = 0 … 2ⁿ − 1: 8 bits give 256, 10 bits 1024, 11 bits 2048, 12 bits 4096. Over an input range R the quantization step is Δ = R/2ⁿ; a radiance range of 30.72 units quantised to 10 bits has Δ = 0.03. Rounding to the nearest level leaves a quantization error between −Δ/2 and +Δ/2; modelled as uniform, its RMS value is Δ/√12. For a full-scale sinusoidal signal the ideal signal-to-quantization-noise ratio is about 6.02n + 1.76 dB — each extra bit adds about 6 dB. Too few levels give false contouring: smooth gradients break into visible bands.
| Aspect | Sampling | Quantization |
|---|---|---|
| Discretises | position (x, y) or time | amplitude (brightness) |
| Governs | spatial resolution | radiometric resolution |
| Too coarse gives | aliasing, moiré, lost detail | false contours, lost subtle differences |
Quantization maps each sampled value to one of a finite set of integers, the digital numbers (DN). With n bits there are 2ⁿ levels, DN = 0 … 2ⁿ − 1: 8 bits give 256, 10 bits 1024, 11 bits…
3. The principle of linear systems
A system T that turns an input f into an output g = T[f] is linear if it obeys superposition: additivity T[f₁ + f₂] = T[f₁] + T[f₂] and homogeneity T[a f] = a T[f]. It is shift-invariant (space-invariant) if shifting the input shifts the output by the same amount and changes nothing else. A linear shift-invariant (LSI) system is completely described by its impulse response h — the output for a single point of light, which in imaging is the point spread function (PSF): because any image is a sum of shifted, scaled impulses, the output is the same sum of shifted, scaled PSFs, which is exactly convolution, g = f ∗ h. The Fourier transform of the PSF is the system's transfer function; its magnitude is the modulation transfer function (MTF), which says how much contrast survives at each spatial frequency.
| Operation | Linear? | Why |
|---|---|---|
| Mean (box) filter, Gaussian blur, Laplacian, Sobel | yes, and shift-invariant | weighted sums with fixed weights |
| Median filter | no | the median of a sum is not the sum of the medians |
| g = 2f + 3 (gain and offset) | no (affine) | doubling f does not double g; zero input gives 3 |
| Squaring, thresholding, histogram equalisation | no | fail additivity |
A system T that turns an input f into an output g = T[f] is linear if it obeys superposition: additivity T[f₁ + f₂] = T[f₁] + T[f₂] and homogeneity T[a f] = a T[f]. It is shift-invariant…
4. Convolution
Discrete convolution in one dimension: y[n] = Σₖ x[k] h[n − k]. For x = [1, 2, 3] and h = [1, 1], y = [1, 3, 5, 3]: the output has length N + M − 1 = 3 + 2 − 1 = 4, and the sum of the output (12) equals the product of the input sums (6 × 2). In two dimensions, g(i, j) = Σₘ Σₙ f(i − m, j − n) h(m, n): the kernel is flipped in both directions and slid over the image, and at each position the overlapping values are multiplied and summed. Correlation is the same without the flip; for a symmetric kernel (mean, Gaussian, Laplacian) the two are identical, but for an antisymmetric kernel such as a Sobel gradient they give outputs of opposite sign. Border pixels need a rule — zero padding, replication or reflection — or are left undefined.
- Cost: an M × M kernel on an N × N image needs about N²M² multiplications — 9 × 10⁶ for a 3 × 3 kernel on a 1000 × 1000 image. A separable kernel (an outer product of two 1D kernels, like the box or Gaussian) can be applied as two 1D passes, 2M instead of M² operations per pixel.
- Convolution theorem: convolution in the spatial domain is multiplication in the frequency domain, F{f ∗ h} = F{f}·F{h}. Large kernels are therefore applied faster through the FFT, and filters are designed by the frequencies they pass: low-pass smooths, high-pass sharpens.
- Convolution is commutative, associative and distributive over addition: two filters in sequence equal one filter whose kernel is their convolution.
Discrete convolution in one dimension: y[n] = Σₖ x[k] h[n − k]. For x = [1, 2, 3] and h = [1, 1], y = [1, 3, 5, 3]: the output has length N + M − 1 = 3 + 2 − 1 = 4, and the sum of the…
Key takeaways
- Sampling theorem: sample at least twice the highest frequency (pixel ≤ half the finest period); under-sampling aliases a frequency f to |f − k f_s|, seen as moiré.
- n bits give 2ⁿ levels; step Δ = R/2ⁿ; RMS quantization error Δ/√12; SNR ≈ 6.02n + 1.76 dB.
- Linear = additive and homogeneous; LSI systems are described completely by the impulse response (PSF), and act by convolution.
- Convolution flips the kernel (correlation does not); output length N + M − 1; output sum = input sum × kernel sum.
- Convolution theorem: spatial convolution = frequency-domain multiplication; separable kernels cost 2M instead of M² per pixel.
Practice questions (24)
Attempt each one before opening the answer. Every explanation names the tempting wrong option as well as the right one, because that is where marks are lost.
The finest periodic pattern in a scene repeats every 10 m on the ground. The largest pixel size, in metres, that satisfies the sampling theorem is ____.
Numerical answer — type the value.
Show answer
Answer: 5
The sampling interval must be at most half the shortest period: 10/2 = 5 m, i.e. at least two samples per cycle. A 10 m pixel samples once per cycle and can average the pattern away completely.A 10 Hz sinusoid is sampled at 12 samples per second. The apparent (aliased) frequency in the samples, in Hz, is ____.
Numerical answer — type the value.
Show answer
Answer: 2
The Nyquist frequency is 12/2 = 6 Hz, below 10 Hz, so the signal aliases to |f − f_s| = |10 − 12| = 2 Hz. At 20 or more samples per second the 10 Hz signal would be recorded correctly.A radiance range of 0 to 30.72 units is quantised with 10 bits. The quantization step, in radiance units, is ____.
Numerical answer — type the value.
Show answer
Answer: 0.03
10 bits give 2¹⁰ = 1024 levels; Δ = 30.72/1024 = 0.03 units. Dividing by 1023 (the maximum DN) gives 0.03003, a negligible difference here, but the level count is 2ⁿ.
Show the other 21 questions
For the same quantizer (step 0.03 units), treating the rounding error as uniformly distributed, the RMS quantization error, in radiance units (to four decimal places), is ____.
Numerical answer — type the value.
Show answer
Answer: 0.0087
A uniform error on (−Δ/2, +Δ/2) has variance Δ²/12, so the RMS error is Δ/√12 = 0.03/3.4641 = 0.00866 ≈ 0.0087. The maximum error is Δ/2 = 0.015; the RMS is smaller because most errors are not at the extreme.Using SNR ≈ 6.02n + 1.76 dB for a full-scale sinusoid, the ideal signal-to-quantization-noise ratio of an 8-bit quantizer, in dB (to two decimal places), is ____.
Numerical answer — type the value.
Show answer
Answer: 49.92
6.02 × 8 + 1.76 = 48.16 + 1.76 = 49.92 dB. Each extra bit adds 6.02 dB, i.e. halves the quantization noise amplitude.Which of the following image operations is NOT linear?
Show answer
Answer: A — Median filtering
The median is a rank (order) statistic: the median of the sum of two images is not in general the sum of their medians, so superposition fails. The mean, Gaussian and Laplacian are fixed weighted sums and are linear and shift-invariant.A linear shift-invariant imaging system is completely characterised by its
Show answer
Answer: A — impulse response (point spread function)
Any input is a superposition of shifted, weighted impulses; linearity and shift invariance make the output the same superposition of shifted, weighted impulse responses, i.e. input ∗ PSF. The histogram and bit depth describe the data, not the system.The sequence x = [1, 2, 3] is convolved with h = [1, 1]. The third element of the output y (y[2], counting from y[0]) is ____.
Numerical answer — type the value.
Show answer
Answer: 5
y[n] = Σ x[k]h[n − k]: y[0] = 1, y[1] = 2 + 1 = 3, y[2] = 3 + 2 = 5, y[3] = 3. So y = [1, 3, 5, 3], of length 3 + 2 − 1 = 4, and its sum 12 = 6 × 2 checks the result.A signal of 100 samples is convolved with a 5-tap filter using full convolution. The number of output samples is ____.
Numerical answer — type the value.
Show answer
Answer: 104
Full convolution has length N + M − 1 = 100 + 5 − 1 = 104. Keeping only positions where the kernel fully overlaps gives N − M + 1 = 96, and “same” mode keeps 100.A separable 5 × 5 Gaussian kernel is applied to an image as two 1D passes instead of one 2D pass. The number of multiplications per pixel with the separable form is ____.
Numerical answer — type the value.
Show answer
Answer: 10
A 5-tap row pass and a 5-tap column pass cost 5 + 5 = 10 multiplications per pixel, against 5 × 5 = 25 for the direct 2D kernel. The saving grows with kernel size: 2M against M².By the convolution theorem, convolving an image with a kernel in the spatial domain is equivalent, in the frequency domain, to
Show answer
Answer: A — multiplying their Fourier transforms
F{f ∗ h} = F{f}·F{h}: each frequency of the image is scaled by the filter's response at that frequency. Division is the idea behind inverse filtering (deconvolution); convolution in frequency corresponds to multiplication in space.Which of the following statements about convolution and correlation of images are correct?
Show answer
Answer: A — Convolution flips the kernel before sliding it; correlation does not; B — For a symmetric kernel, convolution and correlation give the same result; C — Convolution is commutative
The flip is the definition of convolution; a symmetric kernel is unchanged by the flip, so the two agree; and f ∗ h = h ∗ f. A Sobel kernel is antisymmetric, so flipping it negates it and the two operations give opposite signs — the magnitude is the same, the direction reversed.Which of the following statements about sampling and quantization are correct?
Show answer
Answer: A — Sampling discretises position; quantization discretises brightness; B — Too few quantization levels produce false contouring; C — Aliasing introduced at sampling cannot be removed afterwards by filtering the digital image
Sampling sets the grid, quantization the grey scale; too few levels band smooth gradients; and once a high frequency has been folded onto a low one it is indistinguishable from a real low frequency, so no later filter can separate them. Adding a bit doubles the number of levels (2ⁿ⁺¹ = 2 × 2ⁿ).Which of the following systems, mapping an input image f to an output g, are linear?
Show answer
Answer: A — g(i, j) = f(i, j) − f(i, j − 1); B — g = 0.5 f; C — g(i, j) = the mean of the 3 × 3 neighbourhood of f
A difference of pixels, a scaling and a neighbourhood mean are all fixed weighted sums of input values, so they satisfy additivity and homogeneity. g = 2f + 3 fails both: a zero input gives 3, and doubling f does not double g — it is affine, not linear.A 12-bit quantiser provides how many grey levels? ____
Numerical answer — type the value.
Show answer
Answer: 4096
2¹² = 4096 levels. Answering 12 counts bits, and 4095 is the largest DN, not the number of levels. Substituting the answer back into the relation confirms it.A profile is sampled 4 times per metre. The sampling interval, in m (two decimals), is ____.
Numerical answer — type the value.
Show answer
Answer: 0.25
Interval = 1/frequency = 1/4 = 0.25 m. Answering 4 confuses the sampling rate with the interval. Substituting the answer back into the relation confirms it.Convolving an image with a unit impulse (a kernel that is 1 at the centre and 0 elsewhere)
Show answer
Answer: C — leaves the image unchanged
The impulse is the identity of convolution: f * δ = f. Blurring needs weights spread over neighbours, and edge detection needs weights that sum to zero.A signal of 100 samples is filtered with a 5-tap kernel, keeping only "valid" positions where the kernel lies wholly inside the signal. The output length is ____.
Numerical answer — type the value.
Show answer
Answer: 96
Valid positions number N − M + 1 = 96. Full convolution would give N + M − 1 = 104, the other common convention.A radiance range of 0 to 25.5 units is quantised with 8 bits (256 levels, step = range/256). The quantisation step, in radiance units (four decimals), is ____.
Numerical answer — type the value.
Show answer
Answer: 0.0996
Δ = 25.5/256 = 0.0996 units. Dividing by 8 (the bit count) gives 3.1875, confusing bits with levels; the alternative convention range/255 gives exactly 0.1.Using SQNR ≈ 6.02n + 1.76 dB for a full-scale sinusoid, the least number of bits n giving at least 60 dB is ____.
Numerical answer — type the value.
Show answer
Answer: 10
(60 − 1.76)/6.02 = 9.67, so n = 10 (giving 61.96 dB); 9 bits give only 55.94 dB. Rounding 9.67 down to 9 misses the requirement.The sequence [1, 2] is convolved with [1, −1] (full convolution). The last output element is ____.
Numerical answer — type the value.
Show answer
Answer: -2
y = [1, 2 − 1, −2] = [1, 1, −2], so the last element is −2: the differencing filter marks the drop at the end. Answering 2 drops the minus sign of the kernel.A 3 × 3 kernel of all ones (not normalised) is applied to a region where every DN is 5. The output at an interior pixel is ____.
Numerical answer — type the value.
Show answer
Answer: 45
The output is the sum of nine 5s = 45; dividing by 9 (the box-filter normalisation) would return 5. Answering 5 assumes normalisation that the kernel does not have.An image has 5 m pixels. The highest spatial frequency it can represent without aliasing (the Nyquist frequency), in cycles per metre (one decimal), is ____.
Numerical answer — type the value.
Show answer
Answer: 0.1
Sampling rate = 1/5 = 0.2 samples/m, and the Nyquist frequency is half of that, 0.1 cycles/m (a period of 10 m). Answering 0.2 quotes the sampling rate itself.Two Gaussian blurs with standard deviations 3 pixels and 4 pixels are applied one after the other. The single equivalent Gaussian has standard deviation, in pixels, ____.
Numerical answer — type the value.
Show answer
Answer: 5
Convolving Gaussians adds their variances: σ² = 9 + 16 = 25, so σ = 5. Adding the standard deviations (7) is the tempting but wrong rule.