毕业论文(设计)基于GDI+ 的图像快速处理05517.doc

上传人:laozhun 文档编号:3974121 上传时间:2023-03-30 格式:DOC 页数:8 大小:311KB
返回 下载 相关 举报
毕业论文(设计)基于GDI+ 的图像快速处理05517.doc_第1页
第1页 / 共8页
毕业论文(设计)基于GDI+ 的图像快速处理05517.doc_第2页
第2页 / 共8页
毕业论文(设计)基于GDI+ 的图像快速处理05517.doc_第3页
第3页 / 共8页
毕业论文(设计)基于GDI+ 的图像快速处理05517.doc_第4页
第4页 / 共8页
毕业论文(设计)基于GDI+ 的图像快速处理05517.doc_第5页
第5页 / 共8页
点击查看更多>>
资源描述

《毕业论文(设计)基于GDI+ 的图像快速处理05517.doc》由会员分享,可在线阅读,更多相关《毕业论文(设计)基于GDI+ 的图像快速处理05517.doc(8页珍藏版)》请在三一办公上搜索。

1、基于GDI的图像快速处理刘海砚 安晓亚信息工程大学测绘学院河南省郑州市陇海中路66号0700# 450052Email:liu2000摘 要:本文利用GDI+在图像处理方面的新特点,说明了基于GDI+的图像基本操作、空间滤波增强、图像的灰度化及伪彩色处理、图像的编码解码、多格式转化等处理方法,为地理信息系统中图像数据的快速处理提供了新方法。关键词:GDI+;图像处理;地理信息系统;1概述地理信息系统中经常应用图像数据,如卫星遥感数据,扫描地图数据等。因此,如何有效、快速地对图像进行加工、改造,使之有利于判读和信息提取是图像处理过程中的一个基本问题。然而,目前从底层开发的图像处理模块或系统都是基

2、于GDI的,对图像的基本操作和处理十分繁琐。GDI是GDI的升级版,是Windows操作系统的子系统,提供了大量的处理矢量图形、图象处理和版式的方法,在GDI的基础上添加许多新特性并对GDI功能进行优化,而且在图像处理方面与GDI相比,GDI+则更具有优势。本文将GDI+应用于图像的基本操作、图像的空间滤波增强、图像的灰度化及伪彩色处理和图像的编码解码和多格式转化等方面,取得了良好的实验效果。从而为更进一步有效地处理图像数据打下良好的基础。2 图像的基本操作2.1图像的打开与显示以位图为例,在GDI中打开一幅图片所需的程序代码多在4行以上。比如显示一幅位图(BMP),需要装入位图、读取位图文件

3、格式头信息、启用设备环境、位传输等等,如果是JPEG,GIF等图像,还需要编写复杂冗长的解码算法,如果要以某种特定的形式显示出来则需要更多的程序代码来实现。而在GDI中则只需一行就能实现图像的打开与显示。这是因为在GDI中没有DIB、DDB这样的概念,更没有BMP文件头、BMP调色板这些数据结构。GDI主要使用两个类来实现图像的管理和维护:Image类和Bitmap类。在Image类的构造函数中,可以直接加载图片供开发者使用。对于图像的显示,GDI主要使用DrawImage函数来完成,该函数有15种重载形式可以使图像显示更加灵活。以下代码用来装载和显示一幅遥感影像:void CGTestVie

4、w:OnDraw(CDC* pDC)this-RedrawWindow();Graphics graphics(pDC-m_hDC);Image image(Lg2004101009214136.bmp);/装载图像graphics.DrawImage(&image,0,0);/显示图像显示后的图像如图1所示:图1图像的打开与显示2.2使用插补模式控制图像的缩放质量当对图像进行缩放处理时,图像会出现不同程度的模糊。在GDI中采用插补模式来对这种模糊进行处理。插补模式又称为“插值模式”,是指如何计算两个终点之间的中间值。Graphics对像的插补模式影响着GDI对图像缩放的质量。拉伸图像时,原始

5、图像中的每个象素都必须映射为较大图像中的一组象素;收缩图像时,必须将原始图像中成组的象素映射为较小图像中单个的象素。这种映射算法的效果决定缩放后图像的质量。生成优质缩放图像的算法往往需要较长的处理时间。GDI的InterpolationMode(插值模式)枚举列出了在进行图形缩放时,可以采用:双三次插值、双线性插值、高质量插值、高质量双三次插值、高质量双线性插值、低质量插值,最临近插值等方法。图2是分别采用了最临近、双线性、双三次的插值模式后的缩放图:图2不同的插值模式对图像缩放质量的影响2.3图像的简单旋转在GDI中旋转一幅图像,需要大量的三角函数运算。而在GDI中这一功能的实现非常简单,直

