当前位置: 首页 > news >正文

做神马网站优实训网站开发目的

做神马网站优,实训网站开发目的,网站建设青岛,沈阳seo公司【实验内容】 用MATLAB的GUI程序设计一个具备图像边缘检测功能的用户界面#xff0c;该设计程序有以下基本功能#xff1a; #xff08;1#xff09;图像的读取和保存。 #xff08;2#xff09;设计图形用户界面#xff0c;让用户对图像进行彩色图像到灰度图像的转换…【实验内容】 用MATLAB的GUI程序设计一个具备图像边缘检测功能的用户界面该设计程序有以下基本功能 1图像的读取和保存。 2设计图形用户界面让用户对图像进行彩色图像到灰度图像的转换并显示原图和灰度图像。 3设计图形用户界面让用户能够根据需要来选择边缘检测算子即选择边缘检测的方法。 4设计图形用户界面让用户能够自行设定检测的阈值和方向。 5显示边缘检测后的图像并与原图和灰度图像进行对比。 【实验步骤】 1、建立菜单选项包括“文件”打开、保存、退出、“检测方法”sobel、prewitt、roberts、canny和“帮助”。 建立3个坐标轴对象用于显示原始图像、灰度图像和边缘检测后的图像。 建立1个按钮用于将原始图像转换为灰度图像。 建立1个文本编辑框用于输入数据。 建立菜单选项包括“文件”打开、保存、退出、“检测方法”sobel、prewitt、roberts、canny和“帮助”。 五个静态文本框的string属性分别为“原图”、“灰度图像”、“检测图像”、“设定阈值”和“检测方向”。 三个坐标轴的Tag标识分别为original_image、gray_image、test_image。 按钮控件的string属性为“灰度转换”Tag标识为rgbtogray。 文本编辑框的Tag标识为thresh_value。 列表框的string属性为horizontal、vertical、bothTag标识为direction。 编写代码完成程序中的变量赋值、输入、输出等工作打开对应文件在对应函数位置添加如下程序其他代码不变。 function varargout m240531(varargin) % M240531 MATLAB code for m240531.fig % M240531, by itself, creates a new M240531 or raises the existing % singleton*. % % H M240531 returns the handle to a new M240531 or the handle to % the existing singleton*. % % M240531(CALLBACK,hObject,eventData,handles,...) calls the local % function named CALLBACK in M240531.M with the given input arguments. % % M240531(Property,Value,...) creates a new M240531 or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before m240531_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to m240531_OpeningFcn via varargin. % % *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 m240531% Last Modified by GUIDE v2.5 31-May-2024 11:43:02% Begin initialization code - DO NOT EDIT gui_Singleton 1; gui_State struct(gui_Name, mfilename, ...gui_Singleton, gui_Singleton, ...gui_OpeningFcn, m240531_OpeningFcn, ...gui_OutputFcn, m240531_OutputFcn, ...gui_LayoutFcn, [] , ...gui_Callback, []); if nargin ischar(varargin{1})gui_State.gui_Callback str2func(varargin{1}); endif nargout[varargout{1:nargout}] gui_mainfcn(gui_State, varargin{:}); elsegui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT% --- Executes just before m240531 is made visible. function m240531_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 m240531 (see VARARGIN)% Choose default command line output for m240531 handles.output hObject;% Update handles structure guidata(hObject, handles);% UIWAIT makes m240531 wait for user response (see UIRESUME) % uiwait(handles.figure1);% --- Outputs from this function are returned to the command line. function varargout m240531_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 rgbtogray. function rgbtogray_Callback(hObject, eventdata, handles) % hObject handle to rgbtogray (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) grayrgb2gray(handles.img) set(handles.gray_image, HandleVisibility, ON); axes(handles.gray_image) imshow(gray); handles.imggray; guidata(hObject,handles);function thresh_value_Callback(hObject, eventdata, handles) % hObject handle to thresh_value (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 thresh_value as text % str2double(get(hObject,String)) returns contents of thresh_value as a double% --- Executes during object creation, after setting all properties. function thresh_value_CreateFcn(hObject, eventdata, handles) % hObject handle to thresh_value (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 selection change in direction. function direction_Callback(hObject, eventdata, handles) % hObject handle to direction (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)% Hints: contents cellstr(get(hObject,String)) returns direction contents as cell array % contents{get(hObject,Value)} returns selected item from direction% --- Executes during object creation, after setting all properties. function direction_CreateFcn(hObject, eventdata, handles) % hObject handle to direction (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% -------------------------------------------------------------------- function Untitled_1_Callback(hObject, eventdata, handles) % hObject handle to Untitled_1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)% -------------------------------------------------------------------- function Untitled_2_Callback(hObject, eventdata, handles) % hObject handle to Untitled_2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)% -------------------------------------------------------------------- function Untitled_3_Callback(hObject, eventdata, handles) % hObject handle to Untitled_3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)% -------------------------------------------------------------------- function Sobel_Callback(hObject, eventdata, handles) % hObject handle to Sobel (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) v1str2double(get(handles.thresh_value, string )); contentsget(handles.direction,string); v2contents{(get(handles.direction,value))}; edge_sobeledge(handles.img,sobel,v1,v2); set(handles.test_image, HandleVisibility,ON); axes(handles.test_image); imshow(edge_sobel) handles.imgedge_sobel; guidata(hObject,handles);% -------------------------------------------------------------------- function Prewitt_Callback(hObject, eventdata, handles) % hObject handle to Prewitt (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) v1str2double(get(handles.thresh_value,string)) contentsget(handles.direction, string); v2contents{(get(handles.direction,value ))}; edge_prewittedge(handles.img, prewitt ,v1,v2); set(handles.test_image, HandleVisibility,ON); axes(handles.test_image); imshow(edge_prewitt) handles.imgedge_prewitt; guidata(hObject,handles);% -------------------------------------------------------------------- function Roberts_Callback(hObject, eventdata, handles) % hObject handle to Roberts (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) v1str2double(get(handles.thresh_value,string)) contentsget(handles.direction, string); v2contents{(get(handles.direction,value))}; edge_robertsedge(handles.img, roberts ,v1,v2); set(handles.test_image, HandleVisibility,ON); axes(handles.test_image); imshow(edge_roberts) handles.imgedge_roberts; guidata(hObject,handles);% -------------------------------------------------------------------- function Canny_Callback(hObject, eventdata, handles) % hObject handle to Canny (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) v1str2double(get(handles.thresh_value, string)); contentsget(handles.direction,string); v2contents{(get(handles.direction,value))}; edge_cannyedge(handles.img,canny,v1, v2); set(handles.test_image, HandleVisibility,ON); axes(handles.test_image); imshow(edge_canny); handles.imgedge_canny; guidata(hObject,handles);% -------------------------------------------------------------------- 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) [filename,pathname] uigetfile({*.jpg;*.bmp;*.tif;*.*},载入图像); if isequal(filename,0) || isequal(pathname,0)errordlg(没有选中文件,出错);return; elsefile[pathname,filename];global SSfile;ximread(file);set(handles.original_image,HandleVisibility,ON);axes(handles.original_image);imshow(x);handles.imgx;guidata(hObject,handles); end% -------------------------------------------------------------------- function save_Callback(hObject, eventdata, handles) % hObject handle to save (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) [sfilename,sfilepath]uiputfile({*.jpg;*.bmp;*.tif;*.*}, ...保存图像文件,untitled.jpg); if ~isequal([sfilename,sfilepath],[0,0])sfileullname [sfilepath,sfilename];imwrite(handles.img, sfilefullname); elsemsgbox(你按了取消键,保存失败); end% -------------------------------------------------------------------- function exit_Callback(hObject, eventdata, handles) % hObject handle to exit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)执行程序后单击菜单栏中的文件打开图片在原图位置会显示彩色图像单击“灰度转换”按钮在灰度图像位置会显示转换后的灰度图像在“设定阈值”框输入0.1选择“检测方向”为both再在“检测方法”菜单中选择Canny即可在“检测图像”的位置显示边缘检测后的图像最后在“文件”菜单中选择“保存”即可保存最终分割后的边缘检测图。
http://www.hkea.cn/news/14565562/

相关文章:

  • 建被采集的网站长沙麓谷网站建设
  • 网站建设与维护合同wordpress 自定义头像
  • 高端医院网站建设广东东莞最新消息通知
  • 京东网上商城官网优化网站和网站建设
  • 音乐网站开发与需求wordpress 调用 api接口
  • 省建设厅网站安徽网络培训学习心得
  • 那个网站系统好怎么上传网站数据库
  • 网站做app的软件怎样做网络推广渠道
  • 上海网站建设哪家好小米装修
  • 上海好牛网站建设中国机械加工网18易5下2拉i
  • 邮轮哪个网站是可以做特价不带地域的公司名称怎么注册
  • 太平洋在线企业建站系统设计签名的小程序
  • 办公家具网站建设费用网站开发专业基础课程
  • 浦东新区专业做网站网站运营与推广计划书怎么做
  • 网站集约化建设的建议网站规划与建设需求分析
  • 有哪些软件可以查企业信息同一个网站可以同时做竞价和优化
  • 分类网站有哪些成都高端网站设计公司
  • 免费制作网站appwordpress升级流程
  • 腾讯网网站网址昆明百度智能建站
  • 上海专业网站建设 公司昆明做网站魄罗科技
  • 长春行业网站seowhy教研室
  • 博星卓越 网站开发方案网络营销软件
  • 多语种网站怎么做搜索引擎排名中国城乡和住房建设部网站
  • 网站建设功能需求表如何找厂家地址
  • 汉化主题做网站效果图带论坛的网站模板下载地址
  • 百度快照 直接进网站dw做网站导航
  • wordpress建站案例公司网站用哪个软件做
  • 网站地址地图怎么做东莞常平嘉盛学校
  • 徐州云龙城乡建设局网站网站手机版模板免费下载
  • 做平台网站怎么做的WordPress博客互相采集