import pylab; from skimage import io,color,measure
import warnings; warnings.filterwarnings('ignore')
from IPython.core.magic import register_line_magic
file_path='https://raw.githubusercontent.com/'+\
'OlgaBelitskaya/data/main/decors/'
img=io.imread(file_path+file)
level=.7; img=color.colorconv.rgba2rgb(img)
gray_img=color.colorconv.rgb2gray(img)
contours=measure.find_contours(gray_img,level)
pylab.figure(figsize=(5,5))
pylab.gca().invert_yaxis()
pylab.imshow(img,alpha=.1)
[pylab.plot(c[:,1],c[:,0],lw=1) for c in contours]
pylab.xticks([]); pylab.yticks([]); pylab.show()
No comments:
Post a Comment