标签:ima save 应用 sklearn mat sizeof sys 图片 class
plt.imshow(china[:,:,2])
plt.show()
from sklearn.datasets import load_sample_image china=load_sample_image(‘china.jpg‘) print(china.shape) china
import matplotlib.pyplot as plt plt.imshow(china) plt.show()
plt.imshow(china[:,:,0],plt.cm.gray)
plt.show()
from sklearn.datasets import load_sample_image from sklearn.cluster import KMeans import matplotlib.pyplot as plt import numpy as np china=load_sample_image("china.jpg") plt.imshow(china) plt.show() image=china[::3,::3] image.shape plt.imshow(image) plt.show() x=image.reshape(-1,3) model=KMeans(n_clusters=64) model.fit_predict(x) a=model.cluster_centers_
from sklearn.datasets import load_sample_image china=load_sample_image(‘china.jpg‘) import sys sys.getsizeof(china) sys.getsizeof(image) import matplotlib.image as img img.imsave(‘E://01.jpg‘,china) img.imsave(‘E://02.JPg‘,image)
标签:ima save 应用 sklearn mat sizeof sys 图片 class
原文地址:https://www.cnblogs.com/Herman-mai/p/9961213.html