MATLAB Answers

updating handles in gui/guide for webcam

2 views (last 30 days)
Christian Buchgeher
Christian Buchgeher on 12 Dec 2016
I am trying to create a GUI where a user can select between the different webcams attached to the pc. Using the preview function u can see the live data form the webcam.
My problem is switching between webcams. I stored the webcam in and I don't know how to update it to the new webcaminformation. usesing delete doesn't work(since it makes invalid).
selectedcamera = strtrim(selectedcamera);


Sign in to comment.

Answers (1)

Mischa Kim
Mischa Kim on 12 Dec 2016
Christian, I solved a similar problem by removing the associated field of the handles object.
So essentially (and following your approach), you would close the preview and remove the webcam object. After that you can pick another webcam and create the object.
handles = rmfield(handles,'wc');
handles.wc = webcam;


Christian Buchgeher
Christian Buchgeher on 12 Dec 2016
Unfortunately this solution does not work.
the webcam stays active and the preview window goes black.
Christian Buchgeher
Christian Buchgeher on 12 Dec 2016
It does close the but somehow the webcam still stays active. and it does open the new webcam for a glimpse of a second.
I have the preview window in an axces field .
and different sliders to change the properties of the webcam.
i also attached my code files.

Sign in to comment.

Sign in to answer this question.

Translated by