is there a way to open BSQ file format in IDL? thanks in advance.
|
|
Are you using IDL with ENVI, or by itself? If you're using IDL with ENVI (by far the easiest if you have ENVI) then the standard ENVI file reading commands will work. For example:
If you don't have ENVI then it is a bit harder. You can read the BSQ data by using standard IDL binary file reading commands (see http://www.msi.umn.edu/software/idl/tutorial/idl-rwd.html#Reading%20Binary%20Data but you'll need to know the dimensions of the image (samples, lines and bands) to be able to split it up sensibly. This information is often stored in a .hdr file, which ENVI reads automatically when you use the method above. |
|||
|
|
|
IDL reads Band Sequential (BSQ) binary file format structure as [Column,Row,Band] BSQ, BIL and BIP are multiband encodings where: a 8-bit Grey scale image would encode 1 band of data a 24-bit RGB additive color image would be 3 bands of data a 32-bit CMYK subtractive color image would be 4 bands of data Discrete multispectral images, or contiguous hyperspectral images would have increasing numbers of bands. So, as noted by @robintw you need to know the dimensions, and the source/sensor of your image. Other than the BSQ encoding, you need to know four things to read the data into an IDL interactive array. You need the Column count, the Row Count, the Band count and the Data type. Of course for any geospatial work outside IDL you would need to know the nominal pixel size and coordinates of at least 3 control points for image registration. And additional details to populate an ESRI Grid World file. For decoding your BSQ data, IDL binary data type choices are 0 Undefined 1 Byte 2 Integer 3 Longword Integer 4 Floating point 5 Double-precision floating 6 Complex 7 String 8 Structure 9 Double-precision complex 10 Pointer 11 Object reference 12 Unsigned Integer 13 Unsigned Longword Integer 14 64-Bit Integer 15 Unsigned 64-Bit Integer So with the minimum info at hand: To "open" the data you create a new IDL Procedure
make array of (columns,rows,bands) assign to working_array
open the bsq_image for reading
nested loops to read-in binary_values
for each band
for each row
for each column
read the binary_value of type from the bsq_image
write the data to the working_array
display working_array ;;ordered as needed for false color aesthetics
|
|||||||
|
|
I don't have experience with either bsq or idl, but since gdal supports bsq, you could try using gdal_translate to convert your file to a geotiff. IDL seems to support reading tif files. |
|||
|
|