function varargout = tuxiang(varargin)
% TUXIANG M-file for tuxiang.fig
% TUXIANG, by itself, creates a new TUXIANG or raises the existing
% singleton*.
%
% H = TUXIANG returns the handle to a new TUXIANG or the handle to
% the existing singleton*.
%
% TUXIANG('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in TUXIANG.M with the given input arguments.
%
% TUXIANG('Property','Value',...) creates a new TUXIANG or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before tuxiang_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to tuxiang_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
% Copyright 2002-2003 The MathWorks, Inc.
% Edit the above text to modify the response to help tuxiang
% Last Modified by GUIDE v2.5 11-Jun-2008 21:33:02
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @tuxiang_OpeningFcn, ...
'gui_OutputFcn', @tuxiang_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 tuxiang is made visible.
function tuxiang_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 tuxiang (see VARARGIN)
% Choose default command line output for tuxiang
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes tuxiang wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = tuxiang_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 AC_Callback(hObject, eventdata, handles)
% hObject handle to AC (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
selection = questdlg(['Close ' get(handles.figure1,'Name') '?'],...
['Close ' get(handles.figure1,'Name') '...'],...
'Yes','No','Yes');
if strcmp(selection,'No')
return;
end
delete(handles.figure1)
% --------------------------------------------------------------------
function AA_Callback(hObject, eventdata, handles)
% hObject handle to AA (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global tu
[filename, pathname] = uigetfile( ...
{'*.bmp;*.jpg;*.gif', 'All Files (*.bmp,*.jpg,*.gif)';
'*.*','All Files (*.*)'}, ...
'§§§§')
str=[pathname filename];
tu=imread(str);
subplot(1,2,1);
imshow(tu);
title('原图');
% --------------------------------------------------------------------
function ba_Callback(hObject, eventdata, handles)
% hObject handle to ba (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%¨¨ì
global tu
a=rgb2gray(tu);
I=imhist(a); %¨¨
I=histeq(a); %¨¨§
subplot(1,2,1),imshow(tu),title('原图');
subplot(1,2,2),imshow(I),title('直方图均衡化');
% --------------------------------------------------------------------
function bb_Callback(hObject, eventdata, handles)
% hObject handle to bb (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%
global tu
a=rgb2gray(tu);
subplot(1,2,1),imshow(tu),title('原图');
subplot(1,2,2),imshow(a),title('灰度图');
% --------------------------------------------------------------------
function bc_Callback(hObject, eventdata, handles)
% hObject handle to bc (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%
global tu
background=imopen(tu,strel('disk',80));
i=imsubtract(tu,background);
subplot(1,2,1),imshow(tu),title('原图');
subplot(1,2,2),imshow(i),title('去背景');
% --------------------------------------------------------------------
function bd_Callback(hObject, eventdata, handles)
% hObject handle to bd (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%ì
global tu
a=graythresh(tu);
b=im2bw(tu,a);
subplot(1,2,1),imshow(tu),title('原图');
subplot(1,2,2),imshow(b),title('二值化');
% --------------------------------------------------------------------
function Untitled_10_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_10 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Untitled_11_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_11 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Untitled_12_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_12 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function ca_Callback(hObject, eventdata, handles)
% hObject handle to ca (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global tu
a=imadd(tu,50);
subplot(1,2,1),imshow(tu),title('原图');
subplot(1,2,2),imshow(a),title('亮度增加');
% --------------------------------------------------------------------
function cb_Callback(hObject, eventdata, handles)
% hObject handle to cb (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global tu
a=imsubtract(tu,50);
subplot(1,2,1),imshow(tu),title('原图');
subplot(1,2,2),imshow(a),title('亮度减弱');
% --------------------------------------------------------------------
function cc_Callback(hObject, eventdata, handl
评论2