1、图像处理课程设计报告摘要:MATLAB和Mathematica、Maple并称为三大数学软件。它在数学类科技应用软件在数值计算方面首屈一指。MATLAB可以进行矩阵运算、绘制函数和数据、实现算法、创用户界面、连接其他编程语言的程序等,主要应用于工程计算、控制设计、信号处理与通讯、图像处理、信号检测、金融建模设计与分析等领域。数字图像处理(DigitalImageProcessing)是通过计算机对图像进行去除噪声、增强、复原、分割、提取特征等处理的方法和技术。数字图像处理的产生和迅速发展主要受三个因素的影响:一是计算机的发展;二是数学的发展(特别是离散数学理论的创立和完善);三是广泛的农牧业、
2、林业、环境、军事、工业和医学等方面的应用需求的增长。关键词:MATLAB,数字图像处理一课程设计目的1、提高分析问题、解决问题的能力,进一步巩固数字图像处理系统中的基本原理与方法。2、熟悉掌握一门计算机语言,可以进行数字图像的应用处理的开发设计二. 课程设计的内容MATLAB GUI程序设计,利用MATLAB图像处理工具箱。要求:按照软件工程方法,根据需求进行程序的功能分析和界面设计,给出设计详细说明。然后按照自己拟定的功能要求进行程序设计和调试。 以下几点是程序实现的功能。1)能对图像文件(bmp、 jpg、 tiff、 gif等)进行打开、保存、另存、打印、退出等功能操作。(2)能对图像进
3、行直方图统计,包括R直方图,直方图统计,直放图均衡,周长和面积计算,区域图面积统计。(3)能对图像进行图像变化处理,包括小波变换,傅里叶变换,快速傅里叶变化,快速逆变换,傅里叶逆变换,离散余弦变换。(4)能对图像进行滤波处理,包括低通滤波,平滑滤波,自适应滤波。(5)能对图像进行频域增强处理,包括同态滤波,高频锐化。(6)能对图像进行噪声添加处理,包括椒盐噪声,加性噪声,高斯噪声。(7)能对图像进行图像滤波器处理,包括高通滤波器,低通滤波器。三、总体方案设计通过MATLAB 的GUI 设计界面,实现打开,保存,退出,打印功能,设计对比示区,功能按钮,实现各种图形处理的基本功能。四、各个功能模块
4、的主要实现程序 在gui界面上创建一系列的按钮以实现各种功能。其实现语句如下:打开程序:function OPEN_Callback(hObject, eventdata, handles)% hObject handle to OPEN (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)name,path=uigetfile(*.jpg;*.bmp;*.gif;*.tif,
5、);if isequal(name,0)isequal(path,0) errordlg(,); returnelse x=imread(path,name); axes(handles.axes1); imshow(x); handles.img=x; handles.noise_img=x; guidata(hObject,handles)end保存程序:function save_Callback(hObject, eventdata, handles)% hObject handle to save (see GCBO)% eventdata reserved - to be defi
6、ned in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)filename,pathname = uiputfile(*.jpg;*.bmp;*.gif;*.tif,);if isequal(filename,pathname,0,0) errordlg(,); return;elsefile=strcat(pathname,filename);(handles.axes1);i=getimage(gca);imwrite(i,file);打印程序:function
7、dayin_Callback(hObject, eventdata, handles)% hObject handle to dayin (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)printpreviewprintpreview(f)退出程序:function tuichu_Callback(hObject, eventdata, handles)% hObject
8、handle to tuichu (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% hObject handle to quit (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data
9、 (see GUIDATA)button = questdlg(,);switch button case Yes close(gcf); case No end;然后制作axes1并建立面板,修改颜色和名称,即界面中的function,再在面板上添加按钮1.R直方图按钮程序:function RZHIFANGTU_Callback(hObject, eventdata, handles)% hObject handle to RZHIFANGTU (see GCBO)% eventdata reserved - to be defined in a future version of MAT
10、LAB% handles structure with handles and user data (see GUIDATA)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.直方图统计按钮:function zhifangtutongji_Callback(hObject, eventdata, handles)
11、% hObject handle to zhifangtutongji (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)set(handles.axes1,HandleVisibility,ON);axes(handles.axes1);x=imhist(handles.img(:,:,1); %x1=x(1:10:256);horz=1:10:256;bar(horz,x
12、1);axes(handles.axes1);set(handles.axes1,xtick,0:50:255);% hObject handle to tongji (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % - Executes on button press in zhifangtujunheng.3.直方图统计按钮程序:function zhifangtu
13、junheng_Callback(hObject, eventdata, handles)% hObject handle to zhifangtujunheng (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)set(handles.axes1,HandleVisibility,ON);axes(handles.axes1);if isrgb(handles.img) a
14、=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);elseh=histeq(handles.img);axes(handles.axes1);%imshow(h);end% hObject handle to junheng (see GCBO)% eventdata reserved - to be defined in a future
15、version of MATLAB% handles structure with handles and user data (see GUIDATA) % - Executes on button press in mianjijisuan.4.周长和面积计算程序:function mianjijisuan_Callback(hObject, eventdata, handles)% hObject handle to mianjijisuan (see GCBO)% eventdata reserved - to be defined in a future version of MAT
16、LAB% handles structure with handles and user data (see GUIDATA)axes(handles.axes1);y=handles.img;k=rgb2gray(y);BW = im2bw(k); % L,N = bwlabel(BW,4); % X=1;%.i j=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
17、,pp;title(xxx);% hObject handle to zhouchanghemianji (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA% - Executes on button press in pushbutton8.5.区域图面积程序function quyumianji_Callback(hObject, eventdata, handles)%
18、hObject handle to quyumianji (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)axes(handles.axes1);y=handles.img;k=rgb2gray(y);x=area(k,-2); title();set(gca,Layer,top); % hObject handle to quyutumianji (see GCBO)%
19、eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % - Executes on button press in kuaisufuliyebianhuan.6.小波变换程序:function xiaobo_Callback(hObject, eventdata, handles)% hObject handle to xiaobo (see GCBO)% eventdata reserved -
20、to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)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,bior
21、3.7);A1=upcoef2(a,cA1,bior3.7,1);image(wcodemat(A1,192);end% hObject handle to xiaobobianhuan (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % - Executes on button press in ditonglvbo.7.傅里叶变换程序:function fuliyeb
22、ianhuan_Callback(hObject, eventdata, handles)% hObject handle to fuliyebianhuan (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)axes(handles.axes1);x=(handles.img);if isrgb(x); i=fft(x);else i=fft(x);endO=fftshif
23、t(i);imshow(O);title(ft);% hObject handle to ft (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)8.快速傅里叶程序:function kuaisufuliyebianhuan_Callback(hObject, eventdata, handles)% hObject handle to kuaisufuliyebianhua
24、n (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)axes(handles.axes1);x=(handles.img);if isrgb(x) i=fftn(x);else i=fft2(x);end O=fftshift(i);imshow(O);title(fft); % hObject handle to fft (see GCBO)% eventdata res
25、erved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % - Executes on button press in nibianhuan.9.快速逆变换程序;function nibianhuan_Callback(hObject, eventdata, handles)% hObject handle to nibianhuan (see GCBO)% eventdata reserved - to be defined
26、in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)axes(handles.axes1);x=(handles.img);if isrgb(x) i=ifftn(x);O=fftshift(i);imshow(O);title(ifft);else i=ifft2(x); O=fftshift(i);imshow(O);title(ifft);end% hObject handle to ifft (see GCBO)% eventdata reserved - to
27、 be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)10.傅里叶逆变换程序:function fuliyenibianhuan_Callback(hObject, eventdata, handles)% hObject handle to fuliyenibianhuan (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles s
28、tructure with handles and user data (see GUIDATA)axes(handles.axes1);x=(handles.img);if isrgb(x) i=ifft(x);else i=fft(x);endO=ifftshift(i);imshow(O);title(ift); % hObject handle to ift (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and us
29、er data (see GUIDATA)11.离散余弦变化程序:function yuxuanbianhua_Callback(hObject, eventdata, handles)% hObject handle to yuxuanbianhua (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)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 % hObject handle to dct (see GCBO)% eventdata reserved - to be
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1