- 积分
- 3064
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-6-20
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
;保存为图像文件
;windowID-图像显示窗体ID
;windowDims-图像显示窗体大小
;imageFile-保存结果文件名
;type - 保存文件类型,默认为jpg
; 1:JPG; 2:bmp; 3:tiff
PRO SAVEDIFFERENTIMAGE, windowID,windowDims, imageFile,type=type
;置顶为当前显示
WSET,windowID
;拷屏操作
data = TVRD(0,0,windowDims[0],windowDims[1],/true)
CASE type OF
1: WRITE_JPEG, imageFile, data,/true, quality=100
2: WRITE_BMP,imageFIle,data,/RGB
3: WRITE_TIFF,imageFile, data,ORIENTATION =4
ELSE:
ENDCASE
END
;保存显示的图形
PRO TESTSAVEIMAGE
winSize = [420,420]
;直接图形法
data = DIST(400)
;灰度绘制显示
DEVICE,decomposed =1
WINDOW,1,xsize = winSize[0],ysize = winSize[1]
TV,data
;直接保存为jpeg
SAVEDIFFERENTIMAGE,1,winSize, 'c:\temp\1.jpg',/type
;直接保存为tiff
SAVEDIFFERENTIMAGE,1,winSize, 'c:\temp\1.bmp',type =2
;直接保存为bmp
SAVEDIFFERENTIMAGE,1,winSize, 'c:\temp\1.tif',type =3
;伪彩色显示
DEVICE,decomposed =0
LOADCT,5
WINDOW,2,xsize = winSize[0],ysize = winSize[1]
TV,data
;直接保存为jpeg
SAVEDIFFERENTIMAGE,2,winSize, 'c:\temp\2.jpg',/type
;直接保存为tiff
SAVEDIFFERENTIMAGE,2,winSize, 'c:\temp\2.bmp',type =2
;直接保存为bmp
SAVEDIFFERENTIMAGE,2,winSize, 'c:\temp\2.tif',type =3
;对象图形法-灰度图像
oWindow = OBJ_NEW('IDLgrWindow',dimension = winSize,$
title ='灰度图像')
oView = OBJ_NEW('IDLgrView',viewPlane_Rect = [0,0,winSize])
oModel= OBJ_NEW('IDLgrModel')
oImage= OBJ_NEW('IDLgrImage',DIST(400))
;层次体系与绘制
oModel->ADD,oImage
oView->ADD,oModel
oWindow->SETPROPERTY, graphics_tree = oView
oWindow->DRAW
;
oPrint = oWindow.READ()
oPrint->GETPROPERTY, data = data
HELP,data
;后面保存不写了,与SAVEDIFFERENTIMAGE中tvrd后结果一样;
;对象图形法-伪彩色图像
oWindow1 = OBJ_NEW('IDLgrWindow',dimension = winSize,$
title ='伪彩色图像')
oView1 = OBJ_NEW('IDLgrView',viewPlane_Rect = [0,0,winSize])
oModel1= OBJ_NEW('IDLgrModel')
;颜色表
oPalette = OBJ_NEW('IDLgrPalette')
oPalette.LOADCT,5
oImage1= OBJ_NEW('IDLgrImage',DIST(400),PALETTE = oPalette)
;层次体系与绘制
oModel1->ADD,oImage1
oView1->ADD,oModel1
oWindow1->SETPROPERTY, graphics_tree = oView1
oWindow1->DRAW
;
oPrint = oWindow.READ()
oPrint->GETPROPERTY, data = data
HELP,data
;后面保存不写了,与SAVEDIFFERENTIMAGE中tvrd后结果一样;
END
原网址:http://hi.baidu.com/dyqwrp/blog/item/0eb8fa89af1e5aaa0f2444ba.html
|
|