Re: How to read a multi-band image with IDL [message #65047] |
Mon, 09 February 2009 09:24 |
Mort Canty
Messages: 134 Registered: March 2003
|
Senior Member |
|
|
shi.bobopan@gmail.com schrieb:
> Hello! I will write a supervised classification programme and want to
> read a multi-band ETM+ image with IDL. But ENVI_GET_DATA function can
> only read one band. It seems that READ_IMAGE function also read gray
> image or RGB imge only. How can I read a multi-band image at one time?
> I am new in IDL. Thank you very much.
Here's how I always do it:
envi_select, title='Choose multispectral image', $
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])
Mort
|
|
|
Re: How to read a multi-band image with IDL [message #65053 is a reply to message #65047] |
Mon, 09 February 2009 06:23  |
Jean H.
Messages: 472 Registered: July 2006
|
Senior Member |
|
|
shi.bobopan@gmail.com wrote:
> Hello! I will write a supervised classification programme and want to
> read a multi-band ETM+ image with IDL. But ENVI_GET_DATA function can
> only read one band. It seems that READ_IMAGE function also read gray
> image or RGB imge only. How can I read a multi-band image at one time?
> I am new in IDL. Thank you very much.
Hi,
from the top of my head, you could
1) open the file via ENVI_OPEN_FILE
2) get the image dimensions and other info (offset etc) via envi_file_query
3) read the data via read_binary
Jean
|
|
|