Created
July 11, 2014 14:07
-
-
Save odebeir/2efd02b1c357ede5aee3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
from skimage.morphology import watershed,disk | |
from skimage.filter import rank | |
from skimage import data | |
import numpy as np | |
image = data.camera() | |
gradient = rank.gradient(image, disk(2)) | |
markers = np.zeros(image.shape) | |
markers[100,150] = 1 | |
markers[200,200] = 2 | |
markers[240,200] = 3 | |
labels = watershed(gradient, markers) | |
plt.imshow(labels, cmap=plt.cm.spectral, interpolation='nearest') | |
plt.imshow(markers, interpolation='nearest',alpha = .6) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment