>>>fromskimage.morphologyimportwatershed>>>fromskimage.featureimportpeak_local_max>>>fromskimage.measureimportlabel>>>>>># Generate an initial image with two overlapping circles>>>x,y=np.indices((80,80))>>>x1,y1,x2,y2=28,28,44,52>>>r1,r2=16,20>>>mask_circle1=(x-x1)**2+(y-y1)**2<r1**2>>>mask_circle2=(x-x2)**2+(y-y2)**2<r2**2>>>image=np.logical_or(mask_circle1,mask_circle2)>>># Now we want to separate the two objects in image>>># Generate the markers as local maxima of the distance>>># to the background>>>fromscipyimportndimage>>>distance=ndimage.distance_transform_edt(image)>>>local_maxi=peak_local_max(distance,indices=False,footprint=np.ones((3,3)),labels=image)>>>markers=label(local_maxi)>>>labels_ws=watershed(-distance,markers,mask=image)

/Users/arve/.virtualenvs/3.4/lib/python3.4/site-packages/skimage/morphology/watershed.py:214: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
if c_mask == None: