数字图像处理实验报告.docx_第1页
数字图像处理实验报告.docx_第2页
数字图像处理实验报告.docx_第3页
数字图像处理实验报告.docx_第4页
数字图像处理实验报告.docx_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

数字图像处理实验报告实验一:一.实验目的1.了解图像代数运算、逻辑运算及滤波的意义和手段;2.熟练掌握代数运算、逻辑运算和滤波的方法及应用;3.通过本实验掌握利用MATALB编程实现数字图像处理的代数运算、逻辑运算和滤波。二.实验结果及程序1.图像的代数运算和逻辑运算加法clear;clc;%I = imread(C:UsersAdministratorDesktoplena.jpeg);B = rgb2gray(I);J = imnoise(B,gaussian,0,0.02);subplot(1,2,1),imshow(B);title();subplot(1,2,2),imshow(J);title();K = zeros(220,220);for i = 1:100 C = imnoise(B,gaussian,0,0.02 ); C1 = im2double(C); K = K+C1;endK = K/100;figure;imshow(K);title();结果:减法clear;clc;% I = imread(C:UsersAdministratorDesktoplena.jpeg);B = rgb2gray(I);J = imnoise(B,gaussian,0,0.02);subplot(1,3,1),imshow(B);title();subplot(1,3,2),imshow(J);title();K = imsubtract(J,B);K1 = 255 - K;subplot(1,3,3);imshow(K1);%title();乘法clear;clc;%I = imread(C:UsersAdministratorDesktoplena.jpeg);B = rgb2gray(I);C = immultiply(B,1.3);D = immultiply(B ,2);subplot(1,3,1),imshow(B);title();subplot(1,3,2),imshow(C);title(1,2);subplot(1,3,3),imshow(D);title(2);除法clear;clc;% I = imread(C:UsersAdministratorDesktoplena.jpeg);B = rgb2gray(I);C = double(B);D = C*0.43+90;B1 = uint8(D);D = imdivide(B,B1);subplot(1,2,1),imshow(B);title();subplot(1,2,2),imshow(D,);title();二值运算clear;clc;% I = imread(C:UsersAdministratorDesktoplena.jpeg);B = rgb2gray(I);A = zeros(128);A(40:67,60:100) = 1;subplot(2,3,1);imshow(A);title(A);B = zeros(128);B(50:80,40:70) = 1;subplot(2,3,2);imshow(B);title(B);C = and(A,B);subplot(2,3,3);imshow(C);title();D = or(A,B); subplot(2,3,4);imshow(D);title();E = not(A);subplot(2,3,5);imshow(E);title();2.1图像空域滤波clear;clc;%I = imread(C:UsersAdministratorDesktoplena.jpeg);figure;subplot(2,2,1);A1 = imshow(I);title();B = rgb2gray(I);C = imnoise(B,salt & pepper,0.02);D = imfilter(B,fspecial(average,3);E = medfilt2(B);subplot(2,2,3)imshow(D);title();subplot(2,2,4);imshow(D)title();subplot(2,2,2)imshow(C)title() 程序结果:2.2图像频域滤波%I = imread(C:UsersAdministratorDesktoplena.jpeg);figure;subplot(2,3,1);A = imshow(I);title();B = rgb2gray(I);hs = fspecial(sobel);S = imfilter(B,hs);hp = fspecial(prewitt);P = imfilter(B,hs);B = double(B);%H = 0,1,0;1,-4,1;0,1,0;J = conv2(B,H,same);K =B - J;subplot(2,3,2)imshow(K);title(laplace);C = edge(B,roberts,0.1);subplot(2,3,3)imshow(C);title(robert);subplot(2,3,4)imshow(S);title(sobel);subplot(2,3,5)imshow(P);title(prewitt);结果:实验二:一.实验目的1.了解图像读入、图像变换、信息隐藏的意义和手段;2.熟悉傅里叶的基本性质;3.通过本实验了解离散傅里叶变换的特点4.掌握利用MATALB编程实现数字图像处理的操作。二.实验结果及程序1.读入一幅彩色图像,显示各层图像程序:clear;clc;A = imread(C:UsersAdministratorDesktopai.jpg);A1 = A(:,:,1);A2 = A(:,:,2);A3 = A(:,:,3);figure(1);subplot(2,2,1);B1 = imshow(A);title();subplot(2,2,2);B2 = imshow(A1);title();subplot(2,2,3);B3 = imshow(A2);title();subplot(2,2,4);B4 = imshow(A3);title();结果: 2.图像的离散傅里叶变换程序:clear;clc;I = imread(C:UsersAdministratorDesktoplena.jpeg);subplot(2,3,1);imshow(real(I);title();I = I(:,:,3);fftI =fft2(I);sfftI = fftshift(fftI);RRfdp1 = real(sfftI);IIfdp1 = imag(sfftI);a = sqrt(RRfdp1.2 + IIfdp1.2);a = (a-min(min(a)/(max(max(a)-min(min(a)*225;subplot(2,3,2);imshow(real(a);title();b = angle(fftI);subplot(2,3,3);imshow(real(b);title();theta = 30;RR1 = a*cos(theta);II1 = a*sin(theta);fftI1 = RR1 + i.*II1;C = ifft2(fftI1)*225;subplot(2,3,4);imshow(real(C);title();MM = 150;RR2 = MM*cos(angle(fftI);II2 = MM*sin(angle(fftI);fftI2 = RR2 + i.*II2;D = ifft2(fftI2);subplot(2,3,5);imshow(real(D);title();结果:3.图像的信息隐藏程序: clear all;clcclose all%=% read image%=mat = imread(C:UsersAdministratorDesktoplena.jpeg);mbt = imread(C:UsersAdministratorDesktop2.bmp);imgread = rgb2gray(mat);mbt = uint8(mbt);maa,mab = size(imgread);%mba,mbb = size(mbt);md = ones(maa,mab);ma = zeros(2*maa,2*mab);ma = im2uint8(ma);%=% progress the image%=for i=1:1:maa for j=1:1:mab imgread(i,j)=imgread(i,j)-mod(imgread(i,j),4); endend%=%enlarge image%=for j=1:1:mab for i=1:1:maa ma(2*i-1,2*j-1) = imgread(i,j); ma(2*i,2*j-1) = imgread(i,j); ma(2*i-1,2*j) = imgread(i,j); ma(2*i,2*j) = imgread(i,j); mb(2*i-1,2*j-1) = mbt(i,j); mb(2*i,2*j-1) = mbt(i,j); mb(2*i-1,2*j) = mbt(i,j); mb(2*i,2*j) = mbt(i,j); endendma = ma+mb*3;%=% attack%=noise = normrnd(0,0.2,2*maa,2*mab); % Gaussian, uniform,% laplace,salt-pepperma = double(ma);ma = ma+ noise;ma = uint8(ma);figure(1);subplot(2,2,1);imshow(imgread);title();subplot(2,2,2);imshow(mbt,0,1);title();subplot(2,2,3);imshow(ma);title();%subplot(2,2,1);imshow(mb,0,1);subplot(2,2,2);imshow(ma);subplot(2,2,3);imshow(mc); %=% watermark extraction%=for i=1:1:maa for j=1:1:mab a=mod(ma(2*i-1,2*j-1),2)+mod

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论