6、接使用Bitmap(Image)对象的RotateFlip(旋转图片)函数就可以实现简单的特殊旋转,若要实现一般的旋转,则只需定义一个矩阵对象matrix实现旋转即可,如图3所示:图3图像的旋转3 GDI在空间滤波增强方面的应用在获取图像的过程中,由于多种因素的影响,导致图像质量多少会有些退化。图像增强的目的在于:采用一系列技术改善图像的视觉效果,提高图像的清晰度;将图像转换成一种更适合于人或机器进行分析处理的形式。图像增强主要包括波谱信息增强和空间信息增强。在波谱信息增强中,每一个像元都是一个独立的运算单位,其运算过程和结果一般都与其他像元灰度无关,这种情况一般称之为点运算。空间信息增强则以

7、重点突出图像上某些特征为目的,因此通过像元与周围相邻像元的关系进行运算,也称邻域运算。而空间信息增强又包括空间滤波增强和频域滤波增强。3.1图像平滑图像平滑也叫低通滤波,目的在于消除图像中各种干扰噪声,使图像中高频成分去掉,平滑图像的细节,使其反差降低,保存低频成分,以反映图像上的地形整体概貌。本文主要利用GDI实现了比较简单的均值平滑。均值平滑是将每个像元在以其为中心的区域内取平均值来代替该像元值,以达到平滑的目的。这是GDI在图像处理方面的高级应用。GDI中位图类(Bitmap)提供了两个成员函数GetPixel()和SetPixel(),前者主要是用来获取位图中指定象素的颜色,后者主要是

8、用来设置位图对象中指定象素的颜色。又由于GDI中的Color结构体支持矩阵形式,因此可采用以下方法平滑图像:先定义一个3*3的Color对象,利用函数GetPixel()获取周围9个点的RGB值存入到Color数组中,然后分别求出周围9个点的R、G、B之和将其平均值作为当前点的RGB值,最后利用函数SetPixel()将计算后的RGB值回写到位图。图4是平滑前和平滑后的遥感影像对比图:图4图像的平滑(左图为平滑前,右图为平滑后)3.2 图像锐化锐化也叫高通滤波,主要是增强图像中的高频成分,突出图像的边缘信息,提高图像细节的反差,所以也叫边缘增强,其结果与平滑相反,主要反映的是局部细节的起伏变化

9、。常见的锐化算子有严格的数学基础,为简单起见,这里采用的算法是将要处理的象素与它左对角线的像素之间的插值乘一个锐化系数,然后再加上原先的象素值就能够得到锐化效果。如图5所示:图5图像的锐化(左图为锐化后,右图为锐化前)另外,由于GDI对阈值(Threshold)的支持,使得可以用阈值进行图像的锐化处理。在GDI中利用ImageAttributes对象的SetThreshold(设置阈值)函数可以设置输出图片时所用的阈值。4 GDI在图像灰度化及伪彩色处理方面的应用在日常的工程应用中,为加快处理速度需要把彩色图像转换成灰度图像。解决这个问题的方法是将每个象素用三个字节表示R、G、B分量的彩色图像

10、转换为每个象素用一个象素表示的灰度图像,灰度化的关键是使色彩的三种颜色分量值都相等,具体方法有最大化法、平均值法、加权平均值法等。在本文中利用位图类(Bitmap)提供的成员函数GetPixel()对一幅图像的每个的RGB值进行访问,利用平均值法对这些象素进行重新计算,灰度处理工作就会变得很简单了。灰度图像转换为彩色图像,技术上称为灰度图像的伪彩色处理。在转换过程中常采用的技术是“灰度级彩色”变换,意思是对灰度图像上的每一个象素点,取得该点的灰度值并送入三个通道,经过实施不同的变换,产生相应的R、G、B的亮度值。本文采用的变换函数是线性分段变换函数。在具体编程的过程中同灰度处理类似,逐一读取灰

11、度图像的每一个像素值,然后根据变换进行伪彩色还原。下图是灰度化和伪彩色处理后的结果:图6灰度图像及伪彩色处理5 GDI+在图像的编码解码与多格式转换方面的应用图像的编码与解码是数字图像处理中的重要内容。在图像文件中,编码代表对图像文件数据的一种组织形式,它包含数据的压缩、色彩的映射(调色板)之类的概念。而解码则表示软件对图像文件数据的解析方式。不同格式的图像文件对应着不同的编码解码方式。图像的编码解码与多格式转换是GDI精华的一部分,是GDI优于GDI的一个重要体现,尤其是在高效的处理多格式图片方面。在GDI编程中,程序开发人员感到麻烦的是对各种图像文件格式的处理,因为常见的图像文件格式较多,

12、开发人员不可能、也没有精力去应对复杂的文件格式定义,而GDI恰恰支持这些常见的图像格式。GDI提供了对常见图像文件所有编码、解码的支持。可以使用GeiImageEncoders(获得图像编码)和GetImageDecoders(获得图像解码)函数对系统可用的解码器信息进行逐一查询。要将一种格式的文件转换成另一种格式的文件进行保存,只需找出要保存的格式的图像文件的解码器,并在使用Image类的Save函数时,将这个编码器的信息作为Save函数的参数,就能够实现格式的转换。另外,GDI还提供了对JPEG进行不同的压缩质量控制。以上这些工作在GDI中需要大量的工作去实现。下图是将BMP格式的图像保存

