||
深度学习席卷遥感领域,而众所周知,自然图像通常8位存储,数据范围为0-255,而遥感影像通常为16位,数据范围为0-65535,为了方便使用已有模型以及降低存储,一种方法是将16位影像转为8位,这里提供了一种百分比线性拉伸函数,可批量运行,如下:
function y_linear_stretch, raster, respath, percent
; Get the task from the catalog of ENVITasks
Task=ENVITask('LinearPercentStretchRaster')
; Define inputs
Task.INPUT_RASTER = raster
Task.PERCENT = percent
; Define outputs
Task.OUTPUT_RASTER_URI = respath
; Run the task
Task.Execute
return, 0
end
运行示例:
比如对影像raster进行 1%线性拉伸,存储路径名为respath, 则关键代码如下:
flag = y_linear_stretch(raster, respath, 1.0)
若要批量运行,在运行代码中加入for 循环即可,可参考本博文中已有的批量运行代码。
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-4-27 18:23
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社