“數字圖像處理”類的基本要求_第1頁
“數字圖像處理”類的基本要求_第2頁
“數字圖像處理”類的基本要求_第3頁
“數字圖像處理”類的基本要求_第4頁
“數字圖像處理”類的基本要求_第5頁
已閱讀5頁,還剩2頁未讀 繼續免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、2 15 日前提交)1編制一個具有 Winows 圖形界面的應用程序( VB.Net, or Ctt, or C+)2、針關于數字圖像處理的基本功能,設計并且實現一個圖像類,把圖像文件操作、數據存儲及管理、基本的圖像處理 功能包含在該類中,能處理 8 位灰度圖像、8 位索引彩色圖像、24 位真彩色圖像等。VB.NET 環境下的基本內容: 部分成員變量Private BMap As Bitmap 1 Bitmap VB.NET C#中處理圖像的基礎類,用于處理由像素數據怎義的圖像的關于象Private mlmageName As String 1 記錄打開圖像的文件Private mPixels

2、 As Long, mSize As Long 記錄圖像的像素個數及存儲數據的內存大小(以字肖為單位) Private mWith As Long, mHeight As Long 1 圖像寬度、高度Private lmageB() As Byte 存儲灰度圖像數據,一維數組存儲。關于于 8 位圖像,一個像素即是一個字節。每行存儲的字節數必需是 4 的整倍數,需要時添加適當字節。與文件中記錄的內容完全一致部分成員函數Public Function RealmageFile(Optional By Vai FileName As String = ,M) AsInteger If FileNam

3、e = 1,11 Or ir(FileName) = ,H, ThenIf mlmageName = n, Then Exit Function En IfBMap 是一個 Bitmap 關于象,im BMap as BitmapIf Not BMap Is Nothing Then BMap.ispose()如果圖像關于象已經存在,淸除關于象BMap = New Bitmap(FileName)1由圖像文件創建 Bitmap 關于象getBitMapataf)讀取 BMap 關于象中的圖像數據到數組1 putBitMapata()xWmin =0yWmin =0 xWmaxBMap.With

4、11 pictureBox在容器中的寬度yWmax=BMap.Height-l pictureBox在容器中的高度mlmageNameFileNameRaise Eve nt lmageataChange() En FunctionPrivate Function getBitMapataf) As Boolean從 BitMap 關于象里獲取圖像數據*在實際處理程序中一般不采用拷貝備份的做法,可以經過獲得的數據指針,直接操作就可以了。1進程是:鎖泄內存,獲取數據的起始地址,根據圖像類型操作數據,結束鎖左If BMap Is Nothing Then Return False 圖像關于象必需存

5、在,完成實例化im i As Integerim rect AsNewRectangle(O0BMap.WithBMap.Height)1 設置鎖定圖像范圍的矩形zim bmpata As SystemrawingmagingBitmapataBMap ockBits(rect_ rawing.lmaging.lmageLockMoe.ReaonlyBMap.PixelFormat)1 鎖定圖像數據1 Get the aress of the first lineim ptr As IntPtr = bmpata.ScanO 1 獲得圖像數據的起始地址If BMap.PixelFormat =

6、 ImagingPixelFormatFormat8bpplnexe Then如果圖像是 8 位索引圖像,256 彩色,256 灰度圖像m WithBMap.With獲得圖像寬度mHeightBMap.Height獲得圖像髙度mFwith = (mWith + 3) 4) * 由于圖像數據是每行的記錄字節數為 4 的整倍數,估作此調整訃算 mWith+ 3 mFwith = mWithmSize = mFwith * mHeight 圖像數據的大小mPixels = mWith * mHeight1 圖像總像素個數ReimlmageB(mSize-1)眾義一個一維數組,保存圖像數據,用于圖像數

7、據操作System.Runtime.InteropServices.Marshal.Copy(ptrImageB,0,mSize)1 拷 貝數據zmPalette = BMap.Palette 獲得圖像的調色板數據 mlmageType = 0 Elself BMap.PixelFormat = Imaging.PixelFormat.Format24bppRgb ThenmWith = BMap.With mHeight =BMap.HeightmCWith = (mWith *3 +3)4)*4 CSize = mCWith * mHeight mPixels = mWith * mHei

