I just learn to use MATLAB to make GUI for camera input. I have got 1 sample for me to learn from in file exchange and i tried it out myself but it doesnt work.
I need to capture image using webcam with a click on the button for futher processing. however error message pop up when i click the button.
the error message are:
??? Error using ==> fevalUndefined function or method 'startstopcamera_Callback' for input arguments of type 'double'.Error in ==> gui_mainfcn at 96 feval(varargin{:});Error in ==> camera at 42 gui_mainfcn(gui_State, varargin{:});Error in ==>@(hObject,eventdata)camera('startstopcamera_Callback',hObject,eventdata,guidata(hObject))??? Error while evaluating uicontrol Callback
and my code for gui are:
function varargout = camera(varargin)% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @camera_OpeningFcn, ... 'gui_OutputFcn', @camera_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
function camera_OpeningFcn(hObject, eventdata, handles, varargin)handles.output = hObject;handles.video = videoinput('winvideo', 1);set(handles.video,'TimerPeriod', 0.05, ...'TimerFcn',['if(~isempty(gco)),'...'handles=guidata(gcf);'...'image(getsnapshot(handles.video));'... 'set(handles.cameraAxes,''ytick'',[],''xtick'',[]),'... 'else '...'delete(imaqfind);'... 'end']);triggerconfig(handles.video,'manual');guidata(hObject, handles);uiwait(handles.myCameraGUI);function varargout = myCameraGUI_OutputFcn(hObject, eventdata, handles)handles.output = hObject;varargout{1} = handles.output;function startStopCamera_Callback(hObject, eventdata, handles)if strcmp(get(handles.startStopCamera,'String'),'Start Camera')set(handles.startStopCamera,'String','Stop Camera')start(handles.video)elseset(handles.startStopCamera,'String','Start Camera')stop(handles.video)end
can any1 point out my problem?? and it will be better if you link more samples for me to learn. Thanks in advance.
Best Answer