首页 数字图像处理课程设计

数字图像处理课程设计

举报
开通vip

数字图像处理课程设计《数字视音频技术》 课程设计报告 题    目: 基于MATLAB/GUI数字图像处理 专业名称:      电子信息工程          班    级:      电信072              学    号:                            姓    名:                            2010年  12月20日 基于MATLAB/GUI数字图像处理 一.设计目标 图形用户界面(Graphical User Interface)简称GUI,在Ma...

数字图像处理课程设计
《数字视音频技术》 课程 设计 领导形象设计圆作业设计ao工艺污水处理厂设计附属工程施工组织设计清扫机器人结构设计 报告 题    目: 基于MATLAB/GUI数字图像处理 专业名称:      电子信息工程          班    级:      电信072              学    号:                            姓    名:                            2010年  12月20日 基于MATLAB/GUI数字图像处理 一.设计目标 图形用户界面(Graphical User Interface)简称GUI,在Matlab程序开发中起着举足轻重的作用,它有别于传统的VC、JAVA或者Delphi的界面开发方式。作为一个数学运算能力很强的软件,Matlab的运算结果通常是用图形来 关于同志近三年现实表现材料材料类招标技术评分表图表与交易pdf视力表打印pdf用图表说话 pdf 示的,GUI的使用更易于图形表现的多元化,在数字图像处理中更加的方便、直观。下面设计一个简单的GUI数字图像处理,掌握GUI菜单,控件,回调函数的具体实现方法。 二.设计环境: Windows xp Matlab 7.1 三. 方案 气瓶 现场处置方案 .pdf气瓶 现场处置方案 .doc见习基地管理方案.doc关于群访事件的化解方案建筑工地扬尘治理专项方案下载 论证 界面设计采用菜单模式,通过MATLAB图像处理工具箱提供的强大图像处理、图像设计功能来对图像进行处理。通过做Matlab GUI界面来对图像进行编辑、缩放、加噪声、噪声滤波、颜色模型转换和图像的翻转。通过对Matlab函数直接调用和自编函数来实现上述图像处理功能,其中图像进行任意角度翻转还用到了两个不同GUI之间数据传递实现的。 四.实验设计过程 1.菜单的创建和设置 菜单项的创建、设置可以通过系统函uimenu函数来完成,同时也可以利用GUI的设计工具来创建、设置。如图1-1 图1-1  菜单栏的设置 2.控件的设计 现在,绝大多数的软件中,图形界面都包含有控件。控件也是一种是图形对象通过使用各种类型的控件,可以建立起操作简便,功能强大的图形界面软件。Matlab系统为我们提供了lO种控件对象如:复选框、可编辑文本框等。实验的整体GUI界面设计如图2-1。 图2-1  GUI界面 3.实验运行过程与功能: 文件 运行界面如图4-1: 图4-1  运行界面                        点击打开,打开一个图片,如图4-2 图 4-2 打开一个图片 编辑 点击编辑,双三次缩小,输入参数,如图4-3 图4-3 然后,选择旋转,界面如图4-4 图4-4  图像旋转界面 输入一个角度,然后点击确定,就会把图片进行旋转,如45度,运行结果如图4-5 图4-5  图像旋转结果图 点下面任意一个的原色,然后点ok,就会对背景原色进行变换,比如选择bule,得到的结果图如图4-6 图4-6 原色转换结果图 图像处理 图4-7亮度处理 图4-8 Hsv模型转化                          图4-9图像腐蚀 图4-10高度滤波 五.结束语 由以上例子可以看出来,使用Matlab来编写程序确实简洁、方便。Matlab系统本身提供了很多图像处理方面的很多方法,同时也有很多第三方提供的工具箱,这就大大的节省了我们的开发时间,缩短了开发的剧期。由于Matlab语言的语法简单、灵活,就使得使用Matlab开发图像处理程序更简单,流程容易理解。本实验在结合了老师教过的知识和自己理解的修改,在自己的努力 附录: function varargout = image_proc(varargin) % IMAGE_PROC M-file for image_proc.fig %      IMAGE_PROC, by itself, creates a new IMAGE_PROC or raises the existing %      singleton*. % %      H = IMAGE_PROC returns the handle to a new IMAGE_PROC or the handle to %      the existing singleton*. % %      IMAGE_PROC('CALLBACK',hObject,eventData,handles,...) calls the local %      function named CALLBACK in IMAGE_PROC.M with the given input arguments. % %      IMAGE_PROC('Property','Value',...) creates a new IMAGE_PROC or raises the %      existing singleton*.  Starting from the left, property value pairs are %      applied to the GUI before image_proc_OpeningFunction gets called.  An %      unrecognized property name or invalid value makes property application %      stop.  All inputs are passed to image_proc_OpeningFcn via varargin. % %      *See GUI Options on GUIDE's 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 image_proc % Last Modified by GUIDE v2.5 23-Dec-2010 12:50:50 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name',      mfilename, ... 'gui_Singleton',  gui_Singleton, ... 'gui_OpeningFcn', @image_proc_OpeningFcn, ... 'gui_OutputFcn',  @image_proc_OutputFcn, ... 'gui_LayoutFcn',  [] , ... 'gui_Callback',  []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT % --- Executes just before image_proc is made visible. function image_proc_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject    handle to figure % eventdata  reserved - to be defined in a future version of MATLAB % handles    structure with handles and user data (see GUIDATA) % varargin  command line arguments to image_proc (see VARARGIN) % Choose default command line output for image_proc handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes image_proc wait for user response (see UIRESUME) % uiwait(handles.figure1); global img_path                  global im                global choice              im=0;                        img_path='';                    choice=[1 1];  % --- Outputs from this function are returned to the command line. function varargout = image_proc_OutputFcn(hObject, eventdata, handles) % varargout  cell array for returning output args (see VARARGOUT); % hObject    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 structure varargout{1} = handles.output; % --- Executes on button press in pushbutton2. function pushbutton2_Callback(hObject, eventdata, handles) % 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) global img_path; global im; global choice; text={'Red Component','Green Component','Blue Component','Gray Image'}; if isempty(img_path) msgbox('Select an image first or the image does not exist!'); else if choice(1)==4 rgb2yuv(handles.axes2,im); else show_rgb(handles.axes2,im,choice(1)); end set(handles.text3,'String',text{choice(1)}); end function edit1_Callback(hObject, eventdata, handles) % hObject    handle to edit1 (see GCBO) % eventdata  reserved - to be defined in a future version of MATLAB % handles    structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit1 as text %        str2double(get(hObject,'String')) returns contents of edit1 as a double % --- Executes during object creation, after setting all properties. function edit1_CreateFcn(hObject, eventdata, handles) % hObject    handle to edit1 (see GCBO) % eventdata  reserved - to be defined in a future version of MATLAB % handles    empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. %      See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on button press in pushbutton1. function pushbutton1_Callback(hObject, eventdata, handles) % hObject    handle to pushbutton1 (see GCBO) % eventdata  reserved - to be defined in a future version of MATLAB % handles    structure with handles and user data (see GUIDATA) global img_path; global im; [filename, pathname] = uigetfile( {'*.bmp;*.jpg;*.png;*.jpeg;*.tif;*.gif', 'Image Files (*.bmp, *.jpg, *.png,*.jpeg,*.tif,*.gif)';'*.*', 'All Files (*.*)'}, 'Pick an image'); if isequal(filename,0) || isequal(pathname,0) return; end cla; axes(handles.axes1); img_path=[pathname filename]; im=imread(img_path); imshow(im); set(handles.edit1,'string',img_path); set(handles.text2,'visible','on'); set(handles.text3,'string',''); if (length(size(im))~=3) set(handles.radiobutton1,'enable','off'); set(handles.radiobutton2,'enable','off'); set(handles.radiobutton3,'enable','off'); set(handles.radiobutton4,'enable','off'); set(handles.pushbutton2,'enable','off'); set(handles.uipanel2,'title',''); set(handles.popupmenu1,'enable','off'); else set(handles.radiobutton1,'enable','on'); set(handles.radiobutton2,'enable','on'); set(handles.radiobutton3,'enable','on'); set(handles.radiobutton4,'enable','on'); set(handles.pushbutton2,'enable','on'); set(handles.uipanel2,'title','View of RGB componets'); set(handles.popupmenu1,'enable','on'); end % --- Executes on button press in radiobutton1. function radiobutton1_Callback(hObject, eventdata, handles) % hObject    handle to radiobutton1 (see GCBO) % eventdata  reserved - to be defined in a future version of MATLAB % handles    structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of radiobutton1 global choice; choice(1)=1; % --- Executes on button press in radiobutton2. function radiobutton2_Callback(hObject, eventdata, handles) % hObject    handle to radiobutton2 (see GCBO) % eventdata  reserved - to be defined in a future version of MATLAB % handles    structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of radiobutton2 global choice; choice(1)=2; % --- Executes on button press in radiobutton3. function radiobutton3_Callback(hObject, eventdata, handles) % hObject    handle to radiobutton3 (see GCBO) % eventdata  reserved - to be defined in a future version of MATLAB % handles    structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of radiobutton3 global choice; choice(1)=3; % --- Executes on button press in radiobutton4. function radiobutton4_Callback(hObject, eventdata, handles) % hObject    handle to radiobutton4 (see GCBO) % eventdata  reserved - to be defined in a future version of MATLAB % handles    structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of radiobutton4 global choice; choice(1)=4; % --- Executes on selection change in popupmenu1. function popupmenu1_Callback(hObject, eventdata, handles) % hObject    handle to popupmenu1 (see GCBO) % eventdata  reserved - to be defined in a future version of MATLAB % handles    structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns popupmenu1 contents as cell array %        contents{get(hObject,'Value')} returns selected item from popupmenu1 % --- Executes during object creation, after setting all properties. function popupmenu1_CreateFcn(hObject, eventdata, handles) % hObject    handle to popupmenu1 (see GCBO) % eventdata  reserved - to be defined in a future version of MATLAB % handles    empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. %      See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on button press in pushbutton3. function pushbutton3_Callback(hObject, eventdata, handles) % hObject    handle to pushbutton3 (see GCBO) % eventdata  reserved - to be defined in a future version of MATLAB % handles    structure with handles and user data (see GUIDATA) global img_path; global im; if isempty(img_path) msgbox('Select an image first or the image does not exist!'); else model=0; histFlag=get(handles.checkbox1,'Value'); if length(size(im)==3) model=get(handles.popupmenu1,'Value'); end [im_eq]=equalizations(im,model,histFlag); axes(handles.axes2); imshow(im_eq); set(handles.text3,'string',' Equalized image'); end % --- Executes on button press in checkbox1. function checkbox1_Callback(hObject, eventdata, handles) % hObject    handle to checkbox1 (see GCBO) % eventdata  reserved - to be defined in a future version of MATLAB % handles    structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of checkbox1 % --- Executes on button press in pushbutton4. function pushbutton4_Callback(hObject, eventdata, handles) % 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) global im; global im_path; global flag; flag=0; [h,im1]=DCT_compression(handles.figure1,im); if flag axes(handles.axes2); imshow(im1); set(handles.text3,'string','DCT compression'); end % -------------------------------------------------------------------- function fileopen_Callback(hObject, eventdata, handles) % hObject    handle to fileopen (see GCBO) % eventdata  reserved - to be defined in a future version of MATLAB % handles    structure with handles and user data (see GUIDATA) global img_path; global im; [filename,pathname]=uigetfile({'*.bmp;*.jpg;*.png;*.jpeg;*.tif;*.gif', 'Image Files (*.bmp, *.jpg, *.png,*.jpeg,*.tif,*.gif)';'*.*', 'All Files (*.*)'},'载入图像'); if isequal(filename,0)|isequal(pathname,0) errordlg('没有选中文件','警告'); return; else x=imread([pathname,filename]); axes(handles.axes1); imshow(x); handles.img=x; handles.noise_img=x; guidata(hObject,handles) end cla; axes(handles.axes1); img_path=[pathname filename]; im=imread(img_path); imshow(im); set(handles.edit1,'string',img_path); set(handles.text2,'Visible','on'); set(handles.text3,'string',''); if (length(size(im))~=3) set(handles.radiobutton1,'enable','off'); set(handles.radiobutton2,'enable','off'); set(handles.radiobutton3,'enable','off'); set(handles.radiobutton4,'enable','off'); set(handles.pushbutton2,'enable','off'); set(handles.uipanel2,'title',''); set(handles.popupmenu1,'enable','off'); else set(handles.radiobutton1,'enable','on'); set(handles.radiobutton2,'enable','on'); set(handles.radiobutton3,'enable','on'); set(handles.radiobutton4,'enable','on'); set(handles.pushbutton2,'enable','on'); set(handles.uipanel2,'title','View of RGB componets'); set(handles.popupmenu1,'enable','on'); end % -------------------------------------------------------------------- function file_Callback(hObject, eventdata, handles) % hObject    handle to file (see GCBO) % eventdata  reserved - to be defined in a future version of MATLAB % handles    structure with handles and user data (see GUIDATA) % -------------------------------------------------------------------- function filesave_Callback(hObject, eventdata, handles) % hObject    handle to filesave (see GCBO) % eventdata  reserved - to be defined in a future version of MATLAB % handles    structure with handles and user data (see GUIDATA) [filename,pathname] = uiputfile({'*.bmp;*.jpg;*.png;*.jpeg;*.tif;*.gif', 'Image Files (*.bmp, *.jpg, *.png,*.jpeg,*.tif,*.gif)';'*.*', 'All Files (*.*)'},'图片保存为'); if isequal([filename,pathname],[0,0]) errordlg('文件没有保存','警告'); return; else file=strcat(pathname,filename); (handles.axes2); i=getimage(gca); imwrite(i,file); end % -------------------------------------------------------------------- function fileclose_Callback(hObject, eventdata, handles) % hObject    handle to fileclose (see GCBO) % eventdata  reserved - to be defined in a future version of MATLAB % handles    structure with handles and user data (see GUIDATA) close(handles.figure1); clc; close all; close(gcf); % -------------------------------------------------------------------- function bianji_Callback(hObject, eventdata, handles) % hObject    handle to bianji (see GCBO) % eventdata  reserved - to be defined in a future version of MATLAB % handles    structure with handles and user data (see GUIDATA) % -------------------------------------------------------------------- function Untitled_6_Callback(hObject, eventdata, handles) % hObject    handle to Untitled_6 (see GCBO) % eventdata  reserved - to be defined in a future version of MATLAB % handles    structure with handles and user data (see GUIDATA) global x0; global x1; global y0; global y1; global z0; global z1; global img_path; global im; x0=get(handles.edit4,'string'); y0=get(handles.edit5,'string'); z0=get(handles.edit6,'string'); x1=str2num(x0); y1=str2num(y0); z1=str2num(z0); if (isempty(x0) || x1<1 || x1>256) msgbox('0 < x <= 256 , please input right x!'); elseif isempty(y0) || y1<1 || y1>256 msgbox('0 < y <= 256 , please input right y!'); elseif isempty(z0) || z1 < x1 || z1 < y1 msgbox('倍数 >= x , 倍数 >= y , please input right 倍数!'); elseif x1==1 && y1==1 && z1 == 1 || x1==1 && y1==2 && z1 == 2 || x1==2 && y1==1 && z1 == 2 I=imread(img_path); I_new=I; axes(handles.axes2); set(handles.text2,'string','放大后的图像'); imshow(I_new); elseif z1-1>=x1 || z1-1>=y1 I=imread(img_path); I_new=I(round(size(I,1)*x1/z1):round(size(I,1)*(x1+1)/z1),round(size(I,1)*y1/z1):round(size(I,1)*(y1+1)/z1),1:end); axes(handles.axes2); set(handles.text2,'string','放大后的图像'); imshow(I_new); else I=imread(img_path);    I_new=I(round(size(I,1)*(x1-1)/z1):round(size(I,1)*x1/z1),round(size(I,1)*(y1-1)/z1):round(size(I,1)*y1/z1),1:end); axes(handles.axes2); set(handles.text2,'string','放大后的图像'); imshow(I_new); end % -------------------------------------------------------------------- function Untitled_7_Callback(hObject, eventdata, handles) % hObject    handle to Untitled_7 (see GCBO) % eventdata  reserved - to be defined in a future version of MATLAB % handles    structure with handles and user data (see GUIDATA) global p1; global y; axes(handles.axes2); prompt={'输入参数1:'}; defans={'60'}; p=inputdlg(prompt,'输入参数',1,defans); p1=str2num(p{1}); y=imrotate(handles.img,p1);          imshow(y); % -------------------------------------------------------------------- function liangdu_Callback(hObject, eventdata, handles) % hObject    handle to liangdu (see GCBO) % eventdata  reserved - to be defined in a future version of MATLAB % handles    structure with handles and user data (see GUIDATA)
本文档为【数字图像处理课程设计】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_574951
暂无简介~
格式:doc
大小:83KB
软件:Word
页数:31
分类:互联网
上传时间:2019-05-28
浏览量:17