【正文】
散余弦變換具有很強(qiáng)的“能量集中”特性:大多數(shù)的自然信號(hào)(包括聲音和圖像)的能量都集中在離散余弦變換后的低頻部分,而且當(dāng)信號(hào)具有接近馬爾科夫過程(Markov processes)的統(tǒng)計(jì)特性時(shí),離散余弦變換的去相關(guān)性接近于KL變換(KarhunenLo232。第2章 圖像壓縮的基本原理數(shù)字圖像從表面上看可以表達(dá)豐富多彩的內(nèi)容,但實(shí)質(zhì)上可以看作在視覺空間靈敏度范圍內(nèi)對(duì)圖像進(jìn)行空間采樣的一個(gè)個(gè)像素組成,每個(gè)象素點(diǎn)都可以用一組一維或多維的數(shù)字來表示,如nbit的灰度圖像的每個(gè)象素由0~2n~l之間的某個(gè)數(shù)值來表示,而真彩色圖像的象素值則由紅(R),綠(G),藍(lán)(B)三種顏色的值來聯(lián)合表示。假設(shè)原始圖像表示A=f(i,j),其中i=l,2,…M;j=1,2,…N,經(jīng)壓縮解壓后的圖像為A’=f’(i,j),i=1,2,…M;j=1,2,…N,可以用下列指標(biāo)進(jìn)行評(píng)價(jià):(1)均方誤差MSN ()(2)規(guī)范化均方誤差NMSN ()其中 (3)對(duì)數(shù)信噪比SNR () (4)峰值信噪比PSNR ()評(píng)價(jià)圖像壓縮效果的另外一個(gè)重要指標(biāo)是壓縮比C,它指的是表示原始圖像每象素的比特?cái)?shù)同壓縮后平均每象素的比特?cái)?shù)的比值,也常用每象素比特值(bpp)來表示壓縮效果。統(tǒng)一的國(guó)際標(biāo)準(zhǔn)是不同國(guó)家地區(qū)和廠商的產(chǎn)品能夠相互兼容和協(xié)調(diào)的基礎(chǔ)。1992年作為靜止圖像壓縮算法的國(guó)際標(biāo)準(zhǔn)正式推出。ⅳ.感興趣區(qū)域壓縮:可以指定圖片上感興趣的區(qū)域(Region of Interest),然后在壓縮時(shí)對(duì)這些區(qū)域指定壓縮質(zhì)量,或在恢復(fù)時(shí)指定某些區(qū)域的解壓縮要求。它是MPEG專家組的第一階段成果,1993年正式通過為國(guó)際標(biāo)準(zhǔn)。MPEG2從技術(shù)上促進(jìn)了計(jì)算機(jī)、廣播電視、數(shù)字通信三大領(lǐng)域的交匯融合,并發(fā)揮出了巨大的作用。ⅲ.自然的與合成的圖像編碼及其混合編碼。對(duì)預(yù)測(cè)的要求是必須較為準(zhǔn)確。統(tǒng)計(jì)編碼消除的是信息熵冗余。大類,前者在解碼時(shí)可以精確地恢復(fù)原圖像,沒有任何損失;后者在解碼時(shí)只能近似原圖像壓縮是通過刪除圖像數(shù)據(jù)中冗余的或者不必要的部分來減小圖像數(shù)據(jù)量的技術(shù),壓縮過程就是編碼過程,解壓縮過程就是解碼過程?! ?。生成的一維字符矩陣即為實(shí)際中要傳輸?shù)男蛄?,壓縮后的圖像數(shù)據(jù)在信道中進(jìn)行傳輸。如RGB圖像則需要一個(gè)三維數(shù)組,3個(gè)數(shù)據(jù)維分別對(duì)應(yīng)于某像素點(diǎn)的紅色、綠色和藍(lán)色強(qiáng)度值。0≤p≤M1,0≤q≤N1其中 JPEG算法被確定為JPEG國(guó)際標(biāo)準(zhǔn),它是國(guó)際上彩色、灰度、靜止圖像的第一個(gè)國(guó)際標(biāo)準(zhǔn)。(3)簡(jiǎn)化公式 在二維離散余弦變換中,通常數(shù)字圖像用像素方陣表示,在這種情況下,二維離散余弦的正反變換可簡(jiǎn)化為: () ()其中在MATLAB的仿真實(shí)現(xiàn)中,主要是采用二維OCT變換的矩陣式定義來實(shí)現(xiàn)的,矩陣義可以表示為: ()其中[f(x,y)]是空間數(shù)據(jù)陣列,[f(x,y)]是變換系數(shù)陣列,[A]是變換矩陣,[A]是[A]的轉(zhuǎn)置。這種實(shí)現(xiàn)方法比調(diào)用函數(shù)dct2要快很多。考慮到用戶是初學(xué)者而且可能是非專業(yè)計(jì)算機(jī)人員,所以晃面的設(shè)計(jì)與使用十分方便,大多數(shù)功能均采用菜單按鈕,用戶只需要利用鼠標(biāo)或鍵盤就能方便地操作它。同一個(gè)M文件中又包含若干個(gè)M函數(shù),界面中的每一個(gè)控件及菜單項(xiàng)對(duì)應(yīng)的程序都有放在相應(yīng)的M函數(shù)內(nèi)。系統(tǒng)的各種處理功能的實(shí)現(xiàn)基本上是四個(gè)過程:其一是打開原始圖像,其二是接收用戶輸入的參數(shù),其三是把接收的參數(shù)帶入后臺(tái)進(jìn)行處理,第四是將圖像處理后的結(jié)果顯示到界面上。(5) 函數(shù)名:uicontrol調(diào)用格式:uicontrol(parent),其功能是生成用戶界面控制圖形對(duì)象。(a) 壓縮前的圖像 (b) 壓縮后的圖像 基于DCT變換矩陣算法的離散余弦變換圖像壓縮。同時(shí)我們發(fā)現(xiàn),與沒使用界面相比,使用界面后圖像壓縮前后對(duì)比效果更加形象直觀,而且操作也非常簡(jiǎn)單。離散余弦變換具有與人眼視覺特性相符的多分辨率分析能力,在時(shí)域和頻域都具有良好的局部化特性,因而成為目前研究的熱點(diǎn)并被廣泛應(yīng)用于圖像編碼領(lǐng)域,取得了很大的成功。同時(shí)也達(dá)到了界面友好,操作簡(jiǎn)單方便的效果。,T,T39。,T39。position39。,h0,... 39?!?。tag39。pushbutton39。callback39。)。b2=uicontrol(39。,39。,... 39。,[... 39。,39。B=blkproc(I,[8 8],39。,... 39。,39。0 0 0 0 0 0 0 0。,... 39。I2=blkproc(B2,[8 8],39。,... 39。points39。style39。position39。39。imshow(BW)39。,... 39。,39。,15,... 39。39。致 謝經(jīng)過半年的忙碌和工作,本次畢業(yè)論文設(shè)計(jì)已經(jīng)接近尾聲,作為一個(gè)本科生的畢業(yè)論文,由于經(jīng)驗(yàn)的匱乏,難免有許多考慮不周全的地方,如果沒有指導(dǎo)老師的督促指導(dǎo),以及一起工作的同學(xué)們的支持,想要完成這個(gè)設(shè)計(jì)是難以想象的。 and CCITT (also known as Px64), for pression of video telephony and teleconferencing.All three of these standards employ a basic technique known as the discrete cosine transform (DCT). Developed by Ahmed, Natarajan, and Rao [1974], the DCT is a close relative of the discrete Fourier transform (DFT). Its application to image pression was pioneered by Chen and Pratt [1984]. In this article, I will develop some simple functions to pute the DCT and show how it is used for image pression. We have used these functions in our laboratory to explore methods of optimizing image pression for the human viewer, using information about the human visual system [Watson 1993]. The goal of this paper is to illustrate the use of Mathematica in image processing and to provide the reader with the basic tools for further exploration of this subject.The OneDimensional Discrete Cosine TransformThe discrete cosine transform of a list of n real numbers s(x), x = 0, ..., n1, is the list of length n given by:s(u)= C(u) u=0,…nwhere for u=0 =1 otherwiseEach element of the transformed list S(u) is the inner (dot) product of the input list s(x) and basis vector. The constant factors are chosen so that the basis vectors are orthogonal and normalized. The eight basis vectors for n = 8 are shown in Figure 1. The DCT can be writthe product of a vector (the input list) and the n x n orthogonal matrix whose rows are the vectors. This matrix, for n = 8, can be puted as follows:DCTMatrix =Table[ If k==0,Sqrt[1/8],Sqrt[2/8] Cos[Pi (2j+1) k/16] ],{k,0,7},{j,0,7}] // N。We apply DCT to our test input and pare it to the earlier result puted by matrix multiplication. To pare the results, we subtract them and apply the Chop function to suppress values very close to zero:DCT[input1]{, , , , , , , }% output1 // Chop{0, 0, 0, 0, 0, 0, 0, 0}The inverse DCT can be puted by multiplication with the inverse of the DCT matrix. We illustrate this with our previous example:Inverse[DCTMatrix] . output1{, , , , , , , }% input1 // Chop{0, 0, 0, 0, 0, 0, 0, 0}As you might expect, the IDCT can also be puted via the inverse DFT. The twiddle factors are the plex conjugates of the DCT factors and the reordering is applied at the end rather than the beginning:IDCTTwiddleFactors = Conjugate[DCTTwiddleFactors]{1., + I, + I, + I, 1. + 1. I, + I, + I, + I}IDCT[list_] := Re[Fourier[IDCTTwiddleFactors list] ][[{1, 8, 2, 7, 3, 6, 4, 5}]]For example:IDCT[DCT[input1]] input1 // Chop{0, 0, 0, 0, 0, 0, 0, 0}The TwoDimensional DCTThe onedimensional DCT is useful in processing onedimensional signals such as speech waveforms. For analysis of twodimensional (2D) signals such as images, we need a 2D version of the DCT. For an n x m matrix s, the 2D DCT is puted in a simple way: The 1D DCT is applied to each row of s and then to each column of the result. Thus, the transform of s is given by u=0,…n v=0,…mwhere for u=0 =1 otherwiseSince the 2D DCT can be puted by applying 1D transforms separately to the rows and columns, we say that the 2D DCT is separable in the two in the onedimensional case, each element S(u, v) of the transform is the inner product of the input and a basis function, but in this case, the basis functions are n x m matrices. Each twodimensional basis matrix is the outer product of two of the oned