ENH first draft of felzenszwalbs graph based image segmentation in Python

This commit is contained in:
Andreas Mueller
2012-08-03 11:36:42 +01:00
parent b8c0663332
commit 967eb5b50d
3 changed files with 74 additions and 0 deletions
@@ -0,0 +1,13 @@
import matplotlib.pyplot as plt
import numpy as np
from skimage.data import lena
from skimage.segmentation import felzenszwalb_segmentation
img = lena()
segments = felzenszwalb_segmentation(img, k=1000)
plt.imshow(img)
plt.figure()
plt.imshow(segments)
plt.show()
print("num segments: %d" % len(np.unique(segments)))