图像处理课程设计报告.docx
- 文档编号:9048535
- 上传时间:2023-02-02
- 格式:DOCX
- 页数:33
- 大小:1.56MB
图像处理课程设计报告.docx
《图像处理课程设计报告.docx》由会员分享,可在线阅读,更多相关《图像处理课程设计报告.docx(33页珍藏版)》请在冰豆网上搜索。
图像处理课程设计报告
摘要:
MATLAB和Mathematica、Maple并称为三大数学软件。
它在数学类科技应用软件
在数值计算方面首屈一指。
MATLAB可以进行矩阵运算、绘制函数和数据、实现算法、创
用户界面、连
接其他编程语言的程序等,主要应用于工程计算、控制设计、信号处理与通讯、图像处理、信号检测、金融建模设计与分析等领域。
数字图像处理(DigitalImageProcessing)是通过计算机对图像进行去除噪声、增强、复原、分割、提取特征等处理的方法和技术。
数字图像处理的产生和迅速发展主要受三个因素的影响:
一是计算机的发展;二是数学的发展(特别是离散数学理论的创立和完善);三是广泛的农牧业、林业、环境、军事、工业和医学等方面的应用需求的增长。
关键词:
MATLAB,数字图像处理
一.课程设计目的
1、提高分析问题、解决问题的能力,进一步巩固数字图像处理系统中的基本原理与方法。
2、熟悉掌握一门计算机语言,可以进行数字图像的应用处理的开发设计
二.课程设计的内容
MATLABGUI程序设计,利用MATLAB图像处理工具箱。
要求:
按照软件工程方法,根据需求进行程序的功能分析和界面设计,给出设计详细说明。
然后按照自己拟定的功能要求进行程序设计和调试。
以下几点是程序实现的功能。
1)能对图像文件(bmp、jpg、tiff、gif等)进行打开、保存、另存、打印、退出等功能操作。
(2)能对图像进行直方图统计,包括R直方图,直方图统计,直放图均衡,周长和面积计算,区域图面积统计。
(3)能对图像进行图像变化处理,包括小波变换,傅里叶变换,快速傅里叶变化,快速逆变换,傅里叶逆变换,离散余弦变换。
(4)能对图像进行滤波处理,包括低通滤波,平滑滤波,自适应滤波。
(5)能对图像进行频域增强处理,包括同态滤波,高频锐化。
(6)能对图像进行噪声添加处理,包括椒盐噪声,加性噪声,高斯噪声。
(7)能对图像进行图像滤波器处理,包括高通滤波器,低通滤波器。
三、总体方案设计
通过MATLAB的GUI设计界面,实现打开,保存,退出,打印功能,设计对比
示区,功能按钮,实现各种图形处理的基本功能。
四、各个功能模块的主要实现程序
在gui界面上创建一系列的按钮以实现各种功能。
其实现语句如下:
打开程序:
functionOPEN_Callback(hObject,eventdata,handles)
%hObjecthandletoOPEN(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
[name,path]=uigetfile({'*.jpg';'*.bmp';'*.gif';'*.tif'},'ÔØÈëͼÏñ');
ifisequal(name,0)isequal(path,0)
errordlg('ûÓÐÑ¡ÖÐÎļþ','³ö´í');
return
else
x=imread([path,name]);
axes(handles.axes1);
imshow(x);
handles.img=x;
handles.noise_img=x;
guidata(hObject,handles)
end
保存程序:
functionsave_Callback(hObject,eventdata,handles)
%hObjecthandletosave(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
[filename,pathname]=uiputfile({'*.jpg';'*.bmp';'*.gif';'*.tif'},'ͼƬ±£´æΪ');
ifisequal([filename,pathname],[0,0])
errordlg('ûÓб£´æ','³ö´í');
return;
else
file=strcat(pathname,filename);
(handles.axes1);
i=getimage(gca);
imwrite(i,file);
打印程序:
functiondayin_Callback(hObject,eventdata,handles)
%hObjecthandletodayin(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
printpreview
printpreview(f)
退出程序:
functiontuichu_Callback(hObject,eventdata,handles)
%hObjecthandletotuichu(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%hObjecthandletoquit(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
button=questdlg('ÄúÈ·¶¨ÒªÍ˳ö±¾³ÌÐòÂð£¿','È·¶¨²Ù×÷');
switchbutton
case'Yes'
close(gcf);
case'No'
end;
然后制作axes1并建立面板,修改颜色和名称,即界面中的function,再在面板上添加按钮
1.R直方图按钮程序:
functionRZHIFANGTU_Callback(hObject,eventdata,handles)
%hObjecthandletoRZHIFANGTU(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
set(handles.axes1,'HandleVisibility','ON');
axes(handles.axes1);
x=imhist(handles.img(:
:
1));%Ö±·½Í¼Í³¼Æ
x1=x(1:
10:
256);
horz=1:
10:
256;
bar(horz,x1);
set(handles.axes1,'xtick',0:
50:
255);
2.直方图统计按钮:
functionzhifangtutongji_Callback(hObject,eventdata,handles)
%hObjecthandletozhifangtutongji(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
set(handles.axes1,'HandleVisibility','ON');
axes(handles.axes1);
x=imhist(handles.img(:
:
1));%Ö±·½Í¼Í³¼Æ
x1=x(1:
10:
256);
horz=1:
10:
256;
bar(horz,x1);
axes(handles.axes1);
set(handles.axes1,'xtick',0:
50:
255);
%hObjecthandletotongji(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%---Executesonbuttonpressinzhifangtujunheng.
3.直方图统计按钮程序:
functionzhifangtujunheng_Callback(hObject,eventdata,handles)
%hObjecthandletozhifangtujunheng(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
set(handles.axes1,'HandleVisibility','ON');
axes(handles.axes1);
ifisrgb(handles.img)
a=histeq(handles.img(:
:
1));
b=histeq(handles.img(:
:
2));
c=histeq(handles.img(:
:
3));
k(:
:
1)=a;
k(:
:
2)=b;
k(:
:
3)=c;
axes(handles.axes1);
imshow(k);
else
h=histeq(handles.img);
axes(handles.axes1);%Ö±·½Í¼¾ùºâ
imshow(h);
end
%hObjecthandletojunheng(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%---Executesonbuttonpressinmianjijisuan.
4.周长和面积计算程序:
functionmianjijisuan_Callback(hObject,eventdata,handles)
%hObjecthandletomianjijisuan(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
axes(handles.axes1);
y=handles.img;
k=rgb2gray(y);
BW=im2bw(k);%ת»¯Îª¶þֵͼÏñ
[L,N]=bwlabel(BW,4);%±ê×¢¶þ½øÖÆͼÏñÖÐÒÑÁ¬½ÓµÄ²¿·Ö
X=1;%ĬÈÏͼÏñÖÐÖ»ÓÐÒ»¸öÁ¬Í¬ÇøÓò.
[ij]=find(L==X);%½«±ê×¢µÄÇøÓò·Åµ½Ò»¸öÊý×éÖÐ.
bwi=bwselect(L,i,j,4);
p=bwperim(bwi);
perm=sum(sum(p));%Öܳ¤.
area=size(i);%Ãæ»ý.±ê×¢ÇøÓòÏñËصãÊý¾ÍΪÎïÌåÃæ»ý.
imshow(BW);
pa=['ͼÏñÃæ»ýΪ:
'num2str(area)'ÏñËصã'];
pp=['ͼÏñÖܳ¤Îª:
'num2str(perm)'ÏñËØ'];
xxx=[pa,pp];
title(xxx);
%hObjecthandletozhouchanghemianji(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA
%---Executesonbuttonpressinpushbutton8.
5.区域图面积程序
functionquyumianji_Callback(hObject,eventdata,handles)
%hObjecthandletoquyumianji(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
axes(handles.axes1);
y=handles.img;
k=rgb2gray(y);
x=area(k,-2);
title('ÇøÓòÃæ»ýͼµÄ»æÖÆ');
set(gca,'Layer','top');
%hObjecthandletoquyutumianji(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%---Executesonbuttonpressinkuaisufuliyebianhuan.
6.小波变换程序:
functionxiaobo_Callback(hObject,eventdata,handles)
%hObjecthandletoxiaobo(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
axes(handles.axes1);
x=(handles.img);
if(isrgb(x)~=0);
y=rgb2gray(x);
[cA1,cH1,cV1,cD1]=dwt2(y,'bior3.7');
A1=upcoef2('a',cA1,'bior3.7',1);
image(wcodemat(A1,192));
title('½üËÆֵϵÊýA1');
else
[cA1,cH1,cV1,cD1]=dwt2(x,'bior3.7');
A1=upcoef2('a',cA1,'bior3.7',1);
image(wcodemat(A1,192));
end
%hObjecthandletoxiaobobianhuan(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%---Executesonbuttonpressinditonglvbo.
7.傅里叶变换程序:
functionfuliyebianhuan_Callback(hObject,eventdata,handles)
%hObjecthandletofuliyebianhuan(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
axes(handles.axes1);
x=(handles.img);
ifisrgb(x);
i=fft(x);
else
i=fft(x);
end
O=fftshift(i);
imshow(O);
title('ÆÕͨft±ä»»ºóµÄͼÏñ');
%hObjecthandletoft(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
8.快速傅里叶程序:
functionkuaisufuliyebianhuan_Callback(hObject,eventdata,handles)
%hObjecthandletokuaisufuliyebianhuan(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
axes(handles.axes1);
x=(handles.img);
ifisrgb(x)
i=fftn(x);
else
i=fft2(x);
end
O=fftshift(i);
imshow(O);
title('fft±ä»»ºóµÄͼÏñ');
%hObjecthandletofft(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%---Executesonbuttonpressinnibianhuan.
9.快速逆变换程序;
functionnibianhuan_Callback(hObject,eventdata,handles)
%hObjecthandletonibianhuan(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
axes(handles.axes1);
x=(handles.img);
ifisrgb(x)
i=ifftn(x);
O=fftshift(i);
imshow(O);
title('ifft±ä»»ºóµÄͼÏñ');
else
i=ifft2(x);
O=fftshift(i);
imshow(O);
title('ifft±ä»»ºóµÄͼÏñ');
end
%hObjecthandletoifft(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
10.傅里叶逆变换程序:
functionfuliyenibianhuan_Callback(hObject,eventdata,handles)
%hObjecthandletofuliyenibianhuan(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
axes(handles.axes1);
x=(handles.img);
ifisrgb(x)
i=ifft(x);
else
i=fft(x);
end
O=ifftshift(i);
imshow(O);
title('ÆÕͨift±ä»»ºóµÄͼÏñ');
%hObjecthandletoift(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
11.离散余弦变化程序:
functionyuxuanbianhua_Callback(hObject,eventdata,handles)
%hObjecthandletoyuxuanbianhua(seeGCBO)
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
axes(handles.axes1);
x=(handles.img);
if(isrgb(x)~=0);
y=rgb2gray(x);
i=dct(y);
imshow(i);
title('DCT±ä»»ºóµÄͼÏñ');
else
i=dct(x);
imshow(i);
title('DCT±ä»»ºóµÄͼÏñ');
end
%hObjecthandletodct(seeGCBO)
%eventdatareserved-tobe
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 图像 处理 课程设计 报告