Fix inconsistencies in examples and many more improvements

This commit is contained in:
Johannes Schönberger
2013-04-27 16:47:33 +02:00
parent 41007b417b
commit d0ee6ade61
40 changed files with 138 additions and 132 deletions
+3 -3
View File
@@ -24,13 +24,14 @@ See Wikipedia_ for more details on the algorithm.
.. _Wikipedia: http://en.wikipedia.org/wiki/Watershed_(image_processing)
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy import ndimage
from skimage.morphology import watershed
from skimage.feature import peak_local_max
# Generate an initial image with two overlapping circles
x, y = np.indices((80, 80))
x1, y1, x2, y2 = 28, 28, 44, 52
@@ -41,7 +42,6 @@ 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
from scipy import ndimage
distance = ndimage.distance_transform_edt(image)
local_maxi = peak_local_max(distance, indices=False, footprint=np.ones((3, 3)),
labels=image)