www.gusucode.com > GUI界面设计范例和ppt资料电信课程设计 > GUI界面设计范例和ppt资料电信课程设计/GUI界面设计范例/电信课程设计/3.two_gui/image_menu.m
function varargout = image_menu(varargin) % IMAGE_MENU M-file for image_menu.fig % IMAGE_MENU, by itself, creates a new IMAGE_MENU or raises the existing % singleton*. % % H = IMAGE_MENU returns the handle to a new IMAGE_MENU or the handle to % the existing singleton*. % % IMAGE_MENU('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in IMAGE_MENU.M with the given input arguments. % % IMAGE_MENU('Property','Value',...) creates a new IMAGE_MENU or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before image_menu_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to image_menu_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_menu % Last Modified by GUIDE v2.5 08-Nov-2010 18:30:42 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @image_menu_OpeningFcn, ... 'gui_OutputFcn', @image_menu_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_menu is made visible. function image_menu_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_menu (see VARARGIN) global im; global im_temp; % Choose default command line output for image_menu handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes image_menu wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = image_menu_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; % -------------------------------------------------------------------- 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) global im; global im_temp; [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); im_temp=im; imshow(im); set(handles.save,'enable','on'); set(handles.operation,'enable','on'); set(handles.rotating,'enable','on'); % -------------------------------------------------------------------- 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 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) % -------------------------------------------------------------------- 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) % -------------------------------------------------------------------- function operation_Callback(hObject, eventdata, handles) % hObject handle to operation (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % -------------------------------------------------------------------- function rotating_Callback(hObject, eventdata, handles) % hObject handle to rotating (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_temp; [h,im]=image_rotate(handles.figure1,im); axes(handles.axes1); imshow(im);