通过ENVI从遥感影像中随机取点
from Soe: IDL/ENVI 程序,在idl里面compile再运行。
左边是256*256的图像,取500个点去除重复的随机位置

程序如下:
pro randompoints
COMPILE_OPT IDL2 envi,/restore_base_save_files
envi_batch_init
envi_select,fid=fid,dims=dims,title=’打开影像文件’,/BAND_ONLY
if fid eq -1 then return
nl=dims[4]-dims[3]+1 & ns=dims[2]-dims[1]+1
pic=envi_get_data(fid=fid, dims=dims,pos=0)
window,XSIZE=ns*2, YSIZE=nl
tv,pic,0
;设定点数量N
N=500
;取图片的随机下标
sample=round(RANDOMU(seed,N)*ns*nl)
;去除重复点
sample=sample[sort(sample)]
sample=sample[where(sample ne shift(sample,1),count)]
;点值
samp_val=pic[sample]
samp_loc=intarr(ns,nl)
samp_loc[sample]=255
tv,samp_loc,1
file = DIALOG_PICKFILE(/WRITE, FILTER = ‘*.txt’, /OVERWRITE_PROMPT,DEFAULT_EXTENSION=’txt’)
if file eq ” then return
openw,outf,file,/get_lun
printf, outf,”实取点数”,count
printf, outf,”X”,sample mod ns
printf, outf,”Y”,sample/ns
printf, outf,”值”,samp_val
free_lun,outf
ENVI_BATCH_EXIT
end
Related posts:
About this entry
You’re currently reading “通过ENVI从遥感影像中随机取点,” an entry on Geoinformatics
- Published:
- 9.26.07 / 6下午
- Tags:
- 遥感
Ajax ArcGIS Dreams Flex Geography Geoinformatics GeoRSS GIS Google Hardware Harvard History Jquery Linux Love Map MapServer NASA OGC OpenGIS OSGeo PHP Politics PostGIS PostgreSQL Python R Social Network SVG Ubuntu Web WebGIS Wordpress 中国 历史地理 宋朝 开源 新儒学 生活 遥感
WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.














赵 博 (Bo Zhao),
参与或主持的项目
No comments
Jump to comment form | comments rss [?] | trackback uri [?]