8、ght Reim lmageC(CSize-1)1 Copy the RGB values into the array. System.RuntimeteropServices.Marshal.Copyfptr, ImageC, 0, CSize) mlmageType = 1Reim Cpos(mHeight -1) For i = 0 To mHeight -1Cpos(i) = i *mCWith Nexti1 Cpos 數組紀錄每行在 ImageC 中的起始位置Elself BMap.PixelFormat = ImagingPixelFormatFormat32bppArgb Th

9、en mWith = BMap.WithmHeight =BMap.HeightCSize = mWith * mHeight *4 mCWith = mWith * 4 mPixels = mWith * mHeight Reim lmageC(CSize-1)1 Copy the RGB values into the array. System.RuntimeteropServices.Marshal.Copyfptr, ImageC, 0, CSize) mlmageType = 2En IfBMap.UnlockBits(bmpata)1 解鎖鎖泄的位圖數據mStatus = Tru

10、e Return TrueEn FunctionPrivate Function putBitMapata() AsBoolean If BMap Is Nothing Then Return Falseim rect As New Rectangle(0, 0, BMap.With, BMap.Height)im bmpata As System .rawingmagingBitmapata = BMap 丄 ockBits(rect, _ rawing.lmaging.lmageLockMoe.WriteOnly, BMap.PixelFormat)1 Get the aress of t

11、he first lineim ptr As IntPtr = bmpata.ScanOIf BMap.PixelFormat = Imaging PixelFormat Format8bpplnexe Then mSize = mFwith * mHeight System.RuntimeteropServices.MarshaLCopy(lmageB0ptrmSizeElself BMap.PixelFormatImaging PixelFormatFormat24bppRgb ThenCSize = BMap.With * BMap.Height * 31 Copy the RGB va

12、lues into the array. System.RuntimeteropServices.Marshal.Copy(lmageC0, ptr, CSize) EnIf/eclare an array to hol the bytes of the bitmapThis coe is specific to a bitmap with 24 bits perpixels. 1 Unlock the bits.BMap.UnlockBits(bmpata) Return TrueEn Function3.應用程序的基本要求:顯示圖像(初始圖像,處理進程中的圖像入水縱橫比例.唏放.水平移4、

13、BMP 圖像文件結構,組織圖像數據,實現測試性功能:負片、鏡像、圖像的代數操作,新建圖像BMP Bitmap 關于象的結構: BITMAPFILEHEAER (14Bytes)位圖信息頭 一 BITMAPINFOHEAER( 40Bytes)調色板 一 Palette ( 256Long=256*4Bytes)實際的位圖數據-Image ata:每行存儲的字節數是有效像素數據(8 位圖像二像素數:24 位圖像=像素數字節4 (8bppw3)4)*4:彩色圖像(24bpp=(w 怡+3)4 45.圖像數據組織:調色板、彩色圖像.多波段圖像7 = 0. 2997? + 0. 587& + 0. 1

14、1456、圖像數據統計:直方圖(計算及繪制)、最大最小.方差、爛7.灰度變幻,線性變幻.直方圖均衡化(點運算)8、中值濾波、梯度銳化.卷積處理 frmGraian驅慣化 Ge,j)H,j+-,y)i+i/(/+1j)-/(/,j)I G(fJ) = max(| /(/J + -/(/,J)I,| f(i +1 J)-/(/,I) G(/,j) = (/(/,J +1)-/(/,J)2 + (/(/ + 1,j)-/(/,y)2 G(f,;)=i/(/+ij+i)-/(/,ni+i/(/+1,j)-/(/,;+i)i G(iJ) = rnax(| f(i+1J +1) - /(/, j)|,| /(/ +1 J) - /(/J + l)|)/億刀)+/(= J(/(, +1J +1) (f(i +1J) /億刀)+/(灰竝隕約束悌陵鶴化云S黑址nsn=4埋處9 幾何變幻( Resize,Rotate).幾何校正(Georeferencing)遙感影像、航空影像糾正方法:1、成像模型(IOP, EOP); 2、多項式模型(Georeferencing): 3、分區處理 掃描圖像:1、多項式模型(Georefer

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論