start with all pixels with the lowest possible value
these form the basis for initial watersheds
for each group of pixels of intensity k
if adjacent to exactly one existing regions,add these pixels to that region
else if adjacent to more than one existing regions,mark as boundary
else start a new region