IDL 打开多波段图像
转自:http://blog.csdn.net/rrrrssss00/article/details/4843841
方法1:
pro testEnviImg,path
; compile_opt idl2
; envi,/restore_base_save_files
; envi_batch_init
path = ENVI_PICKFILE(title='pick file')
envi_open_file, path, r_fid=fid
if (fid eq -1) then return
;ENVI_SELECT, fid=fid ,pos=pos
envi_file_query, fid, dims=dims, nb=nb
pos = lindgen(nb)
num_cols = dims[2]-dims[1]+1
num_rows = dims[4]-dims[3]+1
image = fltarr(nb,num_cols,num_rows)
for i=0,nb-1 do image[i,*,*]=$
envi_get_data(fid=fid,dims=dims,pos=pos[i])
tv,image,/true
end
方法2:
pro testenviselect
envi_select,fid=fid, dims=dims,pos=pos
num_cols = dims[2]-dims[1]+1
num_rows = dims[4]-dims[3]+1
num_bands = n_elements(pos)
; BIP array
image = fltarr(num_bands,num_cols,num_rows)
for i=0,num_bands-1 do image[i,*,*] = envi_get_data(fid=fid,dims=dims,pos=pos[i])
tv,image,/true
end
作者:suwenjiang
出处:http://www.cnblogs.com/myyouthlife/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。