资源描述:
《中南民族大学数字图像处理程序及图像.doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、仅供参考定有错误木有绝对正确实验11—1closeall;clear;f=zeros(40,40);%f(10:30,10:30)=1;subplot(1,3,1);%imshow(f);%F=fft2(f)subplot(1,3,2);%imshow(F);%D=log(1+abs(F));%subplot(1,3,3);imshow(D);1——2clcloadimdemossaturn2subplot(121)imshow(saturn2)i=fftshift(fft2(saturn2));subplot(122)imshow(log
2、(abs(i)),[]),colormap(jet(64)),colorbar;1——3w=imread('text.png');a=w(33:45,88:98);figure;imshow(w);figure;imshow(a);C=real(ifft2(fft2(w).*fft2(rot90(a,2),256,256)));figure;imshow(C,[]);max(C(:));thresh=60;figure;imshow(C>thresh);1——4RGB=imread('autumn.tif');figure(1),imsho
3、w(RGB);I=rgb2gray(RGB);figure(2),imshow(I);J=dct2(I);figure(3),imshow(log(abs(J)),[]),colormap(jet(64)),colorbar;J(abs(J)<10)=0;K=idct2(J)/255;figure(4),imshow(K);1——5——2cr=0.125;sig=imread('cameraman.tif');sig=double(sig)/255;figure(1),imshow(sig);[m_sig,n_sig]=size(sig);
4、sizi=8;snum=64;t=hadamard(sizi);hdcoe=blkproc(sig,[sizisizi],'P1*x*P2',t,t');coe=im2col(hdcoe,[sizisizi],'distinct');coe_temp=coe;[YInd]=sort(coe);[m,n]=size(coe);snum=snum-snum*cr;fori=1:ncoe_temp(Ind(1:snum),i)=0;endre_hdcoe=col2im(coe_temp,[sizisizi],[m_sign_sig],'disti
5、nct');re_sig=blkproc(re_hdcoe,[sizisizi],'P1*x*P2',t,t');re_sig=double(re_sig)/64;figure(2);imshow(re_sig);error=sig.^2-re_sig.^2;MSE=sum(error(:))/prod(size(re_sig));2——1i=imread('pout.tif');imshow(i);figure;subplot(1,2,1);imhist(i);j=histeq(i,64);subplot(1,2,2)imhist(j)2
6、——2f=imread('autumn.tif');gl=imadjust(f,[01],[1,0]);subplot(121);imshow(f);subplot(122);imshow(gl);2——3f=imread('autumn.tif');gl=imadjust(f,[0.50.75],[1,0]);subplot(121);imshow(f);subplot(122);imshow(gl);2——4f=imread('autumn.tif');gl=imadjust(f,[],[],2);subplot(121);imshow
7、(f);subplot(122);imshow(gl);test1I=imread('pout.tif');[row,col]=size(I);imshow(I);K=histeq(I,64)subplot(121)imhist(K);title('直方图均衡化')J=zeros(row,col);fori=1:rowforj=1:colif(I(i,j)<10&&I(i,j)>0)J(i,j)=0.5*I(i,j);elseif(I(i,j)<20)J(i,j)=2*I(i,j)-15;elseif(I(i,j)<30)J(i,j)=0.
8、5*I(i,j)+15;elseJ(i,j)=0.5*I(i,j);endendendJ=uint8(J);subplot(122);imhist(J)title('线形变化')