




已阅读5页,还剩11页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
图像处理大作业1、作业要求 完成Matlab GUI程序,两个显示区域,实现功能: 1)读入灰度或彩色图像,放大缩小显示; 2)完成图像对比度的简单、分段线性变换及非线性变换,并与原图像对比;2、作业目的运用MATLAB,完成图像处理功能:1)图片读入。2)图片放大缩小。3)灰度图片分段线性于和非线性变换。3、作业思路采用Matlab GUI程序完成,分为以下几个步骤:1)菜单、界面设计2)编写函数3) 结合allback与函数4)调试5)开关处理4、作业内容1)菜单、界面设计运行后界面如下:2)代码编写:function varargout = untitled1(varargin)%UNTITLED1 M-file for untitled1.fig% UNTITLED1, by itself, creates a new UNTITLED1 or raises the existing% singleton*.% H = UNTITLED1 returns the handle to a new UNTITLED1 or the handle to% the existing singleton*.% UNTITLED1(Property,Value,.) creates a new UNTITLED1 using the% given property value pairs. Unrecognized properties are passed via% varargin to untitled1_OpeningFcn. This calling syntax produces a% warning when there is an existing singleton*.% UNTITLED1(CALLBACK) and UNTITLED1(CALLBACK,hObject,.) call the% local function named CALLBACK in UNTITLED1.M with the given input% arguments.% *See GUI Options 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 untitled1 % Last Modified by GUIDE v2.5 04-May-2014 17:50:43 % Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct(gui_Name, mfilename, . gui_Singleton, gui_Singleton, . gui_OpeningFcn, untitled1_OpeningFcn, . gui_OutputFcn, untitled1_OutputFcn, . gui_LayoutFcn, , . gui_Callback, );if nargin & ischar(varargin1) gui_State.gui_Callback = str2func(varargin1);end if nargout varargout1:nargout = gui_mainfcn(gui_State, varargin:);else gui_mainfcn(gui_State, varargin:);end% End initialization code - DO NOT EDIT % - Executes just before untitled1 is made visible.function untitled1_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 unrecognized PropertyName/PropertyValue pairs from the% command line (see VARARGIN) % Choose default command line output for untitled1handles.output = hObject; % Update handles structure % - Outputs from this function are returned to the command line.function varargout = untitled1_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 structurevarargout1 = handles.output; % - 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) % - 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) 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 function edit2_Callback(hObject, eventdata, handles)% hObject handle to edit2 (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 edit2 as text% str2double(get(hObject,String) returns contents of edit2 as a double % - Executes during object creation, after setting all properties.function edit2_CreateFcn(hObject, eventdata, handles)% hObject handle to edit2 (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 % -function m_gray_Callback(hObject, eventdata, handles)% hObject handle to m_gray (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % -function m_file_open_Callback(hObject, eventdata, handles)global x filename,pathname=uigetfile(.*.bmp;*.jpg;*.png;*.jpeg,ImageFiles(*.bmp,*.jpg,*.png,*.jpeg);.*.*, AllFiles(*.*),.Pickanimage);if isequal(filename,0)|isequal(pathname,0), return;endaxes(handles.axes_1);fpath=pathname filename;img_1=imread(fpath);x=imread(fpath); imshow(img_1);set(handles.m_file_save,Enable,on);set(handles.reshape,Enable,on);set(handles.gray,Enable,on);set(handles.noise,Enable,on);set(handles.filter,Enable,on);% -function m_file_save_Callback(hObject, eventdata, handles) filename,pathname=uiputfile(*.bmp,BMPfiles;*.jpg;,JPGfiles,PickanImage);if isequal(filename,0)|isequal(pathname,0) return;elsefpath=fullfile(pathname,filename);endimg_1=getappdata(handles.figure_process,img_1);% -function m_gray_feixianxing_Callback(hObject, eventdata, handles)global xaxes(handles.axes_2);set(handles.axes_2,HandleVisibility,ON);y=imadjust(x,0.2,0.5,0 1,0.8);imshow(y);set(handles.axes_2,HandleVisibility,OFF); % -function m_gray_fenduan_Callback(hObject, eventdata, handles)global xaxes(handles.axes_2);set(handles.axes_2,HandleVisibility,ON); f0=0;g0=0;%? f1=20;g1=10; f2=180;g2=230; f3=255;g3=255; r1=(g1-g0)/(f1-f0); b1=g0-r1*f0; r2=(g2-g1)/(f2-f1); b2=g1-r2*f1; r3=(g3-g2)/(f3-f2); b3=g2-r3*f2; m,n=size(x); X2=double(x); for i=1:m for j=1:n f=X2(i,j); g(i,j)=0; if(f=f1)&(f=f2)&(f=f3) g(i,j)=r3*f+b3; end end end end imshow(mat2gray(g); set(handles.axes_2,HandleVisibility,OFF); % -function m_file_Callback(hObject, eventdata, handles)% hObject handle to m_file (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % -function m_file_exit_Callback(hObject, eventdata, handles)% hObject handle to m_file_exit (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)bChanged=getappdata(handles.figure_process,bChanged);bSave=getappdata(handles.figure_process,bSave);if bChanged=true&bSave=false,btnName=questdlg(?,?,?,?,?); switch btnName,case?,feval(axes_2_menu_save_Callback,handles.axes_2_menu_save,eventdata,handles); case? endend % - Executes during object creation, after setting all properties.function axes_1_CreateFcn(hObject, eventdata, handles)% hObject handle to axes_1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called % Hint: place code in OpeningFcn to populate axes_1 % -function m_zoom_zoomout_Callback(hObject, eventdata, handles)% hObject handle to m_zoom_zoomout (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)global x;axes(handles.axes_2);set(handles.axes_2,HandleVisibility,ON);p
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 上市公司规划管理制度
- 乡镇医疗废弃管理制度
- LASA药品管理制度
- lp收益预期管理制度
- PCR室记录管理制度
- 中山绿化养护管理制度
- 企业防疫宣传管理制度
- 不同场所消防管理制度
- 企业春节放假管理制度
- 企业员工生活管理制度
- 儿童脓毒血症护理
- DB14∕T 1049.4-2021 山西省用水定额 第4部分:居民生活用水定额
- 《大学计算机基础案例教程(微课版)第2版》全套教学课件
- 《篮球移动技术 行进间传球》教案(共三篇)
- 透析患者并发癫痫的护理
- 教育培训机构合作培训协议
- 食堂食材配送采购 投标方案(技术方案)
- 《基础分子生物学》复习题及参考答案
- 贵州遵义四中2022自主招生物理试卷试题真题(含答案)
- 生物实验用试剂与耗材购销协议
- NBT 35095-2017 水电工程小流域水文计算规范
评论
0/150
提交评论