← Back to the live tool Print with PE stamp box Designed for sealed engineering submittals — print drops PE stamp + signature block at the end.

Photo-Sieve Grain Size Distribution — Worked Example

A real watershed segmentation of a coarse-sand photograph using the PE-Calc photo-sieve calculator. Output: 113 individual grains, D₁₆ = 1.21 mm, D₅₀ = 1.68 mm, D₈₄ = 2.49 mm, Folk-Ward sorting σ = 0.54 φ (moderately well sorted). Static numbers and charts on this page; click through to the live tool to run the same analysis (or upload your own photo) end-to-end in your browser.

Input photograph

A 1280 × 960 macro photograph of beach / river sand. The image was selected because it contains a representative mix of coarse sand and granule-sized grains in a single layer with reasonable contrast between grains and inter-grain shadow. Note: the photograph contains no scale reference (no coin, ruler, or card). For the example we assume a 50 mm field-of-view across the long edge — typical for a phone-camera macro shot. Under that assumption the pixel scale is 25.6 px/mm, and every reported size carries that calibration uncertainty linearly.

Coarse-sand and granule sample, 1280 × 960, top-down photograph used as the worked example
Source photograph — coarse sand and granules. 1280 × 960 px. Assumed field-of-view 50 mm.

Watershed segmentation overlay

Same image after the OpenCV.js pipeline: CLAHE local contrast → Otsu threshold → morphological cleanup → distance transform → marker-based watershed. The red lines are the watershed boundaries (label = −1 in the marker matrix). Each enclosed region is one grain whose b-axis is then measured by minimum-area bounding rectangle.

Segmentation overlay: same coarse-sand photograph with red watershed boundaries painted on, separating individual grains
Watershed boundaries painted in red. 113 grains pass the size + border filters and contribute to the distribution statistics.

Distribution statistics

Grains
113
D₅
0.92 mm
D₁₆
1.21 mm
D₅₀ (median)
1.68 mm
D₈₄
2.49 mm
D₉₀
2.51 mm
D₉₅
3.30 mm
Mean (area-wt.)
1.83 mm
Sorting σ_I
0.54 φ
Verbal sorting
Moderately well
Total area
2.26 cm²

Wentworth class breakdown

Wentworth size class distribution — by grain area and by grain count
ClassRange (mm)% area% countN
Silt / clay< 0.06250.00.00
Very fine sand0.0625 – 0.1250.00.00
Fine sand0.125 – 0.250.00.00
Medium sand0.25 – 0.50.00.00
Coarse sand0.5 – 1.07.020.423
Very coarse sand1.0 – 2.054.961.970
Granule2.0 – 4.038.117.720
Pebble4 – 640.00.00

Reading the table: 54.9% of the total grain area falls in the very-coarse-sand class (1–2 mm). The 17.7% count vs. 38.1% area in the granule class is consistent: granule-sized grains are a minority by count but contribute disproportionately to total area because area scales with d². This count-vs-area split is the photographic equivalent of the count-vs-mass split in mechanical sieving.

Cumulative grain-size distribution

X-axis is the b-axis in millimeters on a log scale. Y-axis is cumulative percent finer by area. Orange dashed lines mark the standard percentiles read off the curve.

Cumulative grain-size distribution (% finer by area vs. b-axis in mm, log scale) 0 20 40 60 80 100 0.5 0.75 1 1.5 2 3 4 D₁₆ D₅₀ D₈₄ Particle b-axis (mm) — log scale Cumulative % finer (by area)
The S-curve is sigmoidal in log space — characteristic of a single-source unimodal sediment. The relatively short coarse and fine tails support the moderately-well-sorted classification.

Phi-scale histogram

X-axis is the phi unit, φ = −log₂(d_mm). Coarse grains plot at left (negative φ), fine grains at right (positive φ). Bin widths are 0.5 φ.

Grain count histogram in φ units -2.0 3 -1.5 17 -1.0 34 -0.5 36 0.0 18 0.5 5 0 18 36 φ = −log₂(d_mm) — coarser at left Grain count
Mode at φ = −1 to 0 (1 to 2 mm). Tail toward fine end (positive φ) is short — consistent with a transport-sorted sample where finer fractions have been winnowed.

Step-by-step computation

Step 1 — Calibration

Input: assumed 50 mm field-of-view across the 1280-pixel long edge of the photograph.
px_per_mm = 1280 / 50 = 25.6 px/mm
All grain measurements below are in millimeters under this calibration.

Step 2 — Segmentation

Pipeline: CLAHE → Gaussian blur (5×5) → Otsu threshold → morphological open + close (3×3 kernel) → distance transform → threshold dist>0.45 for sure-foreground → 3-iteration dilation for sure-background → marker-based watershed.
Connected components on sure-foreground gives 121 raw markers.
After watershed, 113 candidate grains pass the filters: not touching image border, ≥10 pixels of area, <25% of total image area, b-axis ≥ 0.5 mm.
113 grains contribute to the distribution.

Step 3 — Per-grain b-axis

For each grain: fit a minimum-area bounding rectangle to the watershed contour. The shorter side is the b-axis. Convert pixels to mm using the calibration above.
Example: a grain whose minAreaRect is 28 × 41 px → b = 28 / 25.6 = 1.094 mm; area count of 720 px² → 720 / 25.6² = 1.099 mm² of grain area.

Step 4 — Area-weighted percentiles

Sort: grains by ascending b-axis; accumulate area; report the b-axis at which cumulative area crosses each target percentile.
Total grain area: 113 grains × ⟨area⟩ = 226.2 mm² = 2.26 cm².
D₅₀ = 1.68 mm: half the total area belongs to grains 1.68 mm or smaller.
D₁₆ = 1.21 mm and D₈₄ = 2.49 mm: the central 68% of the area lies between these two sizes.

Step 5 — Folk-Ward sorting

Convert to phi units: φ = −log₂(d_mm).
φ_{D5} = −log₂(0.92) = +0.13 · φ_{D16} = −log₂(1.21) = −0.27 · φ_{D84} = −log₂(2.49) = −1.32 · φ_{D95} = −log₂(3.30) = −1.72
σ_I = (φ_{D16} − φ_{D84}) / 4 + (φ_{D5} − φ_{D95}) / 6.6 = (−0.27 − (−1.32))/4 + (0.13 − (−1.72))/6.6
σ_I = 1.05/4 + 1.85/6.6 = 0.26 + 0.28
σ_I = 0.54 φ → "moderately well sorted" on the Folk-Ward verbal scale.

What this tells you

Run this analysis on your own photo

The live tool runs the exact same pipeline shown here. You can:

  1. Open the live tool.
  2. Click "Load sample image" to pre-load this same coarse-sand photograph (and the 50-mm-FOV custom calibration), then tap two endpoints to set the scale.
  3. Or upload your own field photograph with a coin / ruler / credit card in frame for accurate calibration.

Apps for offline field use in development

Native iOS and Android apps with offline OpenCV are in development for high-throughput field surveys. Sign up to be notified at launch:

Coming soon App Store FieldHydro for iOS Coming soon Google Play FieldHydro for Android

Related tools

Monthly engineering case studies

One real stormwater or hydraulics design problem per month, with the math worked out and the gotchas called out. No tutorials, no fluff.

Free. Unsubscribe anytime. Privacy.

Engineer of Record — Stamp & Signature
APPLY PE STAMP HERE
Engineer Name
License No.
State
Signature
Date
Project / Sheet
Worked example. Numerical values shown depend on the assumed 50 mm field-of-view; the photograph contains no scale reference. For sealed engineering work, always include a known-size scale object (coin, ruler, or card) in the photo plane and rerun the analysis with calibration based on that object.
Calculation generated at pe-calc.com