圖形圖像處理課程設(shè)計報告_第1頁
圖形圖像處理課程設(shè)計報告_第2頁
圖形圖像處理課程設(shè)計報告_第3頁
全文預(yù)覽已結(jié)束

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、 abstract sketch picture processing has a very close contact with modernization life , so as the technology and research . as the sketch picture processing techniques fast development , peoples life are subjected to very big of influence. in the course design ,i have mainly practiced the basic opera

2、tion sketch picture processing , which contains ash degree square diagram ,the rui turn of pictures and smooth etc. according to these principle of the picture processing , including the ash degree of picture , and the picture strengthen filter etc., i use the c# language realized the picture proces

3、sing operation. key word: sketch picture processing,ash degree square diagram,rui turn,smooth 摘 要 圖形圖像處理是和現(xiàn)代化生活緊密聯(lián)系不可分的,還有對科研方面等都有很大的貢獻。今年來隨著圖形圖像處理技術(shù)的快速發(fā)展,人們的生活都受到了很大的影響。 在這次課程設(shè)計中,我主要練習(xí)了圖像處理基本的操作,包括圖像的灰度直方圖,圖像的銳化以及平滑等等。根據(jù)這些圖像處理的原理,包括圖像的灰度,圖像增強濾波器等等,用c#語言實現(xiàn)了上述的圖像處理操作。 關(guān)鍵詞:圖形圖像處理,直方圖,銳化,平滑圖形圖像處理課程設(shè)計報告

4、一. 實驗要求(1). 讀入一幅圖像,要求統(tǒng)計各像素點灰度值并顯示該圖的灰度直方圖(2). 讀入一幅圖像,要求輸出該圖銳化后的圖像(3). 讀入一幅圖像,要求顯示該圖平滑后的圖像二. 實驗設(shè)計1.實驗中的程序界面如下 form1 form2 2.圖像處理設(shè)計 (1). 灰度直方圖對一幅圖所有像素點具有的不同灰度值進行統(tǒng)計并顯示出來,給出了一股圖的所有灰度值的整體描述。實驗中,若以i表示某個灰度值,則有0=i=256,以pixi表示灰度為i的像素點的個數(shù),當畫直方圖的命令由form1傳遞到form2時,即采用gdi+畫出該直方圖 (2). 銳化濾波器是圖像增強濾波器中的一種,它能減弱或消除傅里葉

5、空間的低頻分量,但不影響高頻分量(從視覺效果上來看,就是突出有關(guān)形體的邊緣)。實驗中采用線性銳化濾波器,系數(shù)模板取拉普拉斯算子: (3). 平滑濾波器是圖像增強濾波器中的另一種,它能減弱或消除傅里葉空間中的高頻分量,但不影響高頻分量(從視覺效果上來看,就是把圖像給柔化了)。實驗中采用線性的平滑濾波器,系數(shù)模板取高斯算子:三. 具體實現(xiàn)1. 程序中定義的全局參數(shù)有:from1: public int height, width; public int pix = new int256;form2 : public int hei, wid; public int pie2.傳參:既然涉及到兩個窗

6、體,就必然要在兩個窗體之間傳遞參數(shù),當某副圖片的像素與灰度信息已經(jīng)采集好時,就將灰度值數(shù)組傳遞到form2中,接著用圖形設(shè)備接口函數(shù)畫出灰度直方圖/form1中的代碼private void button1_click(object sender, eventargs e) form2 fm = new form2(this); fm.show();/form2中的代碼public form2(form1 fm) initializecomponent(); hei = fm.height; wid = fm.width; pie = fm.pix;3.圖像灰度直方圖顯示 先在form1中定義

