www.pudn.com > Vehicle_Detection.rar > Vehicle_Detection.m
function varargout = Vehicle_Detection(varargin)
% VEHICLE_DETECTION M-file for Vehicle_Detection.fig
% VEHICLE_DETECTION, by itself, creates a new VEHICLE_DETECTION or raises the existing
% singleton*.
%
% H = VEHICLE_DETECTION returns the handle to a new VEHICLE_DETECTION or the handle to
% the existing singleton*.
%
% VEHICLE_DETECTION('Property','Value',...) creates a new VEHICLE_DETECTION using the
% given property value pairs. Unrecognized properties are passed via
% varargin to Vehicle_Detection_OpeningFcn. This calling syntax produces a
% warning when there is an existing singleton*.
%
% VEHICLE_DETECTION('CALLBACK') and VEHICLE_DETECTION('CALLBACK',hObject,...) call the
% local function named CALLBACK in VEHICLE_DETECTION.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 Vehicle_Detection
% Last Modified by GUIDE v2.5 12-Jun-2005 15:50:28
% Begin initialization code - DO NOT EDIT
%变量说明
%handles.ImageBasic用于存储基本图像信息;handles.BasicImageFlag=1时表示基本图像已读取;handles.ImageCompare
%用于存储比较图像信息;handles.CompareImageFlag=1时表示比较图像已读取;
%handles.ColorMode=1表示图像为RGB图像,需要做转换,handles.ColorMode=2表示图像为灰度图不用转换
%handles.CornerDetectionMode=1表示用SUSAN算法做角点检测,handles.CornerDetectionMode=2表示用Harris算法做角点检测
%handles.CornerDetectionMode=3表示用改进的Harris算法做角点检测
%handles.RegistrationThreshold用于保存匹配阈值
%handles.CornerThreshold用于保存角点检测阈值
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Vehicle_Detection_OpeningFcn, ...
'gui_OutputFcn', @Vehicle_Detection_OutputFcn, ...
'gui_LayoutFcn', [], ...
'gui_Callback', []);
if nargin & isstr(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 Vehicle_Detection is made visible.
function Vehicle_Detection_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 Vehicle_Detection
handles.output = hObject;
handles.CornerDetectionMode=0;
handles.BasicImageFlag=0;
handles.CompareImageFlag=0;
handles.ColorMode=0;
handles.RegistrationThreshold=0;
handles.CornerThreshold=0;
guidata(hObject, handles);
% UIWAIT makes Vehicle_Detection wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = Vehicle_Detection_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 CornerSusan.
function CornerSusan_Callback(hObject, eventdata, handles)
NewVal=get(hObject,'Value');
if NewVal
set(handles.CornerHarris,'Value',0);
set(handles.CornerHarrisIM,'Value',0);
handles.CornerDetectionMode=1;
GUIDATA(hObject,handles);
else
handles.CornerDetectionMode=0;
GUIDATA(hObject,handles);
end;
% --- Executes on button press in CornerHarrisIM.
function CornerHarrisIM_Callback(hObject, eventdata, handles)
NewVal=get(hObject,'Value');
if NewVal
set(handles.CornerSusan,'Value',0);
set(handles.CornerHarris,'Value',0);
handles.CornerDetectionMode=3;
GUIDATA(hObject,handles);
else
handles.CornerDetectionMode=0;
GUIDATA(hObject,handles);
end;
% --- Executes on button press in CornerHarris.
function CornerHarris_Callback(hObject, eventdata, handles)
NewVal=get(hObject,'Value');
if NewVal
set(handles.CornerSusan,'Value',0);
set(handles.CornerHarrisIM,'Value',0);
handles.CornerDetectionMode=2;
GUIDATA(hObject,handles);
else
handles.CornerDetectionMode=0;
GUIDATA(hObject,handles);
end;
% --- Executes during object creation, after setting all properties.
function CornerThreshold_CreateFcn(hObject, eventdata, handles)
% hObject handle to CornerThreshold (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
function CornerThreshold_Callback(hObject, eventdata, handles)
handles.CornerThreshold=str2num(get(hObject,'String'));
GUIDATA(hObject,handles);
% --- Executes during object creation, after setting all properties.
function BasicNum_CreateFcn(hObject, eventdata, handles)
% hObject handle to BasicNum (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
function BasicNum_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
function RegistrationThreshold_CreateFcn(hObject, eventdata, handles)
% hObject handle to RegistrationThreshold (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
function RegistrationThreshold_Callback(hObject, eventdata, handles)
handles.RegistrationThreshold=str2num(get(hObject,'String'));
GUIDATA(hObject,handles);
% --- Executes on button press in CornerCancelBasic.
function CornerCancelBasic_Callback(hObject, eventdata, handles)
delete(get(handles.Basicaxes,'Child'));
set(handles.BasicNum,'String','0');
% --- Executes on button press in CornerRunBasic.
function CornerRunBasic_Callback(hObject, eventdata, handles)
BasicImageFlag=handles.BasicImageFlag;
if BasicImageFlag==0
errordlg('请导入基本图像');
return;
end
CornerDetectionMode=handles.CornerDetectionMode;
if CornerDetectionMode==0
errordlg('请选择角点检测方法');
return;
end
CornerThreshold=handles.CornerThreshold;
if CornerThreshold==0
errordlg('请设置角点检测阈值');
return;
end
if CornerDetectionMode==1
num=SUSAN(handles.Basicaxes,CornerThreshold,handles.ImageBasic);
elseif CornerDetectionMode==2
num=harris(handles.Basicaxes,CornerThreshold,handles.ImageBasic);
else
num=Imharris(handles.Basicaxes,CornerThreshold,handles.ImageBasic);
end
set(handles.BasicNum,'String',num2str(num));
% --- Executes on button press in CornerLoadBasic.
function CornerLoadBasic_Callback(hObject, eventdata, handles)
if handles.ColorMode==0
errordlg('请给出图像模式(RGB或Gray)');
return;
end
[filename, pathname] = uigetfile( ...
{'*.jpg', 'All JPEG-Files (*.jpg)'; '*.bmp','All BMP-Files(*,bmp)';
'*.*','All Files (*.*)'}, ...
'Select IMAGE Files');
% If "Cancel" is selected then return
if isequal([filename,pathname],[0,0])
return
% Otherwise construct the fullfilename and Check and load the file.
else
% if the MAT-file is not valid, do not save the name
Image = imread(filename);
axes(handles.Basicaxes)
IMSHOW(Image);
if handles.ColorMode==1
Image=rgb2gray(Image);
end
handles.ImageBasic=Image;
handles.BasicImageFlag=1;
GUIDATA(hObject,handles);
end
% --- Executes on button press in CornerCancelCompare.
function CornerCancelCompare_Callback(hObject, eventdata, handles)
delete(get(handles.Compareaxes,'Child'));
set(handles.CompareNum,'String','0');
% --- Executes on button press in CornerRunCompare.
function CornerRunCompare_Callback(hObject, eventdata, handles)
CompareImageFlag=handles.CompareImageFlag;
if CompareImageFlag==0
errordlg('请导入比较图像');
return;
end
CornerDetectionMode=handles.CornerDetectionMode;
if CornerDetectionMode==0
errordlg('请选择角点检测方法');
return;
end
CornerThreshold=handles.CornerThreshold;
if CornerThreshold==0
errordlg('请设置角点检测阈值');
return;
end
if CornerDetectionMode==1
num=SUSAN(handles.Compareaxes,CornerThreshold,handles.ImageCompare);
elseif CornerDetectionMode==2
num=harris(handles.Compareaxes,CornerThreshold,handles.ImageCompare);
else
num=Imharris(handles.Compareaxes,CornerThreshold,handles.ImageCompare);
end
set(handles.CompareNum,'String',num2str(num));
% --- Executes on button press in CornerLoadCompare.
function CornerLoadCompare_Callback(hObject, eventdata, handles)
[filename, pathname] = uigetfile( ...
{'*.jpg', 'All JPEG-Files (*.jpg)'; '*.bmp','All BMP-Files(*,bmp)';
'*.*','All Files (*.*)'}, ...
'Select IMAGE Files');
% If "Cancel" is selected then return
if isequal([filename,pathname],[0,0])
return
% Otherwise construct the fullfilename and Check and load the file.
else
% if the MAT-file is not valid, do not save the name
Image = imread(filename);
%set(hObject, 'Units', 'pixels');
%axes(handles.Basicaxes)
axes(handles.Compareaxes)
IMSHOW(Image);
if handles.ColorMode==1
Image=rgb2gray(Image);
end
handles.ImageCompare=Image;
handles.CompareImageFlag=1;
GUIDATA(hObject,handles);
end
% --- Executes on button press in RegistrationRun.
function RegistrationRun_Callback(hObject, eventdata, handles)
BasicImageFlag=handles.BasicImageFlag;
if BasicImageFlag==0
errordlg('请导入基本图像');
return;
end
CompareImageFlag=handles.CompareImageFlag;
if CompareImageFlag==0
errordlg('请导入比较图像');
return;
end
threshold=handles.RegistrationThreshold;
if threshold==0
errordlg('请设置阈值');
return;
end
Basic=handles.ImageBasic;
%H=figure(1);
%imshow(Basic);
Basic=double(Basic);
[By,Bx]=size(Basic);
corner1=harris1(Basic,handles.CornerThreshold);
Compare=handles.ImageCompare;
%imshow(Compare);
%Compare=rgb2gray(Compare);
Compare=double(Compare);
[Cy,Cx]=size(Compare);
%pause;
corner2=harris1(Compare,handles.CornerThreshold);
row1=size(corner1,1);
row2=size(corner2,1);
lamda1=0.2;
lamda2=0.4;
lamda3=0.4;
f1B=zeros(row1,1);
f2B=zeros(row1,1);
f3B=zeros(row1,1);
for i=1:row1
if corner1(i,1)>2&corner1(i,1)2&corner1(i,2)2&corner2(i,1)2&corner2(i,2)2&corner1(i,1)2&corner1(i,2)2&corner2(i,1)2&corner2(i,2)255
% im(i,j)=255;
% end
% end
% end
r = zeros(row,col);
cgx = zeros(row,col);
cgy = zeros(row,col);
for k = -256:256
temp = k/thresh;
temp = temp * temp;
if index == 6
temp = temp * temp * temp;
end
temp = 100*exp(-temp);
bp(k+257) = temp;
end
for i = 6:row-5
for j = 6:col-5
n = 100;
cp = 256+im(i,j);
n = n+bp(cp-im(i-3,j-1));
n = n+bp(cp-im(i-3,j));
n = n+bp(cp-im(i-3,j+1));
n = n+bp(cp-im(i-2,j-2));
n = n+bp(cp-im(i-2,j-1));
n = n+bp(cp-im(i-2,j));
n = n+bp(cp-im(i-2,j+1));
n = n+bp(cp-im(i-2,j+2));
n = n+bp(cp-im(i-1,j-3));
n = n+bp(cp-im(i-1,j-2));
n = n+bp(cp-im(i-1,j-1));
n = n+bp(cp-im(i-1,j));
n = n+bp(cp-im(i-1,j+1));
n = n+bp(cp-im(i-1,j+2));
n = n+bp(cp-im(i-1,j+3));
n = n+bp(cp-im(i,j-3));
n = n+bp(cp-im(i,j-2));
n = n+bp(cp-im(i,j-1));
n = n+bp(cp-im(i,j+1));
n = n+bp(cp-im(i,j+2));
n = n+bp(cp-im(i,j+3));
n = n+bp(cp-im(i+1,j-3));
n = n+bp(cp-im(i+1,j-2));
n = n+bp(cp-im(i+1,j-1));
n = n+bp(cp-im(i+1,j));
n = n+bp(cp-im(i+1,j+1));
n = n+bp(cp-im(i+1,j+2));
n = n+bp(cp-im(i+1,j+3));
n = n+bp(cp-im(i+2,j-2));
n = n+bp(cp-im(i+2,j-1));
n = n+bp(cp-im(i+2,j));
n = n+bp(cp-im(i+2,j+1));
n = n+bp(cp-im(i+2,j+2));
n = n+bp(cp-im(i+3,j-1));
n = n+bp(cp-im(i+3,j));
n = n+bp(cp-im(i+3,j+1));
if n < max_no
x = 0; y = 0;
c = bp(cp - im(i-3,j-1)); x = x-c; y = y-3*c;
c = bp(cp - im(i-3,j)); y = y-3*c;
c = bp(cp - im(i-3,j-1)); x = x+c; y = y-3*c;
c = bp(cp - im(i-2,j-2)); x = x-2*c; y = y-2*c;
c = bp(cp - im(i-2,j-1)); x = x-c; y = y-2*c;
c = bp(cp - im(i-2,j)); y = y-2*c;
c = bp(cp - im(i-2,j+1)); x = x+c; y = y-2*c;
c = bp(cp - im(i-2,j+2)); x = x+2*c; y = y-2*c;
c = bp(cp - im(i-1,j-3)); x = x-3*c; y = y-c;
c = bp(cp - im(i-1,j-2)); x = x-2*c; y = y-c;
c = bp(cp - im(i-1,j-1)); x = x-c; y = y-c;
c = bp(cp - im(i-1,j)); y = y-2*c;
c = bp(cp - im(i-1,j+1)); x = x+c; y = y-c;
c = bp(cp - im(i-1,j+2)); x = x+2*c; y = y-c;
c = bp(cp - im(i-1,j+3)); x = x+3*c; y = y-c;
c = bp(cp - im(i,j-3)); x = x-3*c;
c = bp(cp - im(i,j-2)); x = x-2*c;
c = bp(cp - im(i,j-1)); x = x-c;
c = bp(cp - im(i,j+1)); x = x+c;
c = bp(cp - im(i,j+2)); x = x+2*c;
c = bp(cp - im(i,j+3)); x = x+3*c;
c = bp(cp - im(i+1,j-3)); x = x-3*c; y = y+c;
c = bp(cp - im(i+1,j-2)); x = x-2*c; y = y+c;
c = bp(cp - im(i+1,j-1)); x = x-1*c; y = y+c;
c = bp(cp - im(i+1,j)); y = y+c;
c = bp(cp - im(i+1,j+1)); x = x+c; y = y+c;
c = bp(cp - im(i+1,j+2)); x = x+2*c; y = y+c;
c = bp(cp - im(i+1,j+3)); x = x+3*c; y = y+c;
c = bp(cp - im(i+2,j-2)); x = x-2*c; y = y+2*c;
c = bp(cp - im(i+2,j-1)); x = x-c; y = y+2*c;
c = bp(cp - im(i+2,j)); y = y+2*c;
c = bp(cp - im(i+2,j+1)); x = x+c; y = y+2*c;
c = bp(cp - im(i+2,j+2)); x = x+2*c; y = y+2*c;
c = bp(cp - im(i+3,j-1)); x = x-c; y = y+3*c;
c = bp(cp - im(i+3,j)); y = y+3*c;
c = bp(cp - im(i+3,j+1)); x = x+c; y = y+3*c;
xx = x*x;
yy = y*y;
sq = xx+yy;
if sq > (n*n)/2
if yy < xx
divide = y/abs(x);
sq = abs(x)/x;
sq = bp(cp - im(round(i+divide),j+sq)) + bp(cp - im(round(i+2*divide),j+2*sq))...
+bp(cp - im(round(i+3*divide),j+3*sq));
else
divide = x/abs(y);
sq = abs(y)/y;
sq = bp(cp - im(i+sq,round(j+divide))) + bp(cp - im(i+2*sq,round(j+2*divide)))...
+bp(cp - im(i+3*sq,round(j+3*divide)));
end
if sq > 290
r(i,j) = max_no-n;
cgx(i,j) = (51*x)/n;
cgy(i,j) = (51*y)/n;
end
end
end
end
end
n = 1;
for i = 6:row-5
for j = 6:col-5
x = r(i,j);
if x > 0
if five_or_seven == 5
if x>r(i-2,j-2) & x>r(i-2,j-1) & x>r(i-2,j) & x>r(i-2,j+1) & x>r(i-2,j+2)...
& x>r(i-1,j-2) & x>r(i-1,j-1) & x>r(i-1,j) & x>r(i-1,j+1) & x>r(i-1,j+2)...
& x>r(i,j-2) & x>r(i,j-1) & x>=r(i,j+1) & x>=r(i,j+2)...
& x>=r(i+1,j-2) & x>=r(i+1,j-1) & x>=r(i+1,j) & x>=r(i+1,j+1) & x>=r(i+2,j+2)...
& x>=r(i+2,j-2) & x>=r(i+2,j-1) & x>=r(i+2,j) & x>=r(i+2,j+1) & x>=r(i+2,j+2)
corner_list(n).info = 0;
corner_list(n).x = j;
corner_list(n).y = i;
corner_list(n).dx = cgx(i,j);
corner_list(n).dy = cgy(i,j);
n = n+1;
end
else if five_or_seven == 7
if x>r(i-3,j-3) & x>r(i-3,j-2) & x>r(i-3,j-1) & x>r(i-3,j) & x>r(i-3,j+1) & x>r(i-3,j+2) & x>r(i-3,j+3)...
& x>r(i-2,j-3) & x>r(i-2,j-2) & x>r(i-2,j-1) & x>r(i-2,j) & x>r(i-2,j+1) & x>r(i-2,j+2) & x>r(i-2,j+3)...
& x>r(i-1,j-3) & x>r(i-1,j-2) & x>r(i-1,j-1) & x>r(i-1,j) & x>r(i-1,j+1) & x>r(i-1,j+2) & x>r(i-1,j+3)...
& x>r(i,j-3) & x>r(i,j-2) & x>r(i,j-1) & x>=r(i,j+1) & x>=r(i,j+2) & x>=r(i,j+3)...
& x>=r(i+1,j-3) & x>=r(i+1,j-2) & x>=r(i+1,j-1) & x>=r(i+1,j) & x>=r(i+1,j+1) & x>=r(i+1,j+2) & x>=r(i+1,j+3)...
& x>=r(i+2,j-3) & x>=r(i+2-2) & x>=r(i+2,j-1) & x>=r(i+2,j) & x>=r(i+2,j+1) & x>=r(i+2,j+2) & x>=r(i+2,j+3)...
& x>=r(i+3,j-3) & x>=r(i+3,j-2) & x>=r(i+3,j-1) & x>=r(i+3,j) & x>=r(i+3,j+1) & x>=r(i+3,j+2) & x>=r(i+3,j+3)
corner_list(n).info = 0;
corner_list(n).x = j;
corner_list(n).y = i;
corner_list(n).dx = cgx(i,j);
corner_list(n).dy = cgy(i,j);
n = n+1;
end
else
error('you have passed a inappropriate width for non-maximum suppression');
end
end
end
end
end
corner_list(n).info = 7;
if n > 15000
error('Too many corners.');
end
%fid1=fopen('corner_row19.txt','w');
%fid2=fopen('corner_column19.txt','w');
i = 1;
axes(handleaxes);
while corner_list(i).info ~= 7
hold on;
%fprintf(fid1,'%i \n',corner_list(i).y);
%fprintf(fid2,'%i \n',corner_list(i).x);
plot(corner_list(i).x,corner_list(i).y,'r+');
i = i+1;
end
num=i;
%return(num);
function num=harris(handleaxes,Threshold,image)
image=double(image);
threshold=Threshold;
[Ix,Iy]=gradient(image);
%选定合适的高斯平滑滤波模板
gaussian = fspecial('gaussian',[3 3],0.4);
%分别相卷积
Ix2 = conv2(Ix.^2, gaussian, 'same');
Iy2 = conv2(Iy.^2, gaussian, 'same');
Ixy = conv2(Ix.*Iy, gaussian, 'same');
% 分别计算各点的特征点选取函数值(Ix2.*Iy2 - Ixy.^2)-k*(Ix2 + Iy2 )
%通常k取0.04
k = 0.04;
a=Ix2.*Iy2 - Ixy.^2;
b=(Ix2 + Iy2).^2;
cim = a - k*b;
%选取局部最大值
radius=8;
size = 2*radius+1;
max = ordfilt2(cim,size^2,ones(size));
%获取角点的行列值
cim = (cim==max)&(cim>threshold);
[r,c] = find(cim);
axes(handleaxes);
hold on
plot(c,r,'r+');
num=length(c);
%return num;
function num=Imharris(handleaxes,threshold,image)
image=double(image);
[Ix,Iy]=gradient(image);
gaussian1= fspecial('gaussian',[3 3],1);
gaussian2= fspecial('gaussian',[3 3],2);
Ix2_1= conv2(Ix.^2, gaussian1, 'same'); % Smoothed squared image derivatives
Iy2_1 = conv2(Iy.^2, gaussian1, 'same');
Ixy_1= conv2(Ix.*Iy, gaussian1, 'same');
Ix2_2= conv2(Ix.^2, gaussian2, 'same'); % Smoothed squared image derivatives
Iy2_2 = conv2(Iy.^2, gaussian2, 'same');
k = 0.005;
a=Ix2_1.*Iy2_1- Ixy_1.^2;
b=(Ix2_2 + Iy2_2).^2;
cim = a - k*b;
radius=8;
size = 2*radius+1; % Size of mask.
max = ordfilt2(cim,size^2,ones(size));% Grey-scale dilate.
cim = (cim==max)&(cim>threshold); % Find maxima.
[r,c] = find(cim); % Find row,col coords.
axes(handleaxes);
hold on
plot(c,r,'r+');
num=length(c);
function ans=harris1(image,threshold)
[Ix,Iy]=gradient(image);
gaussian = fspecial('gaussian', [3 3], 0.4);
Ix2 = conv2(Ix.^2, gaussian, 'same'); % Smoothed squared image derivatives
Iy2 = conv2(Iy.^2, gaussian, 'same');
Ixy = conv2(Ix.*Iy, gaussian, 'same');
% cim = (Ix2.*Iy2 - Ixy.^2)./(Ix2 + Iy2 + eps); % My preferred measure.
k = 0.04;
cim = (Ix2.*Iy2 - Ixy.^2) - k*(Ix2 + Iy2).^2;
radius=8;
size = 2*radius+1; % Size of mask.
max = ordfilt2(cim,size^2,ones(size)); % Grey-scale dilate.
cim = (cim==max)&(cim>threshold); % Find maxima.
[c,r] = find(cim); % Find row,col coords.
ans= [c,r];
% --- Executes during object creation, after setting all properties.
function CompareNum_CreateFcn(hObject, eventdata, handles)
% hObject handle to CompareNum (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
function CompareNum_Callback(hObject, eventdata, handles)
% hObject handle to CompareNum (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 CompareNum as text
% str2double(get(hObject,'String')) returns contents of CompareNum as a double