用matlab实时视频

时间:2012-05-02 05:39:22

标签: matlab matlab-deployment

此代码应该采用实时视频绘制2行,但是当我们运行代码时,凸轮将采用实时视频,但是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');

0 个答案:

没有答案