Back to Image Processing

Image Reconstruction from Sparse Random Samples

5 Sampling Rates · 3 Interpolation Methods · PSNR / SSIM

Abstract

A canonical test image (Lenna, 512 × 512) is randomly sub-sampled at five rates (1 %, 2 %, 5 %, 10 %, 20 %) and reconstructed by three interpolation methods (nearest neighbour, linear, cubic) on a regular grid via scipy.interpolate.griddata. Each (rate × method) combination is scored by PSNR and SSIM. Linear interpolation outperforms cubic across all rates because the random scatter does not provide enough local structure for cubic to fit polynomials cleanly.

Method

For each rate r and method m:

  1. Sample n = ⌊r · H · W⌋ pixel locations uniformly without replacement (seed = 42 for reproducibility).
  2. For each colour channel, run griddata(coords, values, (grid_y, grid_x), method=m) to interpolate to a full-resolution grid. Out-of-hull NaNs (a corner case for cubic) are filled with the nearest-neighbour fallback.
  3. Score the reconstructed image against the ground truth: PSNR with data_range = 255, SSIM in colour mode.

Sampling Patterns

Original image alongside the five sampled-only views. Black pixels are the unsampled majority; coloured pixels are the retained samples.

Original Lenna image alongside five views showing 1, 2, 5, 10, and 20 percent random pixel samples on a black background

Reconstruction Grid (Method × Rate)

15 reconstructions, one per (method × rate) cell. Per-panel PSNR and SSIM are annotated on each title.

A grid of 15 reconstructed Lenna images, three rows for nearest, linear, and cubic interpolation, five columns for sampling rates 1 to 20 percent, with PSNR and SSIM annotated on each panel

Headline Numbers

Rate Method PSNR (dB) SSIM
1 %nearest19.950.489
1 %linear21.570.561
1 %cubic20.490.535
5 %nearest23.450.600
5 %linear25.210.675
5 %cubic24.450.643
10 %nearest24.980.662
10 %linear26.870.731
10 %cubic26.360.699
20 %nearest26.740.731
20 %linear28.880.793
20 %cubic28.550.764

PSNR and SSIM vs Sampling Rate

Both metrics scale roughly logarithmically with the sampling rate. The gap between linear and nearest is consistent at about 1.5 dB across all rates. Cubic should in principle outperform linear when the signal is smooth and the samples are dense; on this image (real photograph with edges) and at these sampling rates (very sparse), cubic over-smooths near edges and under-fits the high-frequency texture in skin and hair.

Two-panel line chart of PSNR and SSIM versus sampling rate, with three lines per panel for nearest, linear, and cubic interpolation methods