1

这段代码应该拍摄实时视频绘制 2 行,但是当我们运行代码时,cam 将拍摄实时视频,但 2 行出现在不同的窗口中。任何人都可以找出问题所在吗?

clear;


dev_info = imaqhwinfo('winvideo',1);
celldisp(dev_info.SupportedFormats);
vid1 = videoinput('winvideo',1);


%out = imaqhwinfo(vid);

%This is for triggering:


num_frames=5;

triggerconfig(vid1, 'Manual')
set(vid1,'FramesPerTrigger',num_frames)

start(vid1);
trigger(vid1)

%frame = getsnapshot(vid1);
%image(frame);

%here it will acquire 5 frames



%now move the data acquired to the workspace
[data1 time1] = getdata(vid1,num_frames);
kk=length(time1);
elapsed_time = time1(kk) - time1(1);
%frame = getsnapshot(vid1);   %this is to get a single frame
for i=1:500

line([27,1523],[1753,1753]);
line([7,1531],[1395,1395]);
 preview(vid1);
end



delete(vid1);
clear vid1;


aviobj = avifile('example.avi');
for i=1:kk
    F=data1(:,:,:,i);
    aviobj = addframe(aviobj,F);
end
aviobj = close(aviobj);

%then we can see the whole video clip
mov = mmreader('example.avi');

%................

%Also, we can directly play the video from the video file
mplay('example.avi');
4

0 回答 0