Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- """
- Created on Sun Dec 10 13:39:28 2017
- @author: oznur
- """
- import cv2
- from skimage import color
- import matplotlib.pyplot as plt
- from skimage.morphology import skeletonize
- image = cv2.imread('horse.png')
- gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
- image=color.rgb2gray(image)
- skeleton =skeletonize(image)
- fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(8, 4),
- sharex=True, sharey=True,
- subplot_kw={'adjustable': 'box-forced'})
- ax1,ax2=axes.ravel()
- ax1.imshow(image, cmap=plt.cm.gray)
- ax1.axis('off')
- ax1.set_title('original', fontsize=20)
- ax2.imshow(skeleton, cmap=plt.cm.gray)
- ax2.axis('off')
- ax2.set_title('skeleton', fontsize=20)
- fig.tight_layout()
- plt.show()
Add Comment
Please, Sign In to add comment