读取两张 dat 影像文件,堆叠在一起,并在envi里显示
要求:1.在ENVI+IDL里打开,不是ENVI_CLASSIC+IDL
2.需改成绝对路径:
File1 = ‘D:\F\idl_test\LasVegasMay1985.dat’
File2 = ‘D:\F\idl_test\LasVegasMay2005.dat’
3.程序中所需要的文件:
链接:https://pan.baidu.com/s/1DLHfCzCmFFKtIEwjhYHvqQ
提取码:qkju
程序中所需要的文件:
pro build_band_stack
; Start the application
e = ENVI()
; Select a Landsat TM scene from 1985
File1 = 'D:\F\idl_test\LasVegasMay1985.dat'
Raster1 =e.OpenRaster(File1)
; Select a Landsat TM scene from 2005
File2 = 'D:\F\idl_test\LasVegasMay2005.dat';要写成绝对路径
Raster2 =e.OpenRaster(File2)
; Get the red band (2) from the 1985 scene.
; Bands are zero-based.
RedRaster1 = ENVISubsetRaster(Raster1, BANDS=1)
; Get the red band (2) from the 2005 scene.
RedRaster2 = ENVISubsetRaster(Raster2, BANDS=1)
; Get the task from the catalog of ENVITasks
Task = ENVITask('BuildBandStack')
; Define inputs
Task.INPUT_RASTERS = [RedRaster1, RedRaster2]
; Run the task
Task.Execute
a=Task.OUTPUT_RASTER
; Add the output to the Data Manager
e.Data.Add, Task.OUTPUT_RASTER
; Display the result
View = e.GetView()
Layer1 = View.CreateLayer(Task.OUTPUT_RASTER)
Layer2 = View.CreateLayer(Task.OUTPUT_RASTER, BANDS=[1])
View.Zoom, /FULL_EXTENT
View.Animate, 2.0, /FLICKER
end