【正文】
eton*.% CHARGUI(39。CALLBACK39。,hObject,eventData,handles,...) calls the local% function named CALLBACK in with the given input arguments.% CHARGUI(39。Property39。,39。Value39。,...) creates a new CHARGUI or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before charGUI_OpeningFunction gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to charGUI_OpeningF via varargin.% *See GUI Options on GUIDE39。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 charGUI% Last Modified by GUIDE 03Jul2008 17:55:35% Begin initialization code DO NOT EDITgui_Singleton = 1。gui_State = struct(39。gui_Name39。, mfilename, ... 39。gui_Singleton39。, gui_Singleton, ... 39。gui_OpeningF39。, @charGUI_OpeningF, ... 39。gui_OutputF39。, @charGUI_OutputF, ... 39。gui_LayoutF39。, [] , ... 39。gui_Callback39。, [])。if nargin amp。amp。 ischar(varargin{1}) = str2func(varargin{1})。endif nargout [varargout{1:nargout}] = gui_mainf(gui_State, varargin{:})。else gui_mainf(gui_State, varargin{:})。end% End initialization code DO NOT EDIT% Executes just before charGUI is made visible.function charGUI_OpeningF(hObject, eventdata, handles, varargin)% This function has no output args, see OutputF.% 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 mand line arguments to charGUI (see VARARGIN)load data。assignin(39。base39。,39。net39。,net)。% Choose default mand line output for charGUI = hObject。% Update handles structureguidata(hObject, handles)。% UIWAIT makes charGUI wait for user response (see UIRESUME)% uiwait()。% Outputs from this function are returned to the mand line.function varargout = charGUI_OutputF(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 mand line output from handles structurevarargout{1} = 。% Executes on button press in pbLoad.function pbLoad_Callback(hObject, eventdata, handles)% hObject handle to pbLoad (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({39。*.bmp39。39。*.jpg39。39。*.gif39。39。*.*39。}, 39。Pick an Image File39。)。S = imread([pathname,filename])。axes()。imshow(S)。 = S。guidata(hObject, handles)。% Executes on button press in pbSelect.function pbSelect_Callback(hObject, eventdata, handles)% hObject handle to pbSelect (see GCBO)% eventdata reserved to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)S = 。axes()。img_crop = imcrop(S)。axes()。imshow(img_crop)。 = img_crop。guidata(hObject, handles)。% Executes on button press in pbPreprocess.function pbPreprocess_Callback(hObject, eventdata, handles)% hObject handle to pbPreprocess (see GCBO)% eventdata reserved to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)img_crop = 。imgGray = rgb2gray(img_crop)。bw = im2bw(img_crop,graythresh(imgGray))。axes()。imshow(bw)。bw2 = edu_imgcrop(bw)。axes()。imshow(bw2)。 = bw2。guidata(hObject, handles)。% Executes on button press in pbExtract.function pbExtract_Callback(hObject, eventdata, handles)% hObject handle to pbExtract (see GCBO)% eventdata reserved to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)bw2 = 。charvec = edu_imgresize(bw2)。axes()。plotchar(charvec)。 = charvec。guidata(hObject, handles)。% Executes on button press in pbRecognize.function pbRecognize_Callback(hObject, eventdata, handles)% hObject handle to pbRecognize (see GCBO)% eventdata reserved to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)charvec = 。selected_net = get(,39。string39。)。selected_net = evalin(39。base39。,selected_net)。result = sim(selected_net,charvec)。[val, num] = max(result)。set(, 39。string39。,num)。% Executes on button press in pbNN.function pbNN_Callback(hObject, eventdata, handles)% hObject handle to pbNN (see GCBO)% eventdata reserved to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)function editNN_Callback(hObject, eventdata, handles)% hObject handle to editNN (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,39。String39。) returns contents of editNN as text% str2double(get(hObject,39。String39。)) returns contents of editNN as a double% Executes during object creation, after setting all properties.function editNN_CreateF(hObject, eventdata, handles)% hObject handle to editNN (see GCBO)% eventdata reserved to be defined in a future version of MATLAB% handles empty handles not created until after all CreateFs called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc amp。amp。 isequal(get(hObject,39。BackgroundColor39。), get(0,39。defaultUicontrolBackgroundColor39。)) set(hObject,39。BackgroundColor39。,39。white39。)。endfunction editResult_Callbac