基于matlab的数字图像处理_第1页
基于matlab的数字图像处理_第2页
基于matlab的数字图像处理_第3页
基于matlab的数字图像处理_第4页
基于matlab的数字图像处理_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

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

文档简介

1、姓名:周勇 班级:12电信一班 学号:1208421095 基于MATLAB数字图像处理题目MATLAB中集成了功能强大的图像处理工具箱,可以通过不同的算法对图像进行不同的处理,更加精确的对图像进行变换和更改,进一步提高了人们对图像处理的能力和认识。通过用户自定义界面将简洁的界面与MATLAB程序结合起来,方便操作与应用。1 功能介绍本程序是一个简单的图像处理程序,使用MATLAB软件编写完成。主要具有灰度转换、亮度处理、显示频谱、左右翻转、上下翻转、向左旋转90度、向右旋转90度、任意角度旋转、保存等功能,并通过图形化交互界面(GUI)进行程序使用的交互。交互界面如图1.图1 程序的交互界面

2、2 功能实现程序由两个部分组成:MATLAB代码(.m文件)和GUI图形(.fig)。程序使用的流程:图像输入 灰度转换(可选) 亮度处理(可选)显示频谱图(可选)左右翻转(可选)上下翻转(可选)向左旋转90度(可选)向右旋转90度(可选)任意角度旋转(可选)保存(可选)。备注:软件版本:MATLAB R2010b2.1 获得图像文件图形获取的过程,下面是图像获取界面和获取后的效果图。界面图效果图具体代码参见:function pushbutton1_Callback(hObject, eventdata, handles)2.2 灰度转换过程主要包括对原图片灰度转换及显示。 通过灰度转换按钮

3、,将源程序链接到图片。具体程序如下:function pushbutton2_Callback(hObject, eventdata, handles)axes(handles.axes2);if isrgb(handles.img) y=rgb2gray(handles.img); %RGBimshow(y);else msgbox(这已经是灰度图像,转换失败);end 2.3 亮度处理过程在已获得图片的基础上,再进亮度处理的选择。亮度提供输入选项如下:处理后结果:具体代码参见:function pushbutton3_Callback(hObject, eventdata, handles

4、)2.4 显示频谱图在已获得图像文件进行频谱变换,结果如下:具体代码参见:function pushbutton9_Callback(hObject, eventdata, handles)2.5 左右翻转左右翻转图形:具体代码参见:function pushbutton4_Callback(hObject, eventdata, handles)2.6 上下翻转上下翻转图形:具体代码参见:function pushbutton5_Callback(hObject, eventdata, handles)2.7 向左旋转90度向左旋转90度图形:具体代码参见:function pushbutt

5、on6_Callback(hObject, eventdata, handles)2.7 向右旋转90度向右旋转90度图形:具体代码参见:function pushbutton7_Callback(hObject, eventdata, handles)2.7 任意角度旋转向左旋转30度图形:具体代码参见:function pushbutton8_Callback(hObject, eventdata, handles)2.7 保存保存修改过的图片,可以选择任一路径保存。文件名自命:具体代码参见:function pushbutton14_Callback(hObject, eventdata

6、, handles)3 程序总结本程序实现简单的图像处理功能及便捷的图形化交互界面。具有以下特点与缺陷:1、 程序简单明明了,易于查找各部分模块,进行编写更修改。2、各部分程序均源于源于课本知识,比较容易理解与应用,程序涵盖各个变换模块。3、可以对同一个目标图片进行变换,变换后均可以保存,方便存档,更具有人性化设计。未尽功能:(1)、程序可进一步优化,可以实现更多不同功能,没有利用其它函数进行编译,导致程序功能不够强大。(2)、亮度不可以用户调节,只可固定调节到某一个亮度。(3)、图片处理不能包含更多格式的文件,这有待进一步提高。(4)、程序运行需要打开.m文件和.fig文件,不够简单易操作。

7、4 课程总结简单的图像处理程序已于上面一一列举,在制作过程遇到过许多问题,比如图形的频谱变换,经过查找书上资料,通过fft变换即可以得到。通过本次课程设计,使自己对MATLAB GUI设计流程有了比较深刻的体会,同时也了解了一般软件设计的过程。在设计过程中碰到了很多的问题,通过这些问题,使自己分析问题,解决问题的能力得到了较大的提高。在理工科的专业应用背景下,用matlab 进行相关计算与仿真编程的优势非常突出。特定的问题处理算法,我们通常都以M文件的文本形式给定最终的解决方案,自己设计的程序是在MATLAB环境下,用MATLAB语言编写的,这对于有安装MATLAB软件的计算机上运行并不存在什

8、么问题,关键是一般的计算机很少有去安装MATLAB软件的,那么要在这些机子上运行该程序要怎么办呢,难道要先安装MATLAB软件,这显然太麻烦了,对于一个通用的,比较成熟的解决方案,我们当然期望它能应用到更多的场合,而.exe (可执行)文件可运行于所有的通用WINDOWS操作系统,为此,将M文件转换成.exe文件倒是个不错的想法。附录(部分程序)function varargout = process(varargin)% PROCESS MATLAB code for process.fig% PROCESS, by itself, creates a new PROCESS or rais

9、es the existing% singleton*.% H = PROCESS returns the handle to a new PROCESS or the handle to% the existing singleton*.% PROCESS(CALLBACK,hObject,eventData,handles,.) calls the local% function named CALLBACK in PROCESS.M with the given input arguments.% PROCESS(Property,Value,.) creates a new PROCE

10、SS or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before process_OpeningFcn gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to process_OpeningFcn via varargin.% *See GUI Opt

11、ions on GUIDEs Tools menu. Choose GUI allows only one% instance to run (singleton).% See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help process % Last Modified by GUIDE v2.5 08-Dec-2014 23:30:51 % Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_Sta

12、te = struct(gui_Name, mfilename, . gui_Singleton, gui_Singleton, . gui_OpeningFcn, process_OpeningFcn, . gui_OutputFcn, process_OutputFcn, . gui_LayoutFcn, , . gui_Callback, );if nargin & ischar(varargin1) gui_State.gui_Callback = str2func(varargin1);end if nargout varargout1:nargout = gui_mainfcn(g

13、ui_State, varargin:);else gui_mainfcn(gui_State, varargin:);end% End initialization code - DO NOT EDIT % - Executes just before process is made visible.function process_OpeningFcn(hObject, eventdata, handles, varargin)% This function has no output args, see OutputFcn.% hObject handle to figure% even

14、tdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% varargin command line arguments to process (see VARARGIN) % Choose default command line output for processhandles.output = hObject; % Update handles structureguidata(hObject, han

15、dles); % UIWAIT makes process wait for user response (see UIRESUME)% uiwait(handles.figure1); % - Outputs from this function are returned to the command line.function varargout = process_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT);% hObject

16、 handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structurevarargout1 = handles.output; % - Executes on button press in pushbutton1.function pushbutton1_Callba

17、ck(hObject, eventdata, handles) name,path=uigetfile(*.bmp,载入图像);if isequal(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% hObject handle to pushbutton1 (see GCBO)% eventdat

18、a reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % - Executes on button press in pushbutton2.function pushbutton2_Callback(hObject, eventdata, handles)axes(handles.axes2);if isrgb(handles.img) y=rgb2gray(handles.img); %RGBimshow(y);

19、else msgbox(这已经是灰度图像,转换失败);end % hObject handle to pushbutton2 (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 pushbutton3.function pushbutton3_Callback(hObject, eventdata, handle

20、s)prompt=输入参数1,输入参数2,输入gamma; defans=0 0.7,0 1,1; p=inputdlg(prompt,输入参数,1,defans); p1=str2num(p1); p2=str2num(p2); p3=str2num(p3); gamma=p3; x=(handles.img); y=imadjust(x,p1,p2,gamma); axes(handles.axes2); imshow(y);% hObject handle to pushbutton3 (see GCBO)% eventdata reserved - to be defined in a

21、 future version of MATLAB% handles structure with handles and user data (see GUIDATA) % - Executes on button press in pushbutton4.function pushbutton4_Callback(hObject, eventdata, handles)axes(handles.axes2);if isrgb(handles.img) x=(handles.img);for k=1:3 y(:,:,k)=fliplr(x(:,:,k);%左右翻转函数endimshow(y)

22、;else x=(handles.img); y=fliplr(x); imshow(y);end% hObject handle to pushbutton4 (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 pushbutton5.function pushbutton5_Callback(hObject,

23、 eventdata, handles)axes(handles.axes2);x=(handles.img);if isrgb(handles.img) for k=1:3 y(:,:,k)=flipud(x(:,:,k);%上下翻转函数endimshow(y);else x=(handles.img); y=flipud(x); imshow(y);end% hObject handle to pushbutton5 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles s

24、tructure with handles and user data (see GUIDATA) % - Executes on button press in pushbutton6.function pushbutton6_Callback(hObject, eventdata, handles)axes(handles.axes2);x=(handles.img);y=imrotate(x,90); imshow(y);% hObject handle to pushbutton6 (see GCBO)% eventdata reserved - to be defined in a

25、future version of MATLAB% handles structure with handles and user data (see GUIDATA) % - Executes on button press in pushbutton7.function pushbutton7_Callback(hObject, eventdata, handles)axes(handles.axes2);x=(handles.img);y=imrotate(x,-90); imshow(y);% hObject handle to pushbutton7 (see GCBO)% even

26、tdata 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.function pushbutton8_Callback(hObject, eventdata, handles)axes(handles.axes2);prompt=输入参数1:;defans=30;p=(prompt,输入参数,1,defans);p1=str2num(p1);y=imrotate(handles.img,p1); imshow(y);% hObject handle to pushbutton8 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % -

温馨提示

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

评论

0/150

提交评论