第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

圖像壓縮后得到的灰度圖像

圖像壓縮后得到的灰度圖像

繁華開滿天機(jī) 2021-07-02 14:07:36
我正在使用 K 均值聚類算法執(zhí)行圖像壓縮。壓縮后得到的圖像是灰度圖像,如何獲得與原始圖像質(zhì)量相近的彩色圖像?import osfrom skimage import iofrom sklearn.cluster import  MiniBatchKMeansimport numpy as npalgorithm = "full"for f in os.listdir('.'):    if f.endswith('.png'):        image = io.imread(f)        rows = image.shape[0]        cols = image.shape[1]        image = image.reshape(image.shape[0] * image.shape[1], image.shape[2])        kmeans = MiniBatchKMeans(n_clusters=128, n_init=10, max_iter=200)        kmeans.fit(image)        clusters = np.asarray(kmeans.cluster_centers_, dtype=np.uint8)        labels = np.asarray(kmeans.labels_, dtype=np.uint8)        labels = labels.reshape(rows, cols);        #  np.save('codebook'+f+'.npy', clusters)        io.imsave('compressed_' + f , labels);
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 134 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)