在图像PIL中导入具有Python像素值的TIF图像

时间:2014-12-30 03:35:31

标签: python image import python-imaging-library

我有一个TIF图像(32位,浮点数)

enter image description here

我需要用Python导入

from PIL import Image, ImageDraw
image = "C:\\foo.tif"
im = Image.open(image).convert('F')
im.getextrema()
(0,0)
data = np.array(im)
>>> data
array([[ 0.,  0.,  0., ...,  0.,  0.,  0.],
       [ 0.,  0.,  0., ...,  0.,  0.,  0.],
       [ 0.,  0.,  0., ...,  0.,  0.,  0.],
       ..., 
       [ 0.,  0.,  0., ...,  0.,  0.,  0.],
       [ 0.,  0.,  0., ...,  0.,  0.,  0.],
       [ 0.,  0.,  0., ...,  0.,  0.,  0.]], dtype=float32)

极值为0和0,但在原始图像(32位,浮点数)中,min为301.4110107421875,最大值为4563.666015625

当我尝试绘制图像时,我有一个空图

import pylab as pl

pl.imshow(im)
pl.show()

0 个答案:

没有答案