watershed transform
Treating pixel value as elevation and flooding outward from local minima, building a dam wherever two basins would otherwise merge.
The watershed transform treats an image (often its gradient magnitude) as a topographic surface, with pixel value as elevation. Flooding begins at every local minimum (a catchment basin) and rises; whenever the rising water of two distinct basins would meet, a dam (the watershed line) is placed there instead of letting the two basins merge. The final dams form the segmentation boundaries -- a technique especially suited to separating touching objects a simple threshold would leave fused together.
Point table
Graph settings
Calculator