'getsnapshot' and 'error writing DiskLogger' problems
1 view (last 30 days)
Show older comments
Hello, I'm working with a video acquisition code, it was working fine but suddenly, when I tried to run it again, it shows me this error:
Error using imaqdevice/getsnapshot (line
65)
A timeout occurred during GETSNAPSHOT.
Error in CaptVid (line 16)
I=getsnapshot(vid);
This is the code:
%Image Capture:
clear all
clc
close all
%Corresponding webcam:
vid=videoinput('winvideo',3);
set(vid,'FramesPerTrigger',15);
aviObject=avifile('VideoP_1.avi');
for iFrame=1:10 %Frames
sprintf('Frame %d',iFrame)
I=getsnapshot(vid);
F=im2frame(I);
aviObject=addframe(aviObject,F);
end
sprintf('Cut')
aviObject=close(aviObject);
Also I have another code, trying to do the same but acquiring the video directly but it starts working fine, and then I open another file to analyze the video and then try to run again the video acquisition code and it sends me the "Error writing data to the DiskLogger file." error, this is the other code:
clear all;
close all;
clc;
vid=videoinput('winvideo',3);
set(vid,'FramesPerTrigger',50);
set(vid,'FrameGrabInterval',1);
start(vid);
wait(vid,Inf);
[frames, time]=getdata(vid,get(vid,'FramesAvailable'));
framerate=mean(1./diff(time));
capturetime=15;
interval=get(vid,'FrameGrabInterval');
numframes=floor(capturetime*framerate/interval);
set(vid,'LoggingMode','disk');
avi=avifile('VideoP.avi','fps',framerate);
set(vid,'DiskLogger',avi);
start(vid)
sprintf('Action!')
wait(vid,Inf);
avi=get(vid,'DiskLogger');
avi=close(avi);
delete(vid);
clear vid;
How can I fix this? Thanks
0 Comments
Answers (0)
See Also
Categories
Find more on Acquisition Using Any Hardware in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!