The device associated with device ID 1 is already in use. ERROR!!! . One webcam used for function and gui display???
Mostra commenti meno recenti
I am trying to use a webcam in a function that i run with the gui while at the same time displaying the live video of the webcam in my gui. I can so far get the live video on my gui but when I try to start my function with the gui i get this error below. I have made vid global in my function not the gui and that's how i got the live video to display on the gui finally but i still cant figure out what to do to get both the function and my gui using the one webcam.
Thanks in advance!!!!!!
Error using videoinput (line 379)
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 AutofocusGUIGOOD (line 8) vid = videoinput('winvideo', 1, 'YUY2_640x480');
Error in LIBSGUI624>pushbutton1_Callback (line 89) AutofocusGUIGOOD(Ss , SR);
Error in gui_mainfcn (line 96) feval(varargin{:});
Error in LIBSGUI624 (line 43) gui_mainfcn(gui_State, varargin{:});
2 Commenti
Geoff Hayes
il 26 Giu 2014
Richard - from the above error message, it appears that the user (so you!) pushed a button on the GUI ( pushbutton1 ) and its callback ( pushbutton1_Callback * )fired, which called the *AutofocusGUIGOOD function. Line 8 is
vid = videoinput('winvideo', 1, 'YUY2_640x480');
And 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 is thrown because (as you have already said) you are displaying the video from the webcam in the GUI which is being "read" from device 1.
The error message makes sense - the code cannot call the videoinput a second on the same device without deleting the first one.
So how or where are you (in your GUI) are you making the first videoinput call to create a video input object? Because it is with that object that your code will need to reference in the button callback (and so AutofocusGUIGOOD function).
And please clarify what you mean by I have made vid global in my function not the gui.
Richard
il 26 Giu 2014
Risposta accettata
Più risposte (1)
Richard
il 30 Giu 2014
0 voti
Categorie
Scopri di più su Image Preview and Device Configuration in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!