Counting methods

How to estimate a large count by sampling part of a photo

When there are too many items to count one by one, count a few grid cells exactly and multiply. Here is how to do it step by step, how to handle uneven density, and when not to extrapolate at all.

Hundreds of dried beans spread across a light wooden table, photographed from directly above.
Illustrative image created for this guide.

What it means to estimate a count by sampling

Some photos simply hold too many things to count one by one: a tray of seedlings, a pile of washers, a flock of birds, a crowd in a square. Sampling is the shortcut people have used for a long time. You count a small, typical part of the picture exactly, work out how many times that part fits into the whole area, and multiply. Crowd counters call a version of this Jacobs’ method, after Herbert Jacobs: divide the area into sections, find an average number per section and multiply by the number of sections that are occupied. Bird counters do the same thing with blocks of ten or a hundred birds.

The result is an estimate, not a count. That is fine when you need to know whether there are about 500 or about 2,000 items, and it is the wrong tool when an exact number matters, such as stock you are paying for or parts you must account for. The rest of this guide shows how to make a sampled estimate as good as it can be and how to tell when you should count everything instead.

When sampling works, and when it does not

Sampling only works if the part you count looks like the rest of the photo. Before you start, look at the whole picture and ask a few honest questions.

  • Are the items spread fairly evenly, or are there dense clumps and empty patches? Even spreads are easy; uneven ones need zones.
  • Are the items roughly the same size? Mixed sizes change how many fit into one cell.
  • Is the whole area visible, or do items disappear behind each other, into shadow or out of the frame?
  • Is the camera looking straight down, or at an angle? At an angle, cells at the back cover much more ground than cells at the front.
  • Do you need an exact number? If yes, sampling is only a quick check, and you still need a full count.

How to estimate a count by sampling, step by step

This method works with a printed photo and a pen, but it is faster on a screen with a grid overlay. Take your time over the first two steps; they decide how good the estimate will be.

  • Mark the area that actually holds items. Leave out empty table, sky, water or floor, because counting them as full cells inflates the result.
  • Place a grid over the photo. Choose a size where one cell holds roughly ten to fifty items, so a single cell is easy to count without losing your place.
  • Count the occupied cells. Write down how many cells are full, how many are about half full and how many are empty.
  • Pick several typical full cells spread across the photo, not neighbours, and count each one exactly, using one rule for items on the cell lines.
  • Average the sample cells and multiply by the number of full cells. Add half the average for each half-full cell.
  • Round the result to a sensible figure and write down how you got it, so you or someone else can check it later.

A worked example: beans spread on a table

Here is the method on a single overhead photo of dried beans spread across a table, with simple, illustrative numbers. You place a six by six grid over the picture, which gives 36 cells. Six cells at the edges show only bare wood, so you leave them out. Of the remaining 30 cells, 24 look fully covered and 6 are about half covered.

You count four full cells in different parts of the photo and get 38, 42, 35 and 41 beans, an average of 39 per cell. Twenty-four full cells at 39 each gives 936, and six half cells at about 20 each adds 120, so the estimate is roughly 1,056 beans. Saying “about 1,050” is honest; saying “1,056” suggests a precision the method does not have. If the four sample cells had given 20, 60, 25 and 55, the average would be the same, but the spread would tell you the beans are not evenly spread and that you need zones.

When density varies: split the photo into zones

Real photos are rarely even. A crowd is packed near the stage and thin at the back, a flock is dense in the middle and loose at the edges, and parts in a bin pile up in the corners. If you use one average for all of this, the result can be far off in either direction, depending on which cells you happened to count.

The fix is to split the photo into zones of similar density, such as dense, medium and sparse, and to sample each zone on its own. Count a few cells in each zone, multiply each zone average by its number of cells and add the zone totals. It takes a little longer, but it is the single biggest improvement you can make to a sampled estimate.

How many cells to sample, and which ones

There is no magic number, but a few habits keep the sample honest and stop you from picking the cells that are easiest to count.

  • Count at least three or four cells per zone; one cell can be unusual by chance.
  • Spread the sample cells across the zone, for example one from each corner area and one from the middle.
  • Choose the cells before you look closely, for example by row and column numbers, so you do not favour tidy cells.
  • If the sample counts differ a lot, count more cells or split the zone again.

Check your estimate before you trust it

A quick second estimate catches most big errors. Use a different grid size, or let someone else pick the sample cells, and compare the two results. If they are close, you can trust the rough size of the number. If one is twice the other, something is wrong: usually uneven density, a wrong cell total or empty areas counted as full.

When you can, check the method against a real count once. Count one smaller photo completely, estimate the same photo by sampling and see how far apart the two are. That tells you how much to trust sampled estimates for that kind of scene, and it shows whether your cell size and line rule work.

Common mistakes when estimating by sampling

Most bad estimates come from a handful of repeated mistakes, and each one has a simple fix.

  • Counting empty background as full cells. Mark the occupied area first.
  • Sampling only the densest or the sparsest part of the photo. Spread the sample and use zones.
  • Ignoring perspective. On an angled photo, sample the near, middle and far parts separately, or take the picture from higher up.
  • Double counting items on grid lines. Use one line rule everywhere.
  • Reporting a precise-looking number. Round it and say it is an estimate.

Where a camera count fits in

An app that detects items in a photo, such as Count Objects Camera, can give you a total for the whole picture in one go. On large, crowded scenes that total is also an estimate: items that overlap, touch or hide in shadow can be missed or counted twice, and the result depends on light, angle and image quality.

Sampling and an app count work well together. Take the app’s total, then sample a few cells by hand. If both land in the same range, you have more confidence in the number. If they disagree, look at the zones where the difference comes from, and recount those parts or retake the photo from straight above.

Frequently asked questions

How accurate is an estimate by sampling? It depends on how even the photo is and how many cells you sample. On an even spread it can be close; on uneven scenes it can be far off unless you use zones. Treat it as a range, not a single number.

What grid size should I use? Pick a size where one cell holds about ten to fifty items. Small cells are slow to count overall, and large cells are hard to count exactly.

Can I use sampling for an exact inventory? No. Use it to get the scale of a count or to check another count, and count everything when the exact number matters.

What if the items overlap heavily? Sampling cannot see hidden items either. Spread the items out if you can, or take the photo from directly above with even light, and treat the result as a lower estimate.

Sources and further reading