MATLAB Answers


Webcam preview in GUI axes is shown as black image

Asked by Valentin Stegmaier on 14 Jun 2019
Latest activity Commented on by Valentin Stegmaier on 15 Jun 2019
Hi there,
i'm trying to show the live video of a webcam in an GUI right now using the axes area.
By using the preview function in it's own window i can see the live video of the webcam.
But by using the preview function with the image handle to show the sequence in the axes area there is just a black image displayed.
I already changed the resolution and tried a different webcam, but i always get the black image.
The Webcam is a Logitech c922 Pro Stream and i'm using Windows 10 64 bit with Matlab R2019a.
Thank you very much for your help in advance.
Here is the code i'm using:
function pushbutton_start_Callback(hObject, eventdata, handles)
cam = webcam(2);
frame = snapshot(cam);
im = image(handles.axes_video,zeros(size(frame),'uint8'));


Sign in to comment.

1 Answer

Answer by Geoff Hayes
on 14 Jun 2019
 Accepted Answer

  1 Comment

Hi Geoff,
thanks for your help. Everything working now.
Best valentin

Sign in to comment.