7、函數(shù)統(tǒng)計讀入的圖像的像素點灰度信息,然后調(diào)用form2窗體進行繪圖,代碼如下:/form1中的代碼 height = this.picturebox1.image.height; width = this.picturebox1.image.width; bitmap bitmap = (bitmap)this.picturebox1.image; color pixel; int r = 0, b = 0, g = 0; for (int i = 0; i 256; i+) pixi = 0; for (int i = 1; i width; i+) for (int j = 1; j he

8、ight; j+) pixel = bitmap.getpixel(i, j); r = pixel.r; g = pixel.g; b = pixel.b; int a = (int)(r + b + g) / 3; pixa+; /統(tǒng)計灰度值為a的像素點數(shù)目 /form2中的代碼bitmap image = new bitmap(300, 300); graphics g = graphics.fromimage(image); g.clear(color.white); font font = new font(宋體, 10, fontstyle.bold); brush brush =

9、 brushes.blue; g.drawstring(灰度直方圖, font, brush, new point(15, 10); pen mypen = new pen(brush, 1); /繪制x軸; g.drawline(mypen, 10, 260, 280, 260); g.drawline(mypen, 276, 258, 280, 260); g.drawline(mypen, 276, 262, 280, 260); /繪制y軸; g.drawline(mypen, 10, 10, 10, 260); g.drawline(mypen, 8, 16, 10, 10); g.

10、drawline(mypen, 12, 16, 10, 10); for (int i = 0; i 256; i+) g.drawline(mypen, 10 + i, 260, 10 + i, 260 - (int)(7000 * piei / (hei * wid); if (i % 50 = 0) g.drawstring(i.tostring(), new font(正楷, 8, fontstyle.regular), brush, new point(10 + i, 262); this.picturebox1.image = image;4.圖像銳化處理 如實驗設(shè)計所描述的,采用

11、拉普拉斯算子對原圖像進行銳化,程序如下:int height = this.picturebox1.image.height; int width = this.picturebox1.image.width; bitmap newbitmap = new bitmap(width, height); bitmap oldbitmap = (bitmap)this.picturebox1.image; color pixel; int laplacian = -1, -1, -1, -1, 9, -1, -1, -1, -1 ; /拉普拉斯算子 for (int x = 1; x width

12、- 1; x+) for (int y = 1; y height - 1; y+) int r = 0, g = 0, b = 0; int index = 0; for (int col = -1; col = 1; col+) for (int row = -1; row 255 ? 255 : r; /判斷是否溢出 r = r 255 ? 255 : g; g = g 255 ? 255 : b; b = b 0 ? 0 : b; newbitmap.setpixel(x - 1, y - 1, color.fromargb(r, b, g); this.picturebox2.ima

13、ge = newbitmap;5.圖像平滑處理如實驗設(shè)計所描述的,采用高斯算子對原圖像進行銳化,程序如下:int height = this.picturebox1.image.height; int width = this.picturebox1.image.width; bitmap newbitmap = new bitmap(width, height); bitmap oldbitmap = (bitmap)this.picturebox1.image; color pixel; int gauss = 1, 2, 1, 2, 4, 2, 1, 2, 1 ; /高斯算子 for (

14、int x = 1; x width - 1; x+) for (int y = 1; y height - 1; y+) int r = 0, g = 0, b = 0; int index = 0; for (int col = -1; col = 1; col+) for (int row = -1; row 255 ? 255 : r; r = r 255 ? 255 : g; g = g 255 ? 255 : b; b = b 0 ? 0 : b; /判斷是否溢出 newbitmap.setpixel(x - 1, y - 1, color.fromargb(r, b, g); this.picturebox2.image = newbitmap;6.變換后圖像灰度直方圖顯示 這個模塊同第三個模塊差不多,只是讀取圖像的對象不同:height = this.picturebox2.image.height; width = this.picturebox2.image.width; bitmap bitmap = (bitmap)this.picturebox2.image;四. 實驗結(jié)果1.實驗中采用的圖像如下所示: 2.原圖直方圖顯示 3.銳化后的圖像顯示 4.銳化后的圖像灰度直方圖顯示: 5.平滑后的圖像顯示: 6.平

溫馨提示

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

評論

0/150

提交評論