# check scikit image versionimport skimageskimage.__version__from skimage import data, io, filtersimage = data.coins()io.imshow(image)io.show()edges = filters.sobel(image)io.imshow(edges)io.show()skimage.data.astronaut() Color image of the astronaut Eileen Collins.skimage.data.camera() Gray-level “camera” image.skimage.data.checkerboard() Checkerboard image.skimage.data.chelsea() Chelsea the cat.skimage.data.clock() Motion blurred clock.skimage.data.coffee() Coffee cup.skimage.data.coins() Greek coins from Pompeii.skimage.data.horse() Black and white silhouette of a horse.skimage.data.hubble_deep_field() Hubble eXtreme Deep Field.skimage.data.immunohistochemistry() Immunohistochemical (IHC) staining with hematoxylin counterstaining.skimage.data.logo() Scikit-image logo, a RGBA image.skimage.data.moon() Surface of the moon.skimage.data.page() Scanned page.skimage.data.text() Gray-level “text” image used for corner detection.skimage.data.rocket() Launch photo of DSCOVR on Falcon 9 by SpaceX.skimage.data.stereo_motorcycle() Rectified stereo image pair with ground-truth disparities.image = data.camera()io.imshow(image)io.show()image = data.coffee()io.imshow(image)io.show()image = data.hubble_deep_field()io.imshow(image)io.show()import numpy as npimport matplotlib.pyplot as plt# load a small section of the imageimage = data.coins()[0:95, 70:370]# plot graphfig, axes = plt.subplots(ncols=2, nrows=3, figsize=(8,4)) ax0, ax1, ax2, ax3, ax4, ax5 = axes.flatax0.imshow(image, cmap=plt.cm.gray)ax0.set_title('Original', fontsize=15)ax0.axis('off') # Histogramvalues, bins = np.histogram(image, bins=np.arange(256))ax1.plot(bins[:-1], values, lw=2, c='k')ax1.set_xlim(xmax=256)ax2.set_yticks([0, 400])ax1.set_aspect(.2)ax1.set_title('Histogram', fontsize=15)# Apply threshold.from skimage.filters import threshold_adaptivebw = threshold_adaptive(image, 95, offset=-15)ax2.imshow(bw, cmap=plt.cm.gray)ax2.set_title('Adaptive threshold', fontsize=15)ax2.axis('off')# Detect edges.from skimage import featureedges = feature.canny(image, sigma=3, low_threshold=10, high_threshold=80)ax3.imshow(edges, cmap=plt.cm.gray)ax3.set_title('Edges', fontsize=15)ax3.axis('off')# Label image regions.from skimage.measure import regionpropsimport matplotlib.patches as mpatchesfrom skimage.morphology import labellabel_image = label(edges)ax4.imshow(image, cmap=plt.cm.gray)ax4.set_title('Labeled items', fontsize=15)ax4.axis('off')for region in regionprops(label_image): # Draw rectangle around segmented coins. minr, minc, maxr, maxc = region.bbox rect = mpatches.Rectangle((minc, minr), maxc - minc, maxr - minr, fill=False, edgecolor='red', linewidth=2) ax4.add_patch(rect)plt.tight_layout()plt.show()