The idea is very simple, first one applies a distance operator on the image then one locates the local maxima by using the local maximum operator. In the images bellow we see all the steps.
The original image:
After applied the distance operator (a random color map was used here):
The last erosion result: