Image Processing and Positioning in Numbers: Quantisation and Resampling, Contrast Stretch, Filters and Histogram Equalisation, k-Means and NDVI, GNSS Dilution of Precision and Database Keys
Contrast Stretch, Spatial Filters and Histogram Equalisation
Linear contrast stretch maps the occupied range [min, max] onto 0–255: DN′ = (DN − min) × 255/(max − min). With min = 60 and max = 180, DN = 100 maps to (100 − 60) × 255/120 = 85. Spatial filters convolve a 3 × 3 window. A mean (low-pass) filter averages: on a background of 10 with one pixel of 90 at the centre, the centre becomes (8 × 10 + 90)/9 = 18.9 — noise is smoothed but edges blur. A median filter returns 10, deleting the spike and keeping edges, best for salt-and-pepper noise. The Laplacian (high-pass) kernel [0 −1 0; −1 4 −1; 0 −1 0] gives 4 × 90 − 4 × 10 = 320 at the spike: it highlights discontinuities and, added to the original, sharpens the image. Histogram equalisation redistributes DNs so that the cumulative histogram becomes linear: new level = round((L − 1) × CDF). For a 3-bit image with counts 0, 5, 10, 20, 30, 20, 10, 5 over levels 0–7 (N = 100), the CDF is 0, 0.05, 0.15, 0.35, 0.65, 0.85, 0.95, 1.00 and the new levels are 0, 0, 1, 2, 5, 6, 7, 7: crowded levels 3–5 spread out, rare levels merge.
| Operation | Rule | Result |
|---|---|---|
| Stretch DN 100, 60–180 | (DN − min)·255/(max − min) | 85 |
| 3 × 3 mean at the spike | average of 9 | 18.9 |
| 3 × 3 median | middle value | 10 |
| Laplacian at the spike | 4c − 4 neighbours | 320 |
Linear contrast stretch maps the occupied range [min, max] onto 0–255: DN′ = (DN − min) × 255/(max − min). With min = 60 and max = 180, DN = 100 maps to (100 − 60) × 255/120 = 85. Spatial…
Unsupervised Classification and Spectral Indices
Unsupervised classification groups pixels by spectral similarity with no training data. k-means picks k cluster centres, assigns each pixel to the nearest centre (Euclidean distance in band space), recomputes each centre as the mean of its members and repeats until the assignments stop changing. For the one-band pixel values 2, 3, 4, 10, 11, 12, 25 with k = 2 and starting centres 2 and 25: iteration 1 puts 2, 3, 4, 10, 11, 12 with the first centre (mean 7) and 25 alone (mean 25); the assignment does not change, so it has converged — the outlier takes a cluster of its own and the two real groups merge, a reminder that k-means is sensitive to starting centres and outliers. ISODATA adds splitting and merging of clusters by variance and separation thresholds, so k need not be fixed in advance. The analyst then labels the spectral classes using ground truth. Spectral indices combine bands: NDVI = (NIR − Red)/(NIR + Red); for healthy vegetation (red 0.08, NIR 0.45) NDVI = 0.37/0.53 = 0.70, for bare soil about 0.1–0.2 and for water below 0. The index lies in [−1, 1] and cancels common illumination changes because it is a ratio.
| Step | k-means on 2, 3, 4, 10, 11, 12, 25 | Result |
|---|---|---|
| Start centres | 2 and 25 | Arbitrary |
| Cluster 1 mean | 2, 3, 4, 10, 11, 12 | 7 |
| Cluster 2 mean | 25 | 25 |
| NDVI, healthy leaf | (0.45 − 0.08)/(0.45 + 0.08) | 0.70 |
Unsupervised classification groups pixels by spectral similarity with no training data. k-means picks k cluster centres, assigns each pixel to the nearest centre (Euclidean distance in band…
GNSS Accuracy and Database Keys
GNSS components: the space segment (GPS: 24+ satellites in six planes at 20 200 km altitude, orbital period 11 h 58 min — here 11.97 h from Kepler's law with a = 26 560 km), the control segment (monitor and master stations updating clocks and ephemeris) and the user segment (receivers). A receiver measures pseudoranges ρ = c Δt to at least four satellites to solve (x, y, z) and its own clock bias; the signal takes about 67 ms from directly overhead, and a 1 µs clock error is 300 m, which is why satellites carry atomic clocks and receivers solve for the bias. L1 is 1575.42 MHz (λ = 19.03 cm). Dilution of precision scales the range error: position error ≈ DOP × σ_UERE; PDOP = 2.5 with σ = 5 m gives 12.5 m, and good geometry (satellites well spread, PDOP < 3) matters as much as signal quality; DGPS/RTK cut the error by cancelling common errors with a base station. Databases: a relational table is keyed by a candidate key — a minimal attribute set whose closure is all attributes. For R(A, B, C, D) with A → B and B → C, the closure of A is {A, B, C} (not D), but the closure of AD is {A, B, C, D}, so AD is the key; B → C violates 3NF/BCNF with a non-key determinant, so decompose into R₁(B, C) and R₂(A, B, D). Spatial databases index with R-trees or quadtrees for window queries.
| Quantity | Value | Note |
|---|---|---|
| GPS orbital period | 11.97 h | Semi-major axis 26 560 km |
| 1 µs clock error | 300 m | c × 10⁻⁶ |
| PDOP 2.5, σ 5 m | 12.5 m | DOP × σ |
| Key of R(A,B,C,D) | AD | A → B → C |
GNSS components: the space segment (GPS: 24+ satellites in six planes at 20 200 km altitude, orbital period 11 h 58 min — here 11.97 h from Kepler's law with a = 26 560 km), the control…
Key takeaways
- Quantisation: b bits give 2ᵇ levels; nearest neighbour keeps values, bilinear uses four pixels and smooths, cubic convolution uses sixteen.
- Linear stretch (DN − min)·255/(max − min); mean filters blur, median removes spikes, Laplacian sharpens; equalisation uses the CDF.
- k-means iterates assign-and-average and is sensitive to start centres and outliers; NDVI = (NIR − Red)/(NIR + Red).
- GNSS needs four satellites for position and clock bias; position error ≈ DOP × range error; 1 µs of clock error is about 300 m.
- A candidate key is a minimal attribute set whose closure is the whole relation; a non-key determinant breaks BCNF.
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.
Four pixel values are v₀₀ = 10, v₁₀ = 20, v₀₁ = 30 and v₁₁ = 60. The bilinear interpolated value at (x, y) = (0.3, 0.6) (one decimal) is:
Numerical answer — type the value.
Show answer
Answer: 28.6
v = 10(0.7)(0.4) + 20(0.3)(0.4) + 30(0.7)(0.6) + 60(0.3)(0.6) = 2.8 + 2.4 + 12.6 + 10.8 = 28.6. Nearest neighbour would return 30.Which resampling method is preferred before a thematic classification because it does not create new pixel values?
Show answer
Answer: B — Nearest neighbour
Nearest neighbour copies existing DNs, so the radiometry and class signatures are preserved; bilinear and cubic convolution average neighbours and invent intermediate values.An image occupies DNs 60 to 180. After a linear stretch to 0–255, the output DN for an input of 100 is:
Numerical answer — type the value.
Show answer
Answer: 85
(100 − 60) × 255/(180 − 60) = 40 × 2.125 = 85. The gain is 255/120 = 2.125.
Show the other 21 questions
A 3 × 3 window has eight pixels of value 10 and a centre pixel of 90. The output of a mean filter at the centre (one decimal) is:
Numerical answer — type the value.
Show answer
Answer: 18.9
(8 × 10 + 90)/9 = 170/9 = 18.9. The median filter would give 10 and remove the spike entirely.Which filter is best for removing isolated salt-and-pepper noise while preserving edges?
Show answer
Answer: B — The median filter
The median discards extreme values, so single bad pixels vanish without blurring edges; the mean spreads them, the Laplacian amplifies them, and a stretch is not a spatial filter.A 3-bit image has counts 0, 5, 10, 20, 30, 20, 10, 5 at levels 0 to 7 (100 pixels). After histogram equalisation, the new level of the original level 4 is (round((L − 1) × CDF)):
Numerical answer — type the value.
Show answer
Answer: 5
CDF at level 4 = (0 + 5 + 10 + 20 + 30)/100 = 0.65; 0.65 × 7 = 4.55, rounded to 5. Levels 3 to 5 are spread out because they hold most pixels.Why is k-means clustering of the values 2, 3, 4, 10, 11, 12, 25 with starting centres 2 and 25 a poor classification?
Show answer
Answer: A — The outlier 25 keeps a cluster to itself and merges the two real groups
The result is centres 7 and 25: the distance rule assigns 10–12 to the first centre. The method converges (to a local optimum) but is sensitive to initial centres and outliers; ISODATA or better seeds fix this.The NDVI of a pixel with red reflectance 0.08 and near-infrared reflectance 0.45 (two decimals) is:
Numerical answer — type the value.
Show answer
Answer: 0.70
NDVI = (0.45 − 0.08)/(0.45 + 0.08) = 0.37/0.53 = 0.70. Dividing by the sum is what makes it insensitive to illumination.A GNSS solution has PDOP = 2.5 and user equivalent range error 5 m. The expected 3-D position error in metres (one decimal) is:
Numerical answer — type the value.
Show answer
Answer: 12.5
Position error ≈ PDOP × σ_UERE = 2.5 × 5 = 12.5 m. Poor geometry multiplies the range error.Why does a GNSS receiver need four satellites rather than three?
Show answer
Answer: A — There are four unknowns: x, y, z and the receiver clock bias
Each pseudorange is one equation; the receiver clock is not atomic, so its error is a fourth unknown, and one more satellite is needed (a 1 µs error would be 300 m).For R(A, B, C, D) with functional dependencies A → B and B → C, which statements are correct?
Show answer
Answer: A — The closure of A is {A, B, C}; B — AD is a candidate key; C — B → C violates BCNF because B is not a superkey
A alone determines B and C but not D, so it is not a key; AD determines everything and is minimal. B → C has a non-superkey determinant, which violates BCNF.A sensor quantises each pixel with 10 bits. The number of possible DN levels is ____.
Numerical answer — type the value.
Show answer
Answer: 1024
2¹⁰ = 1024 levels (DN 0 to 1023). Answering 1023 gives the largest DN, not the count of levels. Substituting the answer back into the relation confirms it.The main purpose of a contrast stretch is to
Show answer
Answer: B — spread the occupied DN range over more of the available display range
A stretch remaps DNs so small differences become visible; it changes display, not geometry or information content. It does not add classes or reduce storage.For open water, the NDVI = (NIR − Red)/(NIR + Red) is usually
Show answer
Answer: C — negative
Water reflects more red than NIR, so the numerator is negative. Values near +1 belong to dense healthy vegetation, and NDVI can never exceed 1.In SQL, the statement used to retrieve rows from a table is
Show answer
Answer: D — SELECT
SELECT … FROM … WHERE … queries data without changing it. INSERT adds rows, UPDATE modifies them and DROP deletes a whole table, so picking any of them for a query would alter the database.Input pixels have v₀₀ = 10, v₁₀ = 20, v₀₁ = 30 and v₁₁ = 60 at (x, y) = (0, 0), (1, 0), (0, 1), (1, 1). By nearest-neighbour resampling, the value at (0.6, 0.3) is ____.
Numerical answer — type the value.
Show answer
Answer: 20
(0.6, 0.3) is nearest to (1, 0), so the output is v₁₀ = 20, an original value. Bilinear interpolation would give 0.4·0.7·10 + 0.6·0.7·20 + 0.4·0.3·30 + 0.6·0.3·60 = 25.6, a new value nearest neighbour never creates.In histogram equalisation of an 8-bit image, a DN whose cumulative frequency is 0.6 maps to round(255 × 0.6) = ____.
Numerical answer — type the value.
Show answer
Answer: 153
255 × 0.6 = 153. Using the plain histogram count instead of the cumulative frequency would not spread the levels; the CDF is what makes the output roughly uniform.Values 1, 2, 9 and 10 are clustered by k-means with initial centres 1 and 10. The converged lower centre (one decimal) is ____.
Numerical answer — type the value.
Show answer
Answer: 1.5
Assignment gives {1, 2} and {9, 10}; the means 1.5 and 9.5 do not change the assignment, so the lower centre is 1.5. Leaving it at 1 skips the update step.A GNSS receiver has HDOP = 1.2 and user equivalent range error 5 m. The expected horizontal position error, in m (one decimal), is ____.
Numerical answer — type the value.
Show answer
Answer: 6.0
σ_H ≈ HDOP × UERE = 1.2 × 5 = 6.0 m. Adding them (6.2) has no meaning; DOP is a multiplier on range error. Substituting the answer back into the relation confirms it.For the same four input pixels (10, 20, 30, 60 at the unit-square corners), bilinear interpolation at the centre (0.5, 0.5) gives ____.
Numerical answer — type the value.
Show answer
Answer: 30
At the centre every corner has weight 0.25, so the value is (10 + 20 + 30 + 60)/4 = 30. Interpolating along one edge only (15 or 45) ignores the second direction.The Gaussian kernel [1 2 1; 2 4 2; 1 2 1]/16 is centred on a single bright pixel of DN 16 in an otherwise zero image. The output at that pixel is ____.
Numerical answer — type the value.
Show answer
Answer: 4
Only the centre weight 4/16 meets the bright pixel: 16 × 4/16 = 4; the remaining 12 units spread to the neighbours, preserving the total. Answering 16 assumes the filter leaves isolated spikes untouched.A pixel has DNs (30, 50) in two bands and a cluster centre is at (20, 40). The Euclidean distance between them (three decimals) is ____.
Numerical answer — type the value.
Show answer
Answer: 14.142
d = √(10² + 10²) = 14.142. Adding the band differences (20) gives the city-block distance, which ranks clusters differently in some cases.In R(A, B, C, D) with functional dependencies A → B and B → C, the closure {B}⁺ contains how many attributes? ____
Numerical answer — type the value.
Show answer
Answer: 2
{B}⁺ = {B, C}: B gives C, and nothing further follows from {B, C}, so 2 attributes. Answering 3 adds A, but A → B does not let B determine A.Which statements about contrast enhancement are correct?
Show answer
Answer: B — Histogram equalisation aims at an approximately uniform output histogram.; C — Clipping in a saturation stretch maps extreme DNs to 0 or 255.; D — A linear stretch preserves the rank order of DNs.
A monotone map keeps order, equalisation flattens the CDF, and clipping saturates the tails. A stretch only relabels existing levels (and may merge some), so it cannot create more distinct values than the input had.