function varargout = zhanglixia(varargin)
%ZHANGLIXIA M-file for zhanglixia.fig
% ZHANGLIXIA, by itself, creates a new ZHANGLIXIA or raises the existing
% singleton*.
%
% H = ZHANGLIXIA returns the handle to a new ZHANGLIXIA or the handle to
% the existing singleton*.
%
% ZHANGLIXIA('Property','Value',...) creates a new ZHANGLIXIA using the
% given property value pairs. Unrecognized properties are passed via
% varargin to zhanglixia_OpeningFcn. This calling syntax produces a
% warning when there is an existing singleton*.
%
% ZHANGLIXIA('CALLBACK') and ZHANGLIXIA('CALLBACK',hObject,...) call the
% local function named CALLBACK in ZHANGLIXIA.M with the given input
% arguments.
%
% *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 zhanglixia
% Last Modified by GUIDE v2.5 18-May-2010 11:21:35
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @zhanglixia_OpeningFcn, ...
'gui_OutputFcn', @zhanglixia_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 zhanglixia is made visible.
function zhanglixia_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 zhanglixia
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes zhanglixia wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = zhanglixia_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 pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (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 bw
set(findobj(gcf,'Tag','radiobutton1'),'Value',1);
set(findobj(gcf,'Tag','radiobutton2'),'Value',0);
set(findobj(gcf,'Tag','edit1'),'Enable','off');
[Filename,Pathname]=uigetfile({'*.png';'*.tif';'*.*'});
str=[Pathname, Filename];
im=imread(str);
axes(handles.axes1);
imshow(im);
% --- Executes on button press in radiobutton1.
function radiobutton1_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobutton1
set(findobj(gcf,'Tag','radiobutton2'),'Value',0);
set(findobj(gcf,'Tag','edit1'),'Enable','off');
% --- Executes on button press in radiobutton2.
function radiobutton2_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobutton2
set(findobj(gcf,'Tag','radiobutton1'),'Value',0);
set(findobj(gcf,'Tag','edit1'),'Enable','on');
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
global thresh
NumStr=get(findobj(gcf,'Tag','edit1'),'String');
thresh=str2num(NumStr);
% --- 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
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
helpwin demo;
% --- 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)
close(gcf);
% --------------------------------------------------------------------
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)
global im
global bw
global thresh
autothresh=get(findobj(gcf,'Tag','radiobutton1'),'Value');
hdl.method='Sobel';
if autothresh
[bw,thresh]=edge(im,hdl.method);
else
bw=edge(im,hdl.method,thresh);
end
axes(handles.axes2);
imshow(bw);
% --------------------------------------------------------------------
function Untitled_4_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_4 (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 bw
global thresh
autothresh=get(findobj(gcf,'Tag','radiobutton1'),'Value');
hdl.method='Prewitt';
if autothresh
[bw,thresh]=edge(im,hdl.method);
else
bw=edge(im,hdl.method,thresh);
end
axes(handles.axes2);
imshow(bw);
% --------------------------------------------------------------------
function Untitled_5_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_5 (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 bw
global thresh
autothresh=get(findobj(gcf,'Tag','radiobutton1'),'Value');
hdl.method='Roberts';
if autothresh
[bw,thresh]=edge(im,hdl.method);
else
bw=edge(im,hdl.method,thresh);
end
axes(handles.axes2);
imshow(bw);
% --------------------------------------------------------------------
function Untitled_6_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handle