function varargout = untitled(varargin)% UNTITLED M-file for untitled.fig%
UNTITLED, by itself, creates a new UNTITLED or raises the existing%
singleton*.%% H = UNTITLED returns the handle to a new UNTITLED or the
handle to% the existing singleton*.%%
UNTITLED('CALLBACK',hObject,eventData,handles,...) calls the local% function
named CALLBACK in UNTITLED.M with the given input arguments.%%
UNTITLED('Property','Value',...) creates a new UNTITLED or raises the%
existing singleton*. Starting from the left, property value pairs are%
applied to the GUI before untitled_OpeningFcn gets called. An% unrecognized
property name or invalid value makes property application% stop. All inputs
are passed to untitled_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 untitled% Last Modified by GUIDE v2.5 11-Jan-2013
13:05:10% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State =
struct('gui_Name', mfilename, ... 'gui_Singleton',
gui_Singleton, ... 'gui_OpeningFcn', @untitled_OpeningFcn, ...
'gui_OutputFcn', @untitled_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{:});else
gui_mainfcn(gui_State, varargin{:});end% End initialization code - DO NOT EDIT% -
-- Executes just before untitled is made visible.function
untitled_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 untitled (see
VARARGIN)% Choose default command line output for untitledhandles.output =
hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes
untitled wait for user response (see UIRESUME)% uiwait(handles.figure1);% ---
Outputs from this function are returned to the command line.function varargout =
untitled_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
structurevarargout{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 str;[filename,pathname]=uigetfile_new({'*.*'},'选择训练图
片...');str=[pathname filename];im=imread(str);axes(handles.axes1);imshow(im);%
--- 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)global
im1;global str1;[filename,pathname]=uigetfile_new({'*.*'},'选择测试图片...');str1=
[pathname filename];im1=imread(str1);axes(handles.axes2);imshow(im1);% ---
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)global im;global im1;global str1;se1 =
strel('disk',5);se2 = strel('square',16);thresh1 = 0.2;thresh2 = 0.01;imtra =
im2double(im);rt = imtra(:,:,1);gt = imtra(:,:,2);bt = imtra(:,:,3);idxr1 =
find(rt>0);idxg1 = find(gt>0);idxb1 = find(bt>0);mr1 = mean(rt(idxr1));mg1 =
mean(gt(idxg1));mb1 = mean(bt(idxb1));clear idxr1 idxg1 idxb1
idxgr1;im1=imread(str1);I1 = im2double(im1);col = size(I1,2);rate = 1600/col;I1 =
imresize(I1,rate);r1 = I1(:,:,1);g1 = I1(:,:,2);b1 = I1(:,:,3);[row1,col1] =
size(r1);r1 = abs(r1 - mr1);g1 = abs(g1 - mg1);b1 = abs(b1 - mb1);% --- Executes
评论0