ENVI\IDL 重采样 栅格单元大小设置
2017-07-13 17:32
393 查看
转载自:http://www.cnblogs.com/myyouthlife/archive/2012/07/01/2571785.html
在ENVI\IDL 下图像重采用是用Resize_doit 函数。该函数能用来改变图像的大小和对图像重采样。
该函数有个参数RFACT。
RFACT
Use this keyword to specify a two-element array holding the rebin factors for x and y. The values of RFACT reflect the IDL convention for resizing data. A value of 1 does not change the size of the data. Values less than 1 cause the size to increase; values greater than 1 cause the size to decrease.
从以上可以看出,当Refact的Value大于1 到时候就是 放大图像,小与1就是缩小图像。
通过官方给出的实例:
由于RFACT=[,]是浮点数表示,其重采样比率的计算方法是:采样后分辨率/采样前分辨率。如果原图像是20m,要采样成100m分辨率,RFACT=[100/20,100/20],即RFACT=[5,5],这个好理解。
但是个问题: 1. 如果在不知道原始图像的分辨率的基础上,要定量的设置重采样到30m的时候怎么设置倍数。
问题的解决办法就是在代码中加入获取原始图像的像元大小的代码!
proj=envi_get_projection(fid=fid,PIXEL_SIZE=ps,units=units)
其中ps 为原图像的像元大小。
则可以将帮助中的程序更改如下:
在ENVI\IDL 下图像重采用是用Resize_doit 函数。该函数能用来改变图像的大小和对图像重采样。
该函数有个参数RFACT。
RFACT
Use this keyword to specify a two-element array holding the rebin factors for x and y. The values of RFACT reflect the IDL convention for resizing data. A value of 1 does not change the size of the data. Values less than 1 cause the size to increase; values greater than 1 cause the size to decrease.
从以上可以看出,当Refact的Value大于1 到时候就是 放大图像,小与1就是缩小图像。
通过官方给出的实例:
PRO EXAMPLE_RESIZE_DOIT compile_opt IDL2 ; First restore all the base save files. envi, /restore_base_save_files ; Initialize ENVI and send all errors ; and warnings to the file batch.txt envi_batch_init, log_file='batch.txt' ; Open the input file envi_open_file, 'can_tmr.img', r_fid=fid if (fid eq -1) then begin envi_batch_exit return endif ; Set the POS keyword to process all ; spectral data. Output the result ; to disk. envi_file_query, fid, dims=dims, nb=nb pos = lindgen(nb) out_name = 'testimg' ; Perform the resize calculation. ; Make the output image twice as ; large in both X and Y. Use ; bilinear interpolation. envi_doit, 'resize_doit', $ fid=fid, pos=pos, dims=dims, $ interp=1, rfact=[.5,.5], $ out_name=out_name, r_fid=r_fid END
由于RFACT=[,]是浮点数表示,其重采样比率的计算方法是:采样后分辨率/采样前分辨率。如果原图像是20m,要采样成100m分辨率,RFACT=[100/20,100/20],即RFACT=[5,5],这个好理解。
但是个问题: 1. 如果在不知道原始图像的分辨率的基础上,要定量的设置重采样到30m的时候怎么设置倍数。
问题的解决办法就是在代码中加入获取原始图像的像元大小的代码!
proj=envi_get_projection(fid=fid,PIXEL_SIZE=ps,units=units)
其中ps 为原图像的像元大小。
则可以将帮助中的程序更改如下:
PRO EXAMPLE_RESIZE_DOIT, pixelSizeAfterResample compile_opt IDL2 ; First restore all the base save files. envi, /restore_base_save_files ; Initialize ENVI and send all errors ; and warnings to the file batch.txt envi_batch_init, log_file='batch.txt' ; Open the input file envi_open_file, 'can_tmr.img', r_fid=fid if (fid eq -1) then begin envi_batch_exit return endif ; Set the POS keyword to process all ; spectral data. Output the result ; to disk. envi_file_query, fid, dims=dims, nb=nb pos = lindgen(nb) out_name = 'testimg' ; Perform the resize calculation. ;Make the output image twice as ; large in both X and Y. Use ; bilinear interpolation. envi_doit, 'resize_doit', $ fid=fid, pos=pos, dims=dims, $ interp=1, rfact=[pixelSizeAfterResample/ps,pixelSizeAfterResample/ps], $ out_name=out_name, r_fid=r_fid END
相关文章推荐
- ENVI\IDL 重采样 栅格单元大小设置
- ENVI\IDL 重采样 栅格单元大小设置
- PCB_栅格大小设置
- ENVI 监督分类Max stdev from Mean 参数IDL中的设置
- ArcGIS教程:栅格数据的单元大小
- ENVI 监督分类Max stdev from Mean 参数IDL中的设置
- U盘格式化时分配单元的大小的设置
- 设置上传文件的最大大小
- 设置标题和图标,设置窗口大小,设置光标
- 设置tomcat的jvm的虚拟内存大小
- tomcat 设置缓存大小
- 如何设置文件的大小
- tomcat 设置缓存大小
- 利用ASP获取设置图片尺寸大小
- Enterprise Library 2.0中log文件大小设置
- 设置字体大小和取消链接下划线
- 设置上传文件的最大大小
- 修改IIS6的默认设置,扩充上传文件的大小
- 为上传组件设置文件大小限制
- 设置上传文件的最大大小