2015-09-25 36 views
0

我正在試圖製作一個圖像金字塔,應該只是原始圖像的較小版本。相反,我得到了圖像中看起來像靜態的東西。skimage金字塔Guassian不按預期方式工作

這裏是我的代碼:

img = Image.open('orange.jpg').convert('L') 
in_array = np.array(img) 
for i,arr in enumerate(transform.pyramid_gaussian(in_array, max_layer=6, downscale=2, sigma=1)): 
    Image.fromarray(arr,'L').save('orange-%s.jpg' % i) 

這裏是我輸入:

enter image description here

但這裏的第一個圖像輸出:

enter image description here

+1

輸出將是一個雙數組。 – user2970139

回答

0

..just更小版本的原始圖像的..

如果你的目標是使連續的較小版本的圖像時,thumbnail()功能可以幫你:

from PIL import Image 

img = Image.open("orange.jpg").convert("L") 
w, h = img.size 
for step in range(4): 
    w, h = w/2, h/2 
    print "Now at %dx%d" % (w, h) 
    img.thumbnail((w, h), Image.ANTIALIAS) 
    img.save("orange-%d.jpg" % step)