版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、信息論與編碼實(shí)驗(yàn)報(bào)告QQ417860489一、實(shí)驗(yàn)?zāi)康?、理解信源編碼的基本原理;2、熟練掌握Huffman編碼的方法;3、理解無失真信源編碼和限失真編碼方法在實(shí)際圖像信源編碼應(yīng)用中的差異。二、實(shí)驗(yàn)設(shè)備與軟件1、PC計(jì)算機(jī)系統(tǒng)2、VC+6.0語言編程環(huán)境3、基于VC+6.0的圖像處理實(shí)驗(yàn)基本程序框架imageprocessing4、常用圖像瀏覽編輯軟件Acdsee和數(shù)據(jù)壓縮軟件winrar。5、實(shí)驗(yàn)所需要的bmp格式圖像(灰度圖象若干幅)。三、實(shí)驗(yàn)內(nèi)容與步驟1、針對(duì)“圖像1.bmp”、“圖像2.bmp”和“圖像3.bmp”進(jìn)行灰度頻率統(tǒng)計(jì)(即計(jì)算圖像灰度直方圖),在此基礎(chǔ)上添加函數(shù)代碼構(gòu)造Hu
2、ffman碼表,針對(duì)圖像數(shù)據(jù)進(jìn)行Huffman編碼,觀察和分析不同圖像信源的編碼效率和壓縮比。(1)各個(gè)圖像的灰度頻率統(tǒng)計(jì)如下(2)對(duì)圖像1進(jìn)行Huffman編碼,得到碼表如下像素值概率分布Huffman編碼(未差分)像素值概率分布Huffman編碼(未差分)像素值概率分布Huffman編碼(未差分)00.0118360001101000.000000011001100110010112000.000000011001100001011010.000000011001100100000001010.01003311001012010.000000011001100001011120.00000
3、0011001100100000011020.000000011001100110011002020.01598310010130.000000011001100100000101030.000000011001100110011012030.000000011001100001100040.0213091111011040.000000011001100110011102040.000000011001100001100150.000000011001100100000111050.0194301110002050.000000011001100001101060.0000000110011
4、00100001001060.000000011001100110011112060.01524101111070.000000011001100100001011070.000000011001100110100002070.000000011001100001101180.022653000011080.000000011001100110100012080.000000011001100001110090.000000011001100100001101090.0133950100112090.0000000110011000011101100.000000011001100100001
5、111100.000000011001100110100102100.012887010001110.000000011001100100010001110.000000011001100110100112110.0000000110011000011110120.0037240110011011120.000000011001100110101002120.0000000110011000011111130.000000011001100100010011130.0140170101112130.0000000110011000100000140.0000000110011001000101
6、01140.000000011001100110101012140.0000000110011000100001150.000000011001100100010111150.000000011001100110101102150.017783101101160.022806000101160.000000011001100110101112160.0000000110011000100010170.000000011001100100011001170.0164751001112170.0000000110011000100011180.000000011001100100011011180
7、.000000011001100110110002180.0000000110011000100100190.000000011001100100011101190.000000011001100110110012190.012412001100200.004404011001111200.000000011001100110110102200.0000000110011000100101210.000000011001100100011111210.0164941010002210.0000000110011000100110220.000000011001100100100001220.0
8、00000011001100110110112220.0000000110011000100111230.000000011001100100100011230.000000011001100110111002230.020192111001240.0189911101011240.000000011001100110111012240.0000000110011000101000250.000000011001100100100101250.0181411100002250.0000000110011000101001260.000000011001100100100111260.00000
9、0011001100110111102260.0000000110011000101010270.000000011001100100101001270.000000011001100110111112270.017126101010280.0211981110111280.000000011001100111000002280.0000000110011000101011290.000000011001100100101011290.000000011001100111000012290.0000000110011000101100300.00000001100110010010110130
10、0.0139580101102300.0000000110011000101101310.000000011001100100101111310.000000011001100111000102310.015326011111320.01028311111001320.000000011001100111000112320.0000000110011000101110330.000000011001100100110001330.000000011001100111001002330.0000000110011000101111340.000000011001100100110011340.0
11、125940011102340.0000000110011000110000350.000000011001100100110101350.000000011001100111001012350.012412001101360.0212701111001360.000000011001100111001102360.0000000110011000110001370.000000011001100100110111370.000000011001100111001112370.0000000110011000110010380.000000011001100100111001380.01355
12、50101012380.0000000110011000110011390.000000011001100100111011390.000000011001100111010002390.015895100011400.0126760011111400.000000011001100111010012400.0000000110011000110100410.000000011001100100111101410.000000011001100111010102410.0000000110011000110101420.000000011001100100111111420.019144110
13、1112420.0000000110011000110110430.000000011001100101000001430.000000011001100111010112430.02472700100440.000000011001100101000011440.000000011001100111011002440.0000000110011000110111450.0155961000011450.000000011001100111011012450.0000000110011000111000460.000000011001100101000101460.01559210000024
14、60.0000000110011000111001470.000000011001100101000111470.000000011001100111011102470.00587211111011480.000000011001100101001001480.000000011001100111011112480.0000000110011000111010490.022113000001490.000000011001100111100002490.0000000110011000111011500.000000011001100101001011500.0132850100102500.
15、0000000110011000111100510.000000011001100101001101510.000000011001100111100012510.014531011010520.000000011001100101001111520.000000011001100111100102520.0000000110011000111101530.005234111110101530.000000011001100111100112530.0000000110011000111110540.000000011001100101010001540.0186201100112540.00
16、00000110011000111111550.000000011001100101010011550.000000011001100111101002550.018734110100560.000000011001100101010101560.00000001100110011110101570.0190691101101570.00000001100110011110110580.000000011001100101010111580.016113100110590.000000011001100101011001590.00000001100110011110111600.000000
17、011001100101011011600.00000001100110011111000610.0180311011111610.00000001100110011111001620.000000011001100101011101620.014222011000630.000000011001100101011111630.00000001100110011111010640.000000011001100101100001640.00000001100110011111011650.0118680001111650.00000001100110011111100660.000000011
18、001100101100011660.017660101100670.000000011001100101100101670.00000001100110011111101680.000000011001100101100111680.00000001100110011111110690.024749001011690.00000001100110011111111700.000000011001100101101001700.018018101110710.000000011001100101101011710.0000000110011000000000720.00000001100110
19、0101101101720.0000000110011000000001730.00624701100101730.0000000110011000000010740.000000011001100101101111740.016758101001750.000000011001100101110001750.0000000110011000000011760.000000011001100101110011760.0000000110011000000100770.0147620110111770.0000000110011000000101780.000000011001100101110
20、101780.012868010000790.000000011001100101110111790.0000000110011000000110800.000000011001100101111001800.0000000110011000000111810.0157061000101810.0000000110011000001000820.000000011001100101111011820.0084701100100830.000000011001100101111101830.0000000110011000001001840.000000011001100101111111840
21、.0000000110011000001010850.0206801110101850.0000000110011000001011860.000000011001100110000001860.017607101011870.000000011001100110000011870.0000000110011000001100880.000000011001100110000101880.0000000110011000001101890.0159051001001890.0000000110011000001110900.000000011001100110000111900.0217551
22、11111910.000000011001100110001001910.0000000110011000001111920.000000011001100110001011920.0000000110011000010000930.0149480111011930.0000000110011000010001940.000000011001100110001101940.013438010100950.000000011001100110001111950.0000000110011000010010960.000000011001100110010001960.00000001100110
23、00010011970.0183431100011970.0000000110011000010100980.000000011001100110010011980.014837011100990.000000011001100110010101990.0000000110011000010101由表中的規(guī)律可以看出,沒4個(gè)像素點(diǎn)中只有一個(gè)的概率不為0,說明此圖進(jìn)行過量化,實(shí)際用到的像素點(diǎn)只有64個(gè)。(3)各幅圖像信源的編碼效率和壓縮比編碼效率():平均每個(gè)碼符號(hào)的最大信息量為logm=log2=1比特/碼符號(hào),平均每個(gè)信源符號(hào)的信息量為H(U)比特/信源符號(hào),平均碼長(zhǎng)為K碼符號(hào)/信源符號(hào),則
24、=H(U)K*logm=H(U)K。壓縮比(L):在進(jìn)行Huffman編碼前,每個(gè)像素由8個(gè)比特位表示,編碼后平均每個(gè)灰度值的碼長(zhǎng)為K,所以L=8/K。編碼效率和壓縮比如下表: 質(zhì)量因子圖像信源熵比特/符號(hào)平均碼長(zhǎng)碼符號(hào)/信源符號(hào)編碼效率壓縮比圖像15.92855.96020.99471.3422圖像24.40974.44360.99241.8003圖像36.70866.73360.99631.1881(4)用到的主要代碼如下:void CImageProcessingDoc:OnImageHuffmancode() int m_Width, m_Height, m_SaveWidth;int
25、 i,j;/循環(huán)變量double hist256 = 0; /概率分布m_Width = m_pDibInit->GetWidth();m_Height = m_pDibInit->GetHeight();m_SaveWidth = m_pDibInit->GetSaveWidth();hx = 0.0;/信源熵km = 0.0; /平均碼長(zhǎng)ys = 0.0; /壓縮比/計(jì)算概率分布for(j=0;j<m_Height;j+)for(i=0;i<m_Width;i+)histm_pDibInit->m_pDibBitsj*m_SaveWidth+i=hist
26、m_pDibInit->m_pDibBitsj*m_SaveWidth + i+1.0/double(m_Width*m_Height);/輸出概率統(tǒng)計(jì)histFILE*fphist; FILE*fpcode; fphist=fopen("hist.txt","w"); fpcode=fopen("code.txt","w"); for(i=0;i<256;i+)fprintf(fphist,"%fn",histi);/計(jì)算Huffman編碼Huffm huffm(256); /實(shí)例
27、化Huffman類huffm.Huffman(hist); /huffm.HuffmanCode(); /進(jìn)行Huffman編碼codetype co; /定義code結(jié)構(gòu)體cofor(i=0;i<256;i+)if(histi=0)continue; hx = hx - histi*log(histi)/log(2);/信源熵 co = huffm.codei; /讀取Huffman編碼 km = km + histi*(256-co.start); /計(jì)算平均碼長(zhǎng)/輸出編碼code for(i=0;i<256;i+)co = huffm.codei; for(j=co.star
28、t;j<256;j+)fprintf(fpcode,"%d",(int)(co.bitsj - '0');fprintf(fpcode,"n");ys = 8/km; /壓縮比 xl = hx/(km); /編碼效率 test = 1; /顯示判據(jù)UpdateAllViews(NULL);2、利用圖像處理軟件Acdsee將“圖像1.bmp”、“圖像2.bmp”和“圖像3.bmp”轉(zhuǎn)換為質(zhì)量因子為10、50、90的JPG格式圖像(共生成9幅JPG圖像),比較圖像格式轉(zhuǎn)換前后數(shù)據(jù)量的差異,比較不同品質(zhì)因素對(duì)圖像質(zhì)量的影響; 不同質(zhì)量的圖
29、像數(shù)據(jù)量如下表:原始105090圖像1302 KB35 KB53 KB142 KB圖像2302 KB32 KB49 KB114 KB圖像3302 KB52 KB78 KB175 KB 由表可見,三幅圖原始大小相同,隨著質(zhì)量因子的減小,數(shù)據(jù)量也均在減小,但各幅圖減小壓縮比并不相同。3、數(shù)據(jù)壓縮軟件winrar將“圖像1.bmp”、“圖像2.bmp”和“圖像3.bmp”分別生成壓縮包文件,觀察和分析壓縮前后數(shù)據(jù)量的差異;壓縮前后數(shù)據(jù)量如下表:圖像1圖像2圖像3壓縮前302 KB302 KB302 KB壓縮后151 KB124 KB218 KB4、針對(duì)任意一幅圖像,比較原始BMP圖像數(shù)據(jù)量、Huffman編碼后的數(shù)據(jù)量(不含碼表)、品質(zhì)因數(shù)分別為10、50、90時(shí)的JPG文件數(shù)據(jù)量和rar壓縮包的數(shù)據(jù)量,分析不同編碼方案下圖像數(shù)據(jù)量變化的原因。以圖像1為例,其原始BMP圖像數(shù)據(jù)量、Huffman編碼后的數(shù)據(jù)量(不含碼表)、品質(zhì)因數(shù)分別為10、50、90時(shí)的JPG文件數(shù)據(jù)量和rar壓縮包的數(shù)據(jù)量
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 汽修維修安裝合同范例
- 學(xué)生代言合同范例范例范文
- 免租金住房合同范例
- 代理茶葉品牌合同范例
- 門窗違約合同范例
- 東航合同范例
- 飯店股東退股合同范例
- 青海師范大學(xué)《班主任與班級(jí)管理》2023-2024學(xué)年第一學(xué)期期末試卷
- 古建磚瓦購銷合同范例
- 商品房裝修合同范例
- 2023-2024學(xué)年廣東省廣州市白云區(qū)九年級(jí)(上)期末語文試卷
- 2024統(tǒng)編版初中八年級(jí)語文上冊(cè)第六單元:大單元整體教學(xué)設(shè)計(jì)
- 五年級(jí)上冊(cè)數(shù)學(xué)試題試卷(8篇)
- 2024-2025學(xué)年四年級(jí)科學(xué)上冊(cè)第三單元《運(yùn)動(dòng)和力》測(cè)試卷(教科版)
- 學(xué)術(shù)規(guī)范與論文寫作智慧樹知到答案2024年浙江工業(yè)大學(xué)
- 2024年典型事故案例警示教育手冊(cè)15例
- 2023年希望杯數(shù)學(xué)培訓(xùn)100題-二年級(jí)(含答案)
- 科研倫理與學(xué)術(shù)規(guī)范 期末考試
- 巴蜀文化知識(shí)考試參考題庫150題(含答案)
- 機(jī)械原理榫槽成型半自動(dòng)切削機(jī)課程設(shè)計(jì)
- QC小組活動(dòng)、地泵泵送混凝土布料澆筑方法改進(jìn)
評(píng)論
0/150
提交評(píng)論