ubuntu pylibtiff的安装
ubuntu 14.04
使用python读取tiff图像
首先需要安装一个pylibtiff
下面下载好deb的安装包
http://ftp.iitm.ac.in/linux/ubuntu/ubuntu/pool/universe/p/pylibtiff/
然后直接安装就行了
之前使用了github上的一个库导致出现如下问题
https://github.com/FabriceSalvaire/PyLibTiff
需要安装swig,libtiff等
最后始终无法编译
测试代码如下:
from libtiff import TIFF
filename = "/home/raoqiang/LabProject/experiment/exp_data/ISBI_3Dsegmentation/train-input.tif"
# to open a tiff file for reading:
tif = TIFF.open(filename, mode=‘r‘)
# to read an image in the currect TIFF directory and return it as numpy array:
image = tif.read_image()
# to read all images in a TIFF file:
for image in tif.iter_images(): # do stuff with image
# to open a tiff file for writing:
tif = TIFF.open(‘filename.tif‘, mode=‘w‘)
# to write a image to tiff file
tif.write_image(image)