Matlab图像处理实验指导书.docx
生命科学与技术学院Eg8telSmog®(pcEesatog7.,MM*4fxM1W9110»上教学<iC>HKKM1) HkMa9Nt<SiiHIt殳帆,力*K为33FMV1tlt.YN>4VfefA!.HfliaARnatk“”HN"为S3A“九nmBtau*M1.k<«“,世OJtamuik低鼻.3a11WitWttA6(nrjM.<J4<IYlK.MHAUfiMZ<t.ftCK11U<nK*(.>4lH.Vkl>力加afrfMJAlfcF*X>z<*,4Mll1ffWU1aWi*AM11m*mOHAHX<<三*.dlfiil冷03MlW<tHfrn*S<o*4BfmftN<Rmt*¾r.Hiir;CR!l,KtJ<0t<HaeKM.aIMtMK-4<trVB>.i<j.Ht.w三FMXitentirtta.it维此*WnnqQ,Br.力优«an。«觥0NO*>*t电IIf)K能,“,.t<evt*n.VR*t>ihwWMMMAtlMRtro,0,,力A”阴It,:力,AthKtftHBACX(t*./K8Wl9力.tta«Her)cn«八9Ma*t*ucctf,MQ打。仇国MUlt4ttRM.W4ltitMn6WM>0>W>*1U<WaSX串a.6UM'E,.SaWiniW,*M*Efl“IMtNgjQiflNMVn«”B匕*和力0m知SJt«<Utti4WJl>4t,-»4*>BMItkiMMU,”勺*391MliS'WilUU>三BWWUMJM÷ltCT*W匕入外,>>>Mlkf44WWV*tf*ll*>hWP*Mfc<lF32*。3,外RHMIBWtWT”“,3,rt,IlKUW*wV«tt*kim<w«*»*wazst,r*WH>M<*F,Mwr<ONMW4t<"IHt科OHG#»©aJ0*AQtff3WnMJW,MMi*4VXyO中,必*3M,:yH!3",<ttlwnMU*mm=wCiiViVDltH>liMr*Fnrrxf、5aW:«BV*naz*«umvu4一mvosff*w三tsww-ia三Mi“iWttif9r3""Nr“5l"7<M'OI>9SXI>W"*>H0l;V但93*V"V-Crtt!7kttUlr¼VVliMJaiNMiMKV4»'MkUWMH41rr<WhMt<*4lkM<MrtK.>A*<.MVWMv.*>Mm*rthMMW3XltViC*»»<1*»»»*FWRUW.。用:.<RAIQM4C.*XkiM<mttnx0*fHt*UMM(ffabrMBrjtcn.t>.a.nti«a«a.“(umA4tsa.iiMinan*«w»iar¾wif)¢4tMHm.fctm.第>>u'tF.H、"",e"n.tfM.«11-A>.awtM-a4QSDS",|*»Qf*<-,<-ex5.ftMfMrn-f>HCfl<-.,-E«m7MtXMHe%2M*ACMiau*<iBWUUwrctNBXIEiRfl1.AHipnmIWKM.M=MUUMMa.MMwwatt>.nntuUDnH<tf*¼Rau2Mn*>M4!.mtad0n«(ncr;«nR<,«5'.mtW4AX<*RH>tI>0!M«*“余炳Q<jmerj>luRjnjM.:«*«*ru.u.vwRntu<ntt4<-tdemwit.rn.IMfXM“3n>NKSiItlS*b4<mb!1汽“tin.amu"<,?,料的这,.9t.*%月Ul火ItlW、公HM<C*mK«45«<«Ki<hHM,MW»2cftnn<lfMttJb*f*.>»«ri>HMi!rit<Rn-umtsw<)tMer;*<uNjn*jM*.I1I三d.IWMMbMMMi.«tMMtitnOMR*<*n史*smk,tt*AAcfvn<n>.aMtt*M>i49fNHKMCl*C2Ff>frft<MTHMrt<.l4.CfRRnMAT-m*rC>3.4<*三2H4.ftMKRRr)t>C>T<¾CW*?.MMWHBSMf74M.W收罐H,JMt*RHVMh4Wttrt4ltHWJJI入器外UlMS,<MffMVMiyBR.tUCW.B*IR<llMrltdllWtRtlAttlRAt-Atf<M.9三Rflt-4<11<>WG1<nlll*tH0<三».ItH"N今M44*NtBrA.ft三d*KC-*XHl*d*1t<*t4*f>nmlC4<Ofc.M1tfUM<IHMVMtat14<*K.<W/*11»«.入MJVC>>"E*tWHA4.0*MIatfdt(7*<w*TUBi6t-WH¼t-4,l«c,*HM腾,*774i/VVi*%AB-r<n,l*H7,.tl<7RVJ<.6*ft郑州上学Madab应用图像处理课程实验指导书电气工程学院生物医学工程系2006年11月试验一MalIab图像显示方法一、试睑目的1 .了解Mathb的基本功能及操作方法2 .练习图像读写和显示函数的运用方法3 .驾驭Matlab支持的五类图像的显示方法二、试验内容1 .图像的读写A)图像读RGB=imread('ngc6543a.jpg');B)图像写先从一个.mat文件中栽入一根图像,然后利用图像写函数imwritc,创建一个bmp文件,并将图像存入其中.loadclownwhosimwrite(×,map,'clown.bmp')C)图像文件格式转换bitmap=imread(,clown.bmp',"bmp');imwrite(bitmap,'clown.png',png');2 .图像显示A)二进制图像的显示BWl=zeros(20,20);%创建仅包含0/1的双精度图像BWI(2:2:18,2:2:18)=1;imshow(BWl,'notruesize');whosBW2=uint8(BWl);figure,imshow(BW2,'notruesize')BW3=BW2=0;%龙软标记汉为Onfigure,imshow(BW3,'notruesize')whosBW=lmread('circles.tif');imshow(BW);figure,imshow(BW);figure,imshow(BW,10O;O01);B)灰度图像的显示I=imread('testpatl.tif');J=filter2(l2;-l-2zI);Imshow(I)figure,imshow(J,)O索引图像的显示loadclown%奘放一幅图像imwrite(×,map,'clown.bmp');%保存为bmp文件imshow(X)imshow(X,map)D)RGB图像的显示I=imread('flowers.tif');imshow(I)RGB=imread('ngc6543a.jpg,);figure,imshow(RGB)imshow(I(:,:,3)%显示第3个颜色重研E)多帧图像的显示mri=uint8(zeros(128,128,1,27);%27帧文件mri.tif初始化forframe=1:27mri(frame),map=imread('mri.tif'zframe);%读入每一帧endimshow(mri(:,:,:,3),map);%显示第3帧figure,imshow(mri(:,:,:,6),map);%显示笫6帧figure,imshow(mri(:,:,:,10),map);%显示第10帧figure,imshow(mri(:,:,:,20),map);%显示第20帧F)显示多幅图像×l,mapl=imread(,forest.tif');×2,map2=lmread('trees.tlf,);subplot(l,2,l),imshow(×l,mapl)subplot(l,2,2),imshow(X2,map2)SIJbPlOt(1,2,1),SUbimage(Xl,mapl)subplot(l,2,2),subimage(X2,map2)三、思索题:1.图像显示时,若不带参数'noruesize',显示效果如何?2 .如何显示RGB图像的某一个颜色重量?3 .如何显示多帧图像的全部帧?如何依据多帧图像创建电影片段?试验二图像运算一、试睑目的I.熟识图像点运算和代数运算的实现方法2. 了解图像J1.何运算的简沽应用3. 了解图像的翎域操作二、试验内容I.图像点运算读入图像ricc.tif,通过图像点运霓变更对比度.rice=imread(,rice.tif,);subplot(131),imshow(rice)I=double(rice);%转换为双精度类型J=I*0.43+60;rice2=uint8(J);%转换为uint8subplot(132),imshow(rice2)J=I*1.5-60;rice3=uint8(J);%转换为Uint8subplot(133),imshow(rice3)2 .图像的代数运算A)图像加法运算I=imread('rice.tif');imshow(I)J=imread(,cameraman.tif);figure,imshow(J)K=imadd(I,J);figure,imshow(K)K2=imadd(IJ,'uintl6');figure,imshow(K2,)RGB=imread('flowers.tif');RGB2=imadd(RGB,50);imshow(RGB)figure,imshow(RGB2)RGB3=imadd