mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-24 13:20:43 +08:00
Fix inconsistencies in examples and many more improvements
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user