外文翻译利用离散余弦变换进行图像压缩.docx
《外文翻译利用离散余弦变换进行图像压缩.docx》由会员分享,可在线阅读,更多相关《外文翻译利用离散余弦变换进行图像压缩.docx(24页珍藏版)》请在冰豆网上搜索。
外文翻译利用离散余弦变换进行图像压缩
中文4500字
ImageCompressionUsingtheDiscreteCosineTransform
Abstract
Thediscretecosinetransform(DCT)isatechniqueforconvertingasignalintoelementaryfrequencycomponents.Itiswidelyusedinimagecompression.HerewedevelopsomesimplefunctionstocomputetheDCTandtocompressimages.
ThesefunctionsillustratethepowerofMathematicaintheprototypingofimageprocessingalgorithms.
Therapidgrowthofdigitalimagingapplications,includingdesktoppublishing,multimedia,teleconferencing,andhigh-definitiontelevision(HDTV)hasincreasedtheneedforeffectiveandstandardizedimagecompressiontechniques.AmongtheemergingstandardsareJPEG,forcompressionofstillimages[Wallace1991];MPEG,forcompressionofmotionvideo[Puri1992];andCCITTH.261(alsoknownasPx64),forcompressionofvideotelephonyandteleconferencing.
Allthreeofthesestandardsemployabasictechniqueknownasthediscretecosinetransform(DCT).DevelopedbyAhmed,Natarajan,andRao[1974],theDCTisacloserelativeofthediscreteFouriertransform(DFT).ItsapplicationtoimagecompressionwaspioneeredbyChenandPratt[1984].Inthisarticle,IwilldevelopsomesimplefunctionstocomputetheDCTandshowhowitisusedforimagecompression.Wehaveusedthesefunctionsinourlaboratorytoexploremethodsofoptimizingimagecompressionforthehumanviewer,usinginformationaboutthehumanvisualsystem[Watson1993].ThegoalofthispaperistoillustratetheuseofMathematicainimageprocessingandtoprovidethereaderwiththebasictoolsforfurtherexplorationofthissubject.
TheOne-DimensionalDiscreteCosineTransform
Thediscretecosinetransformofalistofnrealnumberss(x),x=0,...,n-1,isthelistoflengthngivenby:
s(u)=
C(u)
u=0,…n
where
foru=0
=1otherwise
EachelementofthetransformedlistS(u)istheinner(dot)productoftheinputlists(x)andbasisvector.Theconstantfactorsarechosensothatthebasisvectorsareorthogonalandnormalized.Theeightbasisvectorsforn=8areshowninFigure1.TheDCTcanbewrittheproductofavector(theinputlist)andthenxnorthogonalmatrixwhoserowsarethevectors.Thismatrix,forn=8,canbecomputedasfollows:
DCTMatrix=
Table[Ifk==0,
Sqrt[1/8],
Sqrt[2/8]Cos[Pi(2j+1)k/16]],
{k,0,7},{j,0,7}]//N;
Wecancheckthatthematrixisorthogonal:
DCTMatrix.Transpose[DCTMatrix]//Chop//MatrixForm
1.0000000
01.000000
001.00000
0001.0000
00001.000
000001.00
0000001.0
00000001.
Eachbasisvectorcorrespondstoasinusoidofacertainfrequency:
Show[GraphicsArray[Partition[
ListPlot[#,PlotRange->{-.5,.5},PlotJoined->True,
DisplayFunction->Identity]&
/@DCTMatrix,2]]];
Figure1.Theeightbasisvectorsforthediscretecosinetransformoflengtheight.
Thelists(x)canberecoveredfromitstransformS(u)byapplyingtheinversecosinetransform
(IDCT):
=
x=0,…,n
where
foru=0
=1otherwise
Thisequationexpressessasalinearcombinationofthebasisvectors.ThecoefficientsaretheelementsofthetransformS,whichmayberegardedasreflectingtheamountofeachfrequencypresentintheinputs.
Wegeneratealistofrandomnumberstoserveasatestinput:
input1=Table[Random[Real,{-1,1}],{8}]
{0.203056,0.980407,0.35312,-0.106651,0.0399382,0.871475,-0.648355,0.501067}
TheDCTiscomputedbymatrixmultiplication:
output1=DCTMatrix.input1
{0.775716,0.3727,0.185299,0.0121461,-0.325,-0.993021,0.559794,-0.625127}
Asnotedabove,theDCTiscloselyrelatedtothediscreteFouriertransform(DFT).Infact,itispossibletocomputetheDCTviatheDFT(see[Jain1989,p.152]):
Firstcreateanewlistbyextractingtheevenelements,followedbythereversedoddelements.ThenmultiplytheDFTofthisre-orderedlistbyso-called"twiddlefactors"andtaketherealpart.Wecancarryoutthisprocessforn=8usingMathematica'sDFTfunction.
DCTTwiddleFactors=N@Join[{1},
Table[Sqrt[2]Exp[-IPik/16],{k,7}]]
{1.,1.38704-0.275899I,1.30656-0.541196I,1.17588-0.785695I,1.-1.I,0.785695-1.17588I,0.541196-1.30656I,0.275899-1.38704I}
ThefunctiontocomputetheDCTofalistoflengthn=8isthen:
DCT[list_]:
=Re[DCTTwiddleFactors*
InverseFourier[N[list[[{1,3,5,7,8,6,4,2}]]]]]
NotethatweusethefunctionInverseFouriertoimplementwhatisusuallyinengineeringcalledtheforwardDFT.Likewise,weuseFouriertoimplementwhatisusuallycalledtheinverseDFT.ThefunctionNisusedtoconvertintegerstorealsbecause(inVersion2.2)FourierandInverseFourierarenotevaluatednumericallywhentheirargumentsareallintegers.Thespecialcaseofalistofzerosneedstobehandledseparatelybyoverloadingthefunctions,sinceNoftheinteger0