13、为JPEG格式的图像,并控制其压缩质量:图7保存成JPEG文件6 结论实践证明,GDI+对图像的基本操作和处理具有功能强大、操作简单、易于理解、视觉效果良好等优点。鉴于此,完全可以将GDI+应用于地理信息系统中的图像处理。参考文献:1. 周鸣杨,赵景亮.精通GDI编程M.北京:清华大学出版社,2004.2. 美Mahesh Chand,韩江等译.GDI图形程序设计M.北京:电子工业出版社,20053. 张永生.遥感图像信息系统M.北京:科学出版社,2000更多测绘论文请登录测绘网论文频道查询:http:/ Editors note: Judson Jones is a meteorologis

14、t, journalist and photographer. He has freelanced with CNN for four years, covering severe weather from tornadoes to typhoons. Follow him on Twitter: jnjonesjr (CNN) - I will always wonder what it was like to huddle around a shortwave radio and through the crackling static from space hear the faint

15、beeps of the worlds first satellite - Sputnik. I also missed watching Neil Armstrong step foot on the moon and the first space shuttle take off for the stars. Those events were way before my time.As a kid, I was fascinated with what goes on in the sky, and when NASA pulled the plug on the shuttle pr

16、ogram I was heartbroken. Yet the privatized space race has renewed my childhood dreams to reach for the stars.As a meteorologist, Ive still seen many important weather and space events, but right now, if you were sitting next to me, youd hear my foot tapping rapidly under my desk. Im anxious for the

17、 next one: a space capsule hanging from a crane in the New Mexico desert.Its like the set for a George Lucas movie floating to the edge of space.You and I will have the chance to watch a man take a leap into an unimaginable free fall from the edge of space - live.The (lack of) air up there Watch man

18、 jump from 96,000 feet Tuesday, I sat at work glued to the live stream of the Red Bull Stratos Mission. I watched the balloons positioned at different altitudes in the sky to test the winds, knowing that if they would just line up in a vertical straight line we would be go for launch.I feel this mis

19、sion was created for me because I am also a journalist and a photographer, but above all I live for taking a leap of faith - the feeling of pushing the envelope into uncharted territory.The guy who is going to do this, Felix Baumgartner, must have that same feeling, at a level I will never reach. Ho

20、wever, it did not stop me from feeling his pain when a gust of swirling wind kicked up and twisted the partially filled balloon that would take him to the upper end of our atmosphere. As soon as the 40-acre balloon, with skin no thicker than a dry cleaning bag, scraped the ground I knew it was over.

21、How claustrophobia almost grounded supersonic skydiverWith each twist, you could see the wrinkles of disappointment on the face of the current record holder and capcom (capsule communications), Col. Joe Kittinger. He hung his head low in mission control as he told Baumgartner the disappointing news:

22、 Mission aborted.The supersonic descent could happen as early as Sunday.The weather plays an important role in this mission. Starting at the ground, conditions have to be very calm - winds less than 2 mph, with no precipitation or humidity and limited cloud cover. The balloon, with capsule attached,

23、 will move through the lower level of the atmosphere (the troposphere) where our day-to-day weather lives. It will climb higher than the tip of Mount Everest (5.5 miles/8.85 kilometers), drifting even higher than the cruising altitude of commercial airliners (5.6 miles/9.17 kilometers) and into the

24、stratosphere. As he crosses the boundary layer (called the tropopause), he can expect a lot of turbulence.The balloon will slowly drift to the edge of space at 120,000 feet (22.7 miles/36.53 kilometers). Here, Fearless Felix will unclip. He will roll back the door.Then, I would assume, he will slowl

25、y step out onto something resembling an Olympic diving platform.Below, the Earth becomes the concrete bottom of a swimming pool that he wants to land on, but not too hard. Still, hell be traveling fast, so despite the distance, it will not be like diving into the deep end of a pool. It will be like

26、he is diving into the shallow end.Skydiver preps for the big jumpWhen he jumps, he is expected to reach the speed of sound - 690 mph (1,110 kph) - in less than 40 seconds. Like hitting the top of the water, he will begin to slow as he approaches the more dense air closer to Earth. But this will not

27、be enough to stop him completely.If he goes too fast or spins out of control, he has a stabilization parachute that can be deployed to slow him down. His team hopes its not needed. Instead, he plans to deploy his 270-square-foot (25-square-meter) main chute at an altitude of around 5,000 feet (1,524

28、 meters).In order to deploy this chute successfully, he will have to slow to 172 mph (277 kph). He will have a reserve parachute that will open automatically if he loses consciousness at mach speeds.Even if everything goes as planned, it wont. Baumgartner still will free fall at a speed that would c

29、ause you and me to pass out, and no parachute is guaranteed to work higher than 25,000 feet (7,620 meters).It might not be the moon, but Kittinger free fell from 102,800 feet in 1960 - at the dawn of an infamous space race that captured the hearts of many. Baumgartner will attempt to break that record, a feat that boggles the mind. This is one of those monumental moments I will always remember, because there is no way Id miss this.

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 办公文档 > 其他范文


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号