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

Part B2 of the Geomatics paper names data quantisation, resampling techniques, spatial enhancement and unsupervised classification, and Part A names the components of GNSS, DBMS and the creation of databases; the earlier chapters describe these in words. An 8-bit image has 256 grey levels and a 1024 × 1024 three-band scene occupies 3 MB; bilinear resampling of four neighbouring pixels at (0.3, 0.6) gives 28.6 where nearest-neighbour keeps 30; a linear stretch from 60–180 maps DN 100 to 85; a 3 × 3 mean filter smears a single bright pixel of 90 on a background of 10 down to 18.9; the NDVI of red 0.08 and near-infrared 0.45 is 0.70; and a PDOP of 2.5 with a 5 m range error gives 12.5 m of position error.
Overview

Quantisation, Storage and Resampling

1 min read

An image is sampled in space (pixels) and quantised in intensity: b bits give 2ᵇ levels. An 8-bit band has 256 digital numbers (0–255), a 11-bit sensor 2048; each extra bit halves the quantisation step, and the quantisation noise of a uniform quantiser is Δ/√12. Storage = rows × columns × bands × bits/8: 1024 × 1024 × 3 × 1 byte = 3 MB. By the sampling theorem a ground feature of size d needs a pixel (GSD) of at most d/2 to be resolved. Resampling computes new pixel values when an image is rotated, scaled or georeferenced. Nearest neighbour copies the closest input pixel: fast, no new values (suits classification) but blocky and up to half a pixel in error. Bilinear weights the four neighbours: v = v₀₀(1 − x)(1 − y) + v₁₀x(1 − y) + v₀₁(1 − x)y + v₁₁xy; for v₀₀ = 10, v₁₀ = 20, v₀₁ = 30, v₁₁ = 60 at (x, y) = (0.3, 0.6): 2.8 + 2.4 + 12.6 + 10.8 = 28.6, whereas nearest neighbour picks the pixel (0, 1) and returns 30; bilinear smooths and alters the radiometry. Cubic convolution uses 16 neighbours, the sharpest and slowest.

MethodNeighboursResult at (0.3, 0.6)
Nearest neighbour130
Bilinear428.6
Cubic convolution16Sharpest, slowest

An image is sampled in space (pixels) and quantised in intensity: b bits give 2ᵇ levels. An 8-bit band has 256 digital numbers (0–255), a 11-bit sensor 2048; each extra bit halves the…

Contrast Stretch, Spatial Filters and Histogram Equalisation

1 min read · 1 part

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.

OperationRuleResult
Stretch DN 100, 60–180(DN − min)·255/(max − min)85
3 × 3 mean at the spikeaverage of 918.9
3 × 3 medianmiddle value10
Laplacian at the spike4c − 4 neighbours320

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

1 min read · 1 part

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.

Stepk-means on 2, 3, 4, 10, 11, 12, 25Result
Start centres2 and 25Arbitrary
Cluster 1 mean2, 3, 4, 10, 11, 127
Cluster 2 mean2525
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

2 min read · 2 parts

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.

QuantityValueNote
GPS orbital period11.97 hSemi-major axis 26 560 km
1 µs clock error300 mc × 10⁻⁶
PDOP 2.5, σ 5 m12.5 mDOP × σ
Key of R(A,B,C,D)ADA → B → C
🎯 NDVI and positional error, computed
NDVI = (NIR − Red)/(NIR + Red): reflectances of 0.5 in the near infrared and 0.1 in the red give 0.4/0.6 = 0.67, typical of dense healthy vegetation, while bare soil is near 0.1 and water is negative. A GNSS position error is about DOP × UERE: a user-equivalent range error of 5 m with PDOP 2 gives about 10 m, so a poor satellite geometry magnifies every range error. An 8-bit image has 2⁸ = 256 grey levels, and a linear contrast stretch maps the used range [min, max] onto [0, 255].

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.

  1. 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.
  2. Which resampling method is preferred before a thematic classification because it does not create new pixel values?

    1. Bilinear interpolation
    2. Nearest neighbour
    3. Cubic convolution
    4. Gaussian smoothing
    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.
  3. 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
  1. 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.
  2. Which filter is best for removing isolated salt-and-pepper noise while preserving edges?

    1. A contrast stretch
    2. The median filter
    3. The mean filter
    4. The Laplacian filter
    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.
  3. 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.
  4. Why is k-means clustering of the values 2, 3, 4, 10, 11, 12, 25 with starting centres 2 and 25 a poor classification?

    1. The outlier 25 keeps a cluster to itself and merges the two real groups
    2. The algorithm never converges
    3. k-means cannot handle one band
    4. Euclidean distance is invalid
    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.
  5. 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.
  6. 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.
  7. Why does a GNSS receiver need four satellites rather than three?

    1. There are four unknowns: x, y, z and the receiver clock bias
    2. The fourth removes ionospheric delay
    3. Three satellites cannot see the receiver
    4. Each satellite gives only one coordinate
    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).
  8. For R(A, B, C, D) with functional dependencies A → B and B → C, which statements are correct?

    1. The closure of A is {A, B, C}
    2. AD is a candidate key
    3. B → C violates BCNF because B is not a superkey
    4. A alone is a candidate key
    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.
  9. 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.
  10. The main purpose of a contrast stretch is to

    1. remove geometric distortion
    2. spread the occupied DN range over more of the available display range
    3. classify pixels into land-cover types
    4. reduce the file size
    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.
  11. For open water, the NDVI = (NIR − Red)/(NIR + Red) is usually

    1. close to +1
    2. exactly zero
    3. negative
    4. greater than 1
    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.
  12. In SQL, the statement used to retrieve rows from a table is

    1. INSERT
    2. DROP
    3. UPDATE
    4. SELECT
    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.
  13. 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.
  14. 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.
  15. 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.
  16. 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.
  17. 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.
  18. 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.
  19. 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.
  20. 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.
  21. Which statements about contrast enhancement are correct?

    1. A stretch increases the number of distinct DN values in an image.
    2. Histogram equalisation aims at an approximately uniform output histogram.
    3. Clipping in a saturation stretch maps extreme DNs to 0 or 255.
    4. A linear stretch preserves the rank order of DNs.
    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.