Last active
December 15, 2017 13:24
-
-
Save umedsondoniyor/afe1fa827db2f0d8314514988fe755a5 to your computer and use it in GitHub Desktop.
skletonize horse
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
from skimage.morphology import skeletonize | |
from skimage import data | |
import matplotlib.pyplot as plt | |
from skimage.util import invert | |
from numpy import invert | |
# Invert the horse image | |
image = invert(data.horse()) | |
print image | |
# perform skeletonization | |
skeleton = skeletonize(image) | |
# display results | |
fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(8, 4), | |
sharex=True, sharey=True, | |
subplot_kw={'adjustable': 'box-forced'}) | |
ax = axes.ravel() | |
ax[0].imshow(image, cmap=plt.cm.gray) | |
ax[0].axis('off') | |
ax[0].set_title('original', fontsize=20) | |
ax[1].imshow(skeleton, cmap=plt.cm.gray) | |
ax[1].axis('off') | |
ax[1].set_title('skeleton', fontsize=20) | |
fig.tight_layout() | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment