By Tim King · Updated
Count Objects in Image Online
Count Coins, Cells, Seeds or Pills in a Photo, Including Touching Objects
OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.
How the Object Counter works
Count objects in image online, with nothing uploaded. Photograph a handful of coins, a tray of seeds, a petri dish or a scatter of parts on a plain background and get a count without tallying by hand. The tool separates objects from the background by brightness, throws away specks below a minimum size, splits objects that touch, and paints each one a different colour so you can check what was counted. The photo stays on your device.
How to count objects in image online
Counting by threshold works whenever the objects are noticeably lighter or darker than what they sit on: dark coins on a white sheet, pale cells on a stained slide, seeds on a dark cloth. The image is converted to greyscale and lightly blurred to suppress sensor noise, then every pixel is classed as object or background by a cut-off brightness.
Automatic picks that cut-off with Otsu's method, which searches every possible level and chooses the one that best separates the two brightness populations in the picture. It suits most well-lit photos on a plain background. Manual lets you set the level yourself with the slider, which is the answer when the automatic choice grabs shadows or misses faint objects; the level actually used is reported in the stats so you can start from the automatic value and nudge it. The tool looks at the border of the picture to decide which side of the cut-off is background, so it does not matter whether your objects are lighter or darker than the surface.
After thresholding, a small opening pass removes single-pixel grit, and anything smaller than the minimum object size is ignored. Raise that value when dust, texture or reflections are being counted; lower it for genuinely tiny objects like pollen or fine beads.
Split touching objects deals with the classic problem of two coins or cells overlapping into one blob. It computes how far each object pixel is from the nearest background pixel, so the centre of each round object becomes a peak, uses those peaks as seeds, and runs a watershed that grows each seed outwards until it meets its neighbour. Round or oval objects separate cleanly; long thin objects or very irregular shapes can be over-split, in which case turn it off and accept that touching pairs count as one.
The result image tints every counted object with its own colour and prints the total in the corner, and the stats give the smallest, largest and median object area in pixels. A quick scan for a blob that is much larger than the median usually reveals the pair that did not split, and a cluster of tiny areas points to the minimum size being too low. Images over 2000 pixels on the long side are scaled down before counting.
FAQ
Why is the count far too high?
Texture, dust or shadows are being counted. Raise the minimum object size, and if the background is uneven switch to Manual threshold and move the level away from the background's brightness.
Why are two touching objects counted as one?
Split touching objects is off, or the objects are not round enough for the watershed to find separate centres. Turn splitting on; if that over-splits, spread the objects out and photograph again.
Can it count objects on a busy background?
Not reliably. The method depends on brightness contrast between object and surface. Lay the items on plain paper or cloth of the opposite tone and light them evenly.
Can it tell different kinds of objects apart?
No, it counts everything that passes the threshold. The area statistics help: sort by size in your head from the tinted image, and objects of one kind tend to cluster around a common area.
See also: all Images tools, Audio, Video & Screen, PDF, SVG, Simulations & Screensavers, Generative Art, Chart Makers, 3D Model Viewers, Drawing Pads, Mockups & 3D Making, Diagram Makers, 3D Science, Tracker Music.
Related tools
Edge Detector
Trace the outlines in a photo with Canny edge detection.
Image Histogram Viewer
Plot the RGB and luminance histogram of a photo and spot clipping.
Auto Crop Image
Trim the blank border around an image down to its content automatically.
Photo To Sketch
Convert a photo into a pencil sketch, ink outline or cartoon.
Image Compare
Spot differences between two images and get a similarity score.