IDL编程实现图像处理文档格式.docx
- 文档编号:18503725
- 上传时间:2022-12-18
- 格式:DOCX
- 页数:9
- 大小:17.08KB
IDL编程实现图像处理文档格式.docx
《IDL编程实现图像处理文档格式.docx》由会员分享,可在线阅读,更多相关《IDL编程实现图像处理文档格式.docx(9页珍藏版)》请在冰豆网上搜索。
tif'
savetif'
Save5=widget_button(fileopt2,value='
dat'
savedat'
fileopt3=widget_button(filemenu,value='
Exit'
exit_event'
/separator)
editmenu=widget_button(mbar,value='
Edit'
processopt1=widget_button(editmenu,value='
K-LTransform'
event_pro='
K_L_event'
processopt2=widget_button(editmenu,value='
HistogramEqualization'
HistogramEqualization_event'
processopt3=widget_button(editmenu,value='
NDVI'
NDVI_event'
processopt5=widget_button(editmenu,value='
ImageSmoothing'
IS_event'
processopt4=widget_button(editmenu,value='
edgeenhancement'
imageopt1=widget_button(processopt4,value='
robort'
robort_event'
imageopt2=widget_button(processopt4,value='
sobel'
sobel_event'
imageopt3=widget_button(processopt4,value='
prewitt'
prewitt_event'
helpmenu=widget_button(mbar,value='
Help'
idlhelp=widget_button(helpmenu,value='
IDLhelp'
help_event'
iconbase=widget_base(tlb,row=1,/frame)
subdir='
resource/bitmaps'
mapfile=filepath('
open.bmp'
subdir=subdir)
iconopt1=widget_button(iconbase,value=mapfile,/bitmap,event_pro='
save.bmp'
iconopt2=widget_button(iconbase,value=mapfile,/bitmap,event_pro='
Save_event'
button5=widget_button(iconbase,value='
new.bmp'
/bitmap,event_pro='
new_event'
button3=widget_button(iconbase,value='
zoom_in.bmp'
/bitmap,uvalue='
suoxiao'
button4=widget_button(iconbase,value='
zoom_out.bmp'
fangda'
help=widget_button(iconbase,value=filepath('
help.bmp'
subdirectory=['
resource'
'
bitmaps'
]),/bitmap,event_pro='
draw=widget_draw(tlb,x_scroll_size=780,y_scroll_size=550,xsize=1000,ysize=1000,xoffset=200,/button_events)
file='
'
data=BYTARR(2,2,2)
pdata=bytarr(2,2,2)
status=0
pstate=ptr_new({draw:
draw,file:
file,data:
ptr_new(data),pdata:
ptr_new(pdata)})
widget_control,tlb,set_uvalue=pstate
widget_control,tlb,/realize
XMANAGER,'
tlb,/no_block
end
proopen_event,event
compile_optIDL2
envi,/restore_base_save_files
envi_batch_init
widget_control,event.top,get_uvalue=pstate
filters=['
*.jpg'
*.bmp'
*.img'
*.tif'
*.jpeg'
*.png'
]
file=DIALOG_PICKFILE(/READ,FILTER=filters)
envi_open_file,file,r_fid=fid
iffideq-1thenreturn
envi_file_query,fid,dims=dims,nb=nb,nl=nl,ns=ns,bnames=bnames
pos=indgen(nb)
(*pstate).file=file
basename=file_basename(file)
f1=strpos(basename,'
.'
type=strmid(basename,f1+1,strlen(basename)-f1)
type=strupcase(type)
widget_control,(*pstate).draw,get_value=draw
wset,draw
CASETYPEOF
'
JPEG'
:
BEGIN
READ_JPEG,FILE,DATA
TV,DATA,/TRUE
*((*PSTATE).DATA)=DATA
END
PNG'
:
READ_PNG,FILE,DATA
JPG'
BMP'
DATA=READ_BMP(FILE)
DAT'
DATA=BYTARR(NS,NL,NB)
OPENR,LUN,FILE,/GET_LUN
READU,LUN,DATA
TVSCL,DATA
FREE_LUN,LUN
END
IMG'
data=bytarr(ns,nl,nb)
data=ENVI_GET_DATA(fid=fid,dims=dims,pos=pos)
WIDGET_CONTROL,(*pstate).draw,GET_VALUE=draw
WSET,draw
tvscl,data,/order
*((*pstate).data)=data
TIF'
DATA=BYTARR(NS,NL,NB)
DATA=ENVI_GET_DATA(FID=FID,DIMS=DIMS,POS=POS)
TVSCL,DATA,/ORDER
TIFF'
ENDCASE
prosave_event,event
file=(*pstate).file
savefile=dialog_pickfile(title='
save'
path='
D:
ifsavefileeq'
thenbegin
void=dialog_message('
Nofile!
/error)
return
endif
a=strpos(savefile,'
b=strlen(savefile)
type=strmid(savefile,a+1,b-a)
casetypeof
begin
file=(*pstate).fname
ENVI_OPEN_FILE,file,r_fid=fid
iffideq-1thenbegin
void=DIALOG_MESSAGE('
fileinputederror'
/information)
ENVI_BATCH_EXIT
return
endif
filename=DIALOG_PICKFILE(title='
choosefilesavedposition'
filter='
write_jpeg,filename+'
.jpg'
*((*pstate).data),/true
end
begin
write_JPEG,savefile,data
png'
write_png,savefile,data
write_bmp,savefile,data
end
write_tiff,savefile,data
openw,lun,binary,/get_lun
writeu,savefile,data
endcase
help,event,/struct
IFevent.SELECTTHENWIDGET_CONTROL,event.TOP,/DESTROY
prohelp_event,evevt
compile_optIDL2
envi,/restore_base_save_files
envi_batch_init
ONLINE_HELP
END
proexit_event,event
help,event,/struct
IFevent.SELECTTHENWIDGET_CONTROL,event.TOP,/DESTROY
proK_L_event,event
envi_batch_init
iffideq-1thenbegin
envi_file_query,fid,dims=dims,nb=nb
pos=lindgen(nb)
envi_doit,'
envi_stats_doit'
fid=fid,pos=pos,dims=dims,mean=avg,eval=eval,evec=evec,comp_flag=5
pc_rotate'
$
fid=fid,pos=pos,dims=dims,mean=avg,eval=eval,evec=evec,$
out_dt=4,out_name=out_name,out_nb=nb,r_fid=r_fid,/forward,/in_memory
envi_file_query,r_fid,dims=dims,nb=nb,ns=ns,nl=nl
data=bytarr(ns,nl,nb)
data=envi_get_data(fid=fid,dims=dims,pos=pos)
window,1,xsize=ns,ysize=nl,title='
spatialprincipalcomponentanalysis'
tv,data,/order
prondvi_event,event
data=*((*pstate).data)
envi_open_file,file,r_fid=fid
envi_file_query,fid,dims=dims,nb=nb,ns=ns,nl=nl
pos=[4,3]-1
envi_doit,'
ndvi_doit'
fid=fid,pos=pos,dims=dims,/check,o_min=0,o_max=255,r_fid=r_fid,/inme_mory
envi_file_query,r_fid,dims=dims,nb=nb,ns=ns,nl=nl
data=BYTARR(ns,nl,nb)
data=ENVI_GET_DATA(fid=r_fid,dims=dims,pos=pos)
window,3,title='
TVSCL,data,/order
proHistogramEqualization_event,event
envi_file_query,fid,dims=dims,nb=nb,ns=ns,nl=nl
WINDOW,1,TITLE='
Theoriginalimagehistogram'
plot,HISTOGRAM(data)
result=HIST_EQUAL(data);
ADAPT_
WINDOW,2,xsize=ns,ysize=nl,TITLE='
histogrammatching'
TV,result,/order
WINDOW,3,TITLE='
Aftertheimagehistogrammatching'
plot,HISTOGRAM(result)
proIS_event,event
data=smooth(*((*pstate).data),3)
smoothing'
tvscl,data,/order
prorobort_event,event
DATA=DATA(*,*,1)
DATA=ROBERTS(DATA)
roberts'
prosobel_event,event
DATA=*((*PSTATE).DATA)
DATA=SOBEL(DATA)
window,1,xsize=ns,ysize=nl,title='
TVSCL,data,/ORDER
proprewitt_event,event
ENVI_OPEN_FILE,file,r_fid=fid
ENVI_FILE_QUERY,fid,dims=dims,nb=nb,ns=ns,nl=nl
IFfidEQ-1THENBEGIN
void=DIALOG_MESSAGE('
window'
ENVI_BATCH_EXIT
RETURN
result=prewitt(*((*pstate).data))
TVSCL,result,/order
*((*pstate).pdata)=result
WIDGET_CONTROL,ev.top,get_Uvalue=pstate
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- IDL 编程 实现 图像 处理