'A timeout occurred during GETSNAPSHOT' error

Hello, I'm working fine with a code that suddenly sends me the "A timeout occurred during GETSNAPSHOT" error I don't know why this is happening, here's the code:
clear all
clc
close all
%Corresponding webcam:
vid=videoinput('winvideo',3);
%set(vid,'FramesPerTrigger',10);
%triggerconfig(vid,'manual');
aviObject=avifile('VideoP_2.avi');
%aviObject=VideoWriter('Video6.avi');
%preview(vid)
for iFrame=1:30 %Frames
sprintf('Frame %d',iFrame)
I=getsnapshot(vid);
F=im2frame(I);
aviObject=addframe(aviObject,F);
end
sprintf('Cut')
aviObject=close(aviObject);
Do you know why is this happening or how can I solve this? Thanks a lot!

回答 (1 件)

Image Analyst
Image Analyst 2017 年 4 月 19 日

0 投票

Apparently the camera is not responding. Can you get a live image?

1 件のコメント

Annie
Annie 2017 年 4 月 19 日
When I activate the 'preview(vid)' command sometimes it gets slowly and takes time to show the image or sometimes it doesn't show it

サインインしてコメントする。

質問済み:

2017 年 4 月 19 日

コメント済み:

2017 年 4 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by