Clear Filters
Clear Filters

Stop a webcam preview without closing window

2 views (last 30 days)
I'm building a GUI using appdesigner (Matlab 2019a, Support Package for USB Webcams). I'd like to be able to preview my computer's webcam in one of the GUI's axes. I've been able to do it like this:
obj = webcam(1);
vidRes = strsplit(obj.Resolution, 'x');
hImage = image(app.UIAxes, zeros(str2double(vidRes(2)),str2double(vidRes(1)),3));
preview(obj, hImage)
However, I don't know how to stop the preview. Using closePreview(obj) closes the entire GUI window, which is not what I want.
The Image Acquisition Toolbox has a function stoppreview. Is there anything comparable -- or a workaround -- for the webcam support package?
Thanks,
Niraj
  3 Comments
Walter Roberson
Walter Roberson on 29 Jun 2019
We do not know if anyone who works for the Mathworks has read your question.
This is not an official support channel. This resource has questions answered by volunteers, most of whom do not work for Mathworks.
There are on the order of 4000 new questions asked every month (over 5000 per month in late winter as university years finish), so it is easy for any one question to be overlooked by an occasional volunteer who happens to know the answer. Most answers come from the 50 or so most active volunteers, about 90% of whom do not work for Mathworks. It happens that the most active non-Mathworks volunteers seldom use App Designer.
I could answer with respect to the older style preview() function, but I do not have experience with App Designer so I did not respond.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!