---
title: Ten Photos of the Same Coffee
url: https://oosioo.com/en/p/%EA%B0%99%EC%9D%80-%EC%BB%A4%ED%94%BC%EB%A5%BC-%EC%97%B4-%EB%B2%88-%EC%B0%8D%EC%9C%BC%EB%A9%B4
date: 2026-10-17T10:18:43+00:00
author: SYSOP
summary: How far can you trust one photo of coffee grounds? Using the bootstrap and a population with a known answer, I measured how many particles you need to count. Reaching ±5% took about 400 particles for the number median, 3,000 to 4,000 for the volume median and over 20,000 for volume D90, and pooling 30 fake photos of the same coffee left the measurement bias (+31%) untouched.
---
# Ten Photos of the Same Coffee

In the last episode I graded six ways of separating touching particles. Run on a single example photo from Gagné, they gave volume medians anywhere from 710 µm to 1,057 µm. Apart from which method is right, there is another question. Even if the method were perfect, how far can you trust the answer from one photo?

Sprinkle the same bag of coffee once more and photograph it, and different particles end up in the frame. The answer shifts a little. This episode measures how much, and how many particles you have to count to make the shift small.

## One photo is a sample

The particles in a photo are not all the grounds that came out of the grinder. They are a pinch taken out and sprinkled on paper, and only the part inside the frame gets photographed. In statistical terms, a sample. Estimating a population from a sample brings two kinds of error.

- **Sampling error**: error from which particles happened to land in the sample. It shrinks as the sample grows
- **Measurement error**: error from measuring the particles in the sample wrongly. The touching clumps and threshold bias of episodes 8 and 9 belong here. A bigger sample does not shrink it

This episode is mostly about the first, and then puts the two side by side.

## Counting by volume leaves fewer particles

Episode 6 showed that the same coffee gives different graphs depending on whether you count by number or by volume. The 1,561 particles from Gagné's photo used here (with blobs of solidity below 0.85 discarded) have a number median of 572 µm and a volume median of 878 µm. That difference carries straight over into sampling error.

![On the left, part of Gagné's example photo. The 240 largest particles are coloured orange and the rest blue; blobs discarded for low solidity stay black. Orange particles are sparse and blue ones far more numerous. The graph on the right plots the share of particles counted from the largest (horizontal) against the share of volume they hold (vertical). All three curves bulge strongly toward the top left: the largest 15% of particles hold half the volume](/uploads/fc06fb147836eb66.webp =760)

Of these 1,561 particles, the largest 240 held half the volume. That is 15% of the particles. The volume median is effectively set by those 240. The single largest particle held 1.2% of the total volume.

Survey statistics has a yardstick for this situation: Kish's effective sample size, the square of the sum of the weights divided by the sum of the squared weights. When every particle has the same weight it equals the number counted, and it shrinks as a few particles take most of the weight. With volume as the weight, the 1,561 particles have an effective sample size of 610. Counting every blob as is (2,123 of them) gives 388, as if only 18% had been counted, because large clumps take an even bigger share of the volume.

## Measuring the scatter from one photo

There is a way to estimate sampling error without photographing the same coffee many times: the bootstrap, introduced by Efron in 1979. Put the 1,561 measured particles in a bag, draw one, note it, put it back, and repeat 1,561 times to make a new sample. Some particles get drawn two or three times, some never. Compute the median of each new sample, and you get a distribution showing how much one photo's value could move with the luck of the draw. The middle 95% of that distribution serves as the 95% interval.

![Three histograms of values from 3,000 bootstrap resamples of Gagné's photo. The number median is narrow: 572 µm (556–588) with solidity discard, 606 µm (589–623) as is. The volume median is 878 µm (852–906) and 1,057 µm (1,011–1,100). The volume 90% diameter (D90) is 1,236 µm (1,153–1,289) with solidity discard, but 2,019 µm (1,558–2,491) as is, an interval almost 1,000 µm wide](/uploads/6d110fce92e95e49.webp =760)

With clumps discarded by solidity, the 95% intervals of both the number median and the volume median were about ±3%. The volume 90% diameter (D90, the diameter below which 90% of the volume lies) was ±5%. Leave the clumps in and things change. The volume median widens a little to ±4%, and D90 wanders across nearly a millimetre, from 1,558 to 2,491 µm, because a few large clumps hold the tail of the distribution. Removing just the ten largest pulled the volume median from 1,057 µm down to 1,000 µm, 5% lower.

One thing worth pointing out here. The graphs coffeegrindsize draws also carry bars, but they mean something else. In the code, each histogram bin gets a Poisson error bar: the square root of the number of particles in the bin times the bin's average weight. The horizontal bar on the average-diameter point is not an uncertainty but the width of the distribution. Gagné describes it on his blog as the width that "covers approximately 68% of all the distribution". The tool does not say how precise the average is. Gagné knew this. In a 2019 blog comment he called small-number statistics "the #1 limitation of this software", and said the graphs in his posts are composites of 12 pictures of 12 samples, "just to get better statistics".

## How many to count

The bootstrap estimates the scatter of one photo. To check whether that estimate is right you need a population whose answer you know. I used this series' grind model from episode 6: a volume-based mix of a fines peak and a coarse peak. From it I drew n particles of 330 µm and above, computed the medians, repeated that 1,000 times, and measured how widely the values spread. There is no measurement error in this experiment, only the luck of the draw. The population's true values are a number median of 555 µm, a volume median of 974 µm and a volume D90 of 1,778 µm.

![Line graph. Horizontal axis: particles counted (50 to 50,000, log scale); vertical axis: half-width of the 95% range (%). The number median falls to ±7% at 200 particles, ±3% at 1,000 and ±1.3% at 5,000. The volume median is ±20% at 200, ±9% at 1,000, ±4% at 5,000 and ±2% at 20,000. Volume D90 is ±26% at 1,000, ±12% at 5,000 and ±5% at 20,000. A dotted line marks ±5%, and the region near 1,400 particles, one photo, is shaded](/uploads/631aab9bc415ebb1.webp =760)

The three values need very different numbers of particles to reach the same width. To get to ±5% (half the 95% range), about 400 particles were enough for the number median, but the volume median needed 3,000 to 4,000 and volume D90 more than 20,000. All three shrink roughly with the square root of the count. To halve the width you have to count four times as many.

If one photo holds about 1,400 particles, as Gagné's does, then under this model one photo's volume median wobbles by ±7–8% and D90 by more than ±20%. The bootstrap interval for Gagné's photo above (±3%) was narrower because the distribution is different. With large clumps discarded by solidity, the distribution has a short tail and an effective sample size of 39%; the model reaches beyond 2 mm and has 17%. The longer the tail, the less information the same count carries.

The static image analysis standard ISO 13322-1 says this near the start: "Both the type of distribution, (by number or by volume) together with the width of the particle size distribution has a very material influence upon the number of particles to be measured to secure the desired accuracy within the specified confidence limits." The standard's annex reportedly has a table built from the calculation of Masuda and Gotoh (1999). I could not check the annex itself; I read the table as reproduced in technical material from HORIBA and Entegris. For a log-normal distribution with geometric standard deviation 1.6, the number of particles needed for ±5% (95% confidence) ranges from 6,092 to 60,811 depending on which mean diameter you want. That is where the industry's often-quoted "60,000 particles" comes from.

Drawing the volume median directly from a log-normal of the same width gave ±4% at 6,092 particles and ±1.2% at 60,811, roughly in line with the smallest number in the table (6,092). Bodycomb of HORIBA (2013) also said that in practice "ISO is too conservative". Either way, the order of magnitude is the same: hundreds when counting by number, thousands by volume, tens of thousands to see the tail.

Geomorphologists who measure riverbed gravel reached the same conclusion. Eaton et al. (2019) report that the customary 100 stones give percentile uncertainties of ±15% to ±30%, and even 500 stones give ±9% to ±18%.

### Can the bootstrap interval be trusted?

I drew one sample from the same population, computed its bootstrap 95% interval, and checked whether it covered the truth (974 µm), 300 times over. By its name, 95% should. In fact the share was 87% with 100 particles, 90% with 1,000 and 93% with 3,000. For a value held by a few large particles, like the volume median, the smaller the sample the narrower the bootstrap interval comes out compared with reality. A large particle that never made it into the sample cannot be drawn again. With thousands of particles the gap nearly disappears.

## Splitting one photo into twelve

The bootstrap rests on one assumption: that the particles were drawn independently. If, when sprinkled, large particles rolled to the edges and fines gathered together, the particles in a photo would not be independent. ISO 13322-1 also asks you to examine the whole measurement field for noticeable segregation by size.

I checked with Gagné's photo. I split it into 4 × 3 cells and computed the volume median of each. Each cell holds about 130 particles. Then I drew 130 particles at random from the photo's 1,561 and did the same calculation 4,000 times.

![On the left, Gagné's photo split into 4 × 3 cells, each labelled with its volume median: 909, 846, 878, 839 / 850, 949, 785, 900 / 865, 867, 939, 867 µm. The graph on the right plots the twelve values as dots, with a horizontal line at the whole-photo value of 878 µm and a band for the 95% range when drawing 130 at random. Eleven of the twelve dots fall inside the band; only cell 7, at 785 µm, sits slightly below it](/uploads/f3ea288bc2272148.webp =760)

The scatter between cells (standard deviation 45 µm) was almost the same as for random draws (42 µm). Eleven of the twelve cells fell within the 95% range of random draws. The number median was similar too, 24 µm against 28 µm. In this photo at least, the sprinkled grounds did not settle apart by size. The particles in the photo can be treated as a random sample, and the bootstrap can be used.

That is a story about what happens inside one pinch. Whether sizes separated when the pinch was taken from the bag, this photo cannot say. More on that below.

## Thirty photos of the same coffee

I could not photograph real coffee thirty times, so I used fakes. With the episode-8 generator in its real-like setting, changing only the seed, I made 30 fake photos, as if the same bag had been sampled and sprinkled afresh each time. Each photo held 1,300 to 1,400 true particles of 330 µm and above.

I measured each photo with three methods (as is, distance watershed, discarding solidity below 0.85) and computed bootstrap intervals from the measured blobs. I also computed the value for the true particles actually sprinkled on that photo, the value you would get with no measurement error.

![Dot-and-bar plot. Horizontal axis: photos 1 to 30; vertical axis: volume median with bootstrap 95% interval. A green dotted line marks the population truth, 974 µm. The truth on each photo (black) moves around the line between 910 and 1,070 µm, and most of its intervals cover it. Solidity discard (purple) also sits near the line. Distance watershed (blue) clusters above it at 1,010–1,200 µm, and as is (grey) sits far higher at 1,170–1,390 µm, with no interval ever reaching the line](/uploads/54515c754c216bd7.webp =760)

Looking only at the true particles, the volume median moved by ±3.9% (standard deviation) from photo to photo. The half-width of the one-photo bootstrap interval was 7.4%, about twice the standard deviation, as a 95% interval should be. In 28 of the 30 photos the interval covered the population truth. Without measurement error, the bootstrap does its job.

The measured values were another matter. Measured "as is", the 30-photo mean was 1,272 µm, 31% above the truth. The scatter between photos, ±4.7%, was not very different from the true particles (±3.9%). Yet not one of the 30 bootstrap intervals covered the truth. An interval measures only scatter. If the measurement leans one way, the interval sits around the leaning value.

The distance watershed leaned less, +11%, but only 4 intervals covered the truth. Solidity discard averaged −0.5%, right on the truth, and 29 covered it. As episode 9 showed, that comes from the discarded large particles and the remaining clumps cancelling each other out. On fakes made from cut-and-pasted real particles, the same method was +12%.

### Pooling leaves the bias

What happens when you pool photos? Starting from the first photo, I pooled 1, 2, 3, 5, 10, 20 and 30 photos and recomputed.

![Two panels. On the left, horizontal axis: photos pooled (1 to 30); vertical axis: volume median. For all four lines the band (bootstrap interval) narrows as photos are pooled. The true particles (black) and solidity discard (purple) converge on the 974 µm dotted line, while distance watershed (blue) stays near 1,080 µm and as is (grey) near 1,270 µm. On the right, bars of the 30-photo mean bias at normal density (6% cover) and dense sprinkling (15% cover): truth +0% and +1%, as is +31% and +63%, distance watershed +11% and +19%, solidity discard −1% and −1%. Beside the bars, the scatter between photos is noted as ±2.8–4.7%](/uploads/5f474683a874a6fe.webp =760)

Pooling 30 photos, about 32,000 particles, narrowed the "as is" interval to 1,252–1,295 µm. The truth, 974 µm, lies far outside it. Pooling photos only narrows the interval; it does not move it toward the truth. If anything, the narrow interval presents the wrong value with more confidence.

The right panel shows another route. Sprinkle the grounds densely (covering 15% of the paper) to fit more into one photo, and the true particles per photo rise to 3,300 while the scatter drops from ±3.9% to ±2.8%. In exchange, the bias of the "as is" measurement doubles from +31% to +63%, because more particles touch. This is why ISO 13322-1 asks you to adjust the number of particles per field to reduce touching. To count more particles, take more photos rather than sprinkling more densely.

## The pinch problem

So far I have assumed the grounds in the bag are well mixed. They may not be. Shaking or moving a container of grounds tends to separate large particles upward and small ones downward. Then the sample depends on where the pinch is taken from. That error does not shrink however many particles you count within the pinch. The bootstrap cannot catch it either.

Malvern's whitepaper on sampling reproduces an experiment from Allen's *Particle Size Measurement*. A 60:40 mix of two sands was split by various methods and the composition measured. Scooping gave a standard deviation of 5.14%. A spinning riffler gave 0.146%, close to the theoretical value for random mixing (0.075%). The whitepaper notes that the most common way samples are taken in industry, "scoop or spatula", carries a standard deviation of just over 5%. I found no peer-reviewed study measuring how much coffee grounds separate when taken by the pinch.

Gy's theory of sampling says the same thing from another side. The mass of sample needed to represent a lot scales with the cube of the largest particle diameter. The larger the particle, the heavier each one is, so a few coming in or dropping out changes the result a lot. It is the same story as the volume median resting on 240 large particles.

The prescription in ISO 13322-1 is simple. Split the sample into at least three, measure each separately, and compare the results to check repeatability. That way the wobble from sampling and dispersion is included. Gagné photographing 12 samples for his 12 pictures is the same approach.

## Try it yourself

In the simulation below, each press of "Take one photo" stacks one photo as a row. The dot is that photo's value and the bar is the bootstrap 95% interval from that photo alone. When the interval misses the truth, the dot turns orange.

In "Draw from the population", the slider changes how many particles one photo counts. Switch from number median to volume median to volume D90 and see how much wider the scatter gets for the same count. In "Measure ten fake photos", ten fake photos of the same coffee, sprinkled ten times, are measured by each method. The thick row at the bottom pools the photos so far. Pick "as is" and take ten: the pooled row narrows while staying far from the truth.

```map /embed/coffee-repeat-2026-en.html 16:12
A simulation of how much the result wobbles when the same coffee is photographed again and again. In the graph on the left each photo stacks as a row: the dot is the median measured on that photo, the horizontal bar is the bootstrap 95% interval from that photo alone, and a green dotted line marks the truth. A dot turns orange when its interval misses the truth. On the right you choose what to estimate: number median, volume median or volume D90. "Draw from the population" lets you change the particles per photo (100 to 20,000); "Measure ten fake photos" shows values for the true particles, as is, distance watershed and solidity discard, plus the pooled value. The table below gives the scatter between photos, the width of the bootstrap interval and how many intervals covered the truth.
```

## What this experiment left out

- **I did not photograph real coffee repeatedly.** Splitting one Gagné photo into cells and 30 fake photos is all there is. Real photo-to-photo scatter also includes differences in lighting, focus and how the grounds are sprinkled
- **Separation between pinches was not measured.** I found no coffee data on how much sizes separate when taking grounds from a bag or a grinder's catch cup
- **Only one grind model was used.** The number of particles needed depends heavily on the width and tail of the distribution. For fine espresso grinds or grinders with a long tail the numbers will differ
- **Particles below 330 µm were not counted.** At this series' magnification (45.68 µm/px), blobs under 40 pixels are discarded, so fines are left out from the start. Fines are numerous, so their sampling error is small, but as episode 3 showed, their measurement error is large
- **Only the simplest percentile bootstrap interval was used.** Corrections for intervals that come out too narrow in small samples (such as BCa) were not tested
- **I did not see the original annex table of ISO 13322-1.** I quoted the table as reproduced in HORIBA and Entegris material

## Summary

- One photo is a sample. Sampling error shrinks the more particles you count; measurement error (bias) does not
- Counting by volume, a few large particles hold the value. In Gagné's photo the largest 240 (15%) held half the volume, and the effective sample size by volume was 610 out of 1,561
- Under this series' grind model, reaching ±5% (95%) takes about 400 particles for the number median, 3,000 to 4,000 for the volume median and more than 20,000 for volume D90. Halving the width takes four times as many
- One-photo bootstrap intervals matched the real scatter well when the measurement was accurate. Below a few hundred particles, though, the intervals were narrower than reality
- The scatter between twelve cells of Gagné's photo matched random draws. Within one pinch, sizes did not settle apart
- Measuring 30 fake photos of the same coffee "as is" gave a +31% bias, and the bootstrap interval never once covered the truth. Pooling all 30 only narrowed the interval
- Sprinkling densely raises the particles per photo but doubles the bias from +31% to +63%. To count more particles, take more photos

A narrow error bar only means the same method gives a similar value when you measure again. It does not tell you whether that value is right.

## References

- ISO 13322-1:2014. *Particle size analysis — Image analysis methods — Part 1: Static image analysis methods* — 4.1 effect of number/volume basis and distribution width on the number of particles needed, 4.2 e) gather enough images of separate aliquot samples, 5.3 examine the measurement field for size segregation, 5.4 split the sample into at least three to check repeatability. Annex A (estimating the number of particles) not checked. [Official sample](https://cdn.standards.iteh.ai/samples/51257/e5956ce29c644e71ad37738bd690a3cf/ISO-13322-1-2014.pdf)
- Masuda H, Gotoh K (1999). Study on the sample size required for the estimation of mean particle diameter. *Advanced Powder Technology* 10(2), 159–173. [doi:10.1016/S0921-8831(08)60447-1](https://doi.org/10.1016/S0921-8831(08)60447-1) — original not read; table quoted as reproduced in the two sources below
- Bodycomb J (2013). *Are we there yet? How many particles do you need for Image Analysis* (TR021). HORIBA Scientific webinar slides. [PDF](https://static.horiba.com/fileadmin/Horiba/Products/Scientific/Particle_Characterization/Webinars/Slides/TR021.pdf.pdf) — the ISO 13322-1 table (6,092 to 60,811 particles for ±5% at σg 1.6), "ISO is too conservative"
- Entegris. *How Many Particles to Measure — AccuSizer system*. Technical note. [PDF](http://www.entegris.com/content/dam/product-assets/accusizerspossystems/technote-how-many-particles-to-measure-10567.pdf) — the same table and the source of "60,000 particles"
- Efron B (1979). Bootstrap methods: another look at the jackknife. *Annals of Statistics* 7(1), 1–26. [doi:10.1214/aos/1176344552](https://doi.org/10.1214/aos/1176344552)
- Künsch HR (1989). The jackknife and the bootstrap for general stationary observations. *Annals of Statistics* 17(3), 1217–1241. [doi:10.1214/aos/1176347265](https://doi.org/10.1214/aos/1176347265) — block bootstrap for dependent data
- Kish L (1965). *Survey Sampling*. Wiley. — effective sample size
- Eaton BC, Moore RD, MacKenzie LG (2019). Percentile-based grain size distribution analysis tools (GSDtools) – estimating confidence limits and hypothesis tests for comparing two samples. *Earth Surface Dynamics* 7, 789–806. [doi:10.5194/esurf-7-789-2019](https://doi.org/10.5194/esurf-7-789-2019) — 100 stones ±15–30%, 500 stones ±9–18%
- Malvern Panalytical. *Sampling for Particle Size Analysis* (WP051214). [Link](https://www.malvernpanalytical.com/en/learn/knowledge-center/whitepapers/WP051214SamplingForParticleSize) — Gy's relation between sample mass and diameter; Allen's standard deviations by sample-splitting method (scoop 5.14%, spinning riffler 0.146%)
- Allen T (1997). *Particle Size Measurement*, 5th ed., Vol. 1. Chapman & Hall. — cited via the whitepaper above
- Petersen L, Minkkinen P, Esbensen KH (2005). Representative sampling for reliable data analysis: Theory of Sampling. *Chemometrics and Intelligent Laboratory Systems* 77(1–2), 261–277. [doi:10.1016/j.chemolab.2004.09.013](https://doi.org/10.1016/j.chemolab.2004.09.013)
- Gagné J. *coffeegrindsize*. GitHub. [Link](https://github.com/jgagneastro/coffeegrindsize) — per-bin Poisson error bars (`psd_hist_from_data`); the horizontal bar on the average point is the 68% width of the distribution
- Gagné J (2019). An App to Measure your Coffee Grind Size Distribution. *Coffee ad Astra*. [Link](https://coffeeadastra.com/2019/04/07/an-app-to-measure-your-coffee-grind-size-distribution-2/) — post and comments (small-number statistics as the #1 limitation; composites of 12 pictures of 12 samples)

## Image credits

- All figures and the simulation: my own. The real photo is the example photo from Jonathan Gagné's [coffeegrindsize](https://github.com/jgagneastro/coffeegrindsize) ([MIT licence](https://github.com/jgagneastro/coffeegrindsize/blob/master/LICENSE))

