




已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年湖南邵阳城步县事业单位选调28人模拟试卷有答案详解
- 2025河南商丘市夏邑县治安巡防队员招聘50人考前自测高频考点模拟试题附答案详解(模拟题)
- 2025福建医科大学附属口腔医院招聘2人考前自测高频考点模拟试题及完整答案详解一套
- 2025北京昌平区卫生健康委员会第二批招聘事业单位人员21人考前自测高频考点模拟试题及答案详解(典优)
- 2025江西上饶市鄱阳县人民医院招聘编外专业技术人员84人考前自测高频考点模拟试题及答案详解(夺冠)
- 2025南平延平黄墩街道社区卫生服务中心招聘医师模拟试卷有答案详解
- 2025年东营市“英才进广饶”(教师类)事业单位引进人才招聘(31人)考前自测高频考点模拟试题及完整答案详解
- 2025金华市八达供电服务有限公司招聘60人考前自测高频考点模拟试题附答案详解(考试直接用)
- 2025江苏盐城选聘物业管理营商环境体验员模拟试卷及答案详解(易错题)
- 2025年上半年九江市事业单位“才汇九江”高层次人才公开招聘【373人】考前自测高频考点模拟试题含答案详解
- 《数据库原理及应用(第二版)》课件 盛志伟 第1-5章 数据库概论-SQL语言
- 大米先生公司管理制度
- 2025年4月自考02204经济管理试题及答案
- 高考英语一轮专项复习:高考试题中的熟词生义(含解析)
- 吸痰护理课件
- 部编版四年级上册语文大单元教学设计范例
- 第三单元整体阅读之人物篇 统编版高中语文选择性必修上册
- 高二上学期第一次月考物理试卷(附答题卷和答案)
- 教育培训机构合作培训协议
- 2025年广东省春季高考学业水平考试数学试卷试题(含答案解析)
- 枫蓼肠胃康胶囊与其他肠胃药的协同作用研究
评论
0/150
提交评论