skimage金字塔Guassian没有按预期工作

时间:2015-09-25 15:21:01

标签: python numpy scipy python-imaging-library scikit-image

我试图制作一个图像金字塔,它应该只是原始图像的较小版本。相反,我在图像中看到了静态的东西。

这是我的代码:

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 个答案:

答案 0 :(得分:0)

  

..只是原始图像的较小版本..

如果您的目标是制作连续的较小版本的图片,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)