function varargout = heartbreat(varargin)
% HEARTBREAT MATLAB code for heartbreat.fig
% HEARTBREAT, by itself, creates a new HEARTBREAT or raises the existing
% singleton*.
%
% H = HEARTBREAT returns the handle to a new HEARTBREAT or the handle to
% the existing singleton*.
%
% HEARTBREAT('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in HEARTBREAT.M with the given input arguments.
%
% HEARTBREAT('Property','Value',...) creates a new HEARTBREAT or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before heartbreat_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to heartbreat_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 heartbreat
% Last Modified by GUIDE v2.5 21-Oct-2013 10:02:44
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @heartbreat_OpeningFcn, ...
'gui_OutputFcn', @heartbreat_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 heartbreat is made visible.
function heartbreat_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 heartbreat (see VARARGIN)
% Choose default command line output for heartbreat
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes heartbreat wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = heartbreat_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 tg_chakan.
function tg_chakan_Callback(hObject, eventdata, handles)
% hObject handle to tg_chakan (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
winvideo=imaqhwinfo('winvideo');
Formats=winvideo.DeviceInfo.SupportedFormats;
[Sel,ok]=listdlg('ListString',Formats,'PromptString','请选一种格式','SelectionMode','single');
if ok
format=Formats(Sel);
str=format{1};
set(handles.tg_fenbianlv,'string',str);
end
% --- Executes during object creation, after setting all properties.
function tg_chakan_CreateFcn(hObject, eventdata, handles)
% hObject handle to tg_chakan (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
function tg_fenbianlv_Callback(hObject, eventdata, handles)
% hObject handle to tg_fenbianlv (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 tg_fenbianlv as text
% str2double(get(hObject,'String')) returns contents of tg_fenbianlv as a double
% --- Executes on button press in tg_lianjie.
function tg_lianjie_Callback(hObject, eventdata, handles)
% hObject handle to tg_lianjie (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
fenbianlv=get(handles.tg_fenbianlv,'string');
obj= videoinput('winvideo',1,fenbianlv);
set(obj,'ReturnedColorSpace','rgb');
handles.ob=obj;
guidata(hObject,handles);
h=msgbox('摄像头连接成功!','提示');
pause(0.8);
close(h);
% --- Executes on button press in tg_yulan.
function tg_yulan_Callback(hObject, eventdata, handles)
% hObject handle to tg_yulan (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
obj=handles.ob;
vidRes=get(obj,'VideoResolution');
nBands=get(obj,'NumberOfBands');
axes(handles.yulan_axes);
hImage=image(zeros(vidRes(2),vidRes(1),nBands));
preview(obj,hImage);
% --- Executes during object creation, after setting all properties.
function tg_yulan_CreateFcn(hObject, eventdata, handles)
% hObject handle to tg_yulan (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes on button press in tg_zhenlvshu.
function edit3_Callback(hObject, eventdata, handles)
% hObject handle to tg_zhenlvshu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject handle to tg_zhenlvshu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
function tg_zhenlvshu_Callback(hObject, eventdata, handles)
% hObject handle to tg_zhenlvshu (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 tg_zhenlvshu as text
% str2double(get(hObject,'String')) returns contents of tg_zhenlvshu as a double
% --- Executes during object creation, after setting all properties.
function tg_zhenlvshu_CreateFcn(hObject, eventdata, handles)
% hObject handle to tg_zhenlvshu (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- 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)
function edit5_Callback(hObject, eventdata, handles)
% hObject handle to edit5 (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 edit5 as text
% str2double(get(hObject,'String')) returns contents of edit5 as a double
% --- Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit5 (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.
% Se
评论0