ENVI/IDL读取tif(遥感)影像,并获取其行列数

附:ENVI/IDL关键字及关键函数的意思可参考:https://blog.csdn.net/weixin_43955546/article/details/104745753
读取tif图像:
1.IDL读取:

pro read_tif
file='D:\F\corona\test\mosaic_match\mosaic.tif'
data=read_tiff(file)
data_d=size(data,/dimensions)
print,'sample',data_d(0)
print,'line',data_d(1)
end

结果:

ENVI> read_tif
% Compiled module: READ_TIF.
sample       13384
line        5525

sample,图像的列数,line,图像的行数
2.ENVI/IDL读取:
1)ENVI CLASSIC /IDL读取:

pro read_tif
envi_open_file,'D:\F\corona\test\mosaic_match\mosaic.tif',r_fid=tiff_fid
envi_file_query,tiff_fid,dims=tiff_dims
data=envi_get_data(fid=tiff_fid,dims=tiff_dims,pos=[0])
print,tiff_dims
end

print 结果:

ENVI> print,tiff_dims
          -1           0       13383           0        5524

(因为图像从0开始编号,所以tiff图像的实际有13384列,5525行)
2)ENVI/IDL读取:

file='D:\F\corona\test\mosaic_match\mosaic.tif'
raster=envi.openraster(file)
print,'sample',raster.ncolumns
print,'row',raster.nrows
发布了39 篇原创文章 · 获赞 5 · 访问量 3068

猜你喜欢

转载自blog.csdn.net/weixin_43955546/article/details/104745416