what code i will write to capture image from camera open in axes1

function cameraex_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. handles.output = hObject; vid=videoinput('winvideo',1); set(vid,'ReturnedColorSpace','rgb'); vidRes=get(vid,'VideoResolution'); width=vidRes(1); height=vidRes(2); nBands=get(vid,'NumberOfBands'); hImage=image(zeros(height,width,nBands)); axes(handles.axes1); %axes(handles.axes1); preview(vid,hImage)
"This code open camera in axes1 now i want to capture image on click pushbutton1. what will code on pushbutton."

1 Commento

the below given error is occured when click on pushbutton1
Error using videoinput (line 380) winvideo: The device associated with device ID 1 is already in use. A new videoinput object cannot be created for this device while it is in use.
Error in cameraex>pushbutton1_Callback (line 97) vid=videoinput('winvideo');
Error in gui_mainfcn (line 96) feval(varargin{:});
Error in cameraex (line 42) gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)cameraex('pushbutton1_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su MATLAB Support Package for USB Webcams in Centro assistenza e File Exchange

Richiesto:

il 14 Set 2018

Modificato:

il 15 Set 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by