我目前有这个代码覆盖两个图像,但它只是半实时的。任何人都可以为我指出如何在 matlab 中创建实时立体图预览的正确方向。谢谢
clear all
close all
clc;
vid = videoinput('winvideo',1, 'YUY2_640x480');
vid1 = videoinput('winvideo',2, 'YUY2_640x480');
% to convert to rgb colors
vid.ReturnedColorSpace = 'rgb';
vid1.ReturnedColorSpace = 'rgb';
set(vid,'FramesPerTrigger',1);
set(vid1,'FramesPerTrigger',1);
% set(vid, 'TriggerRepeat',inf);
% set(vid1, 'TriggerRepeat',inf);
while (1)
start(vid);
start(vid1);
%retrieves all the frames acquired at the last trigger
data = getdata(vid);
data1 = getdata(vid1);
% processes the color channels of the videos
data(:,:,1)=0;
data(:,:,2)=0;
data1(:,:,2)=0;
data1(:,:,3)=0;
%to display them in one video
result=data+data1;
imshow(result);
drawnow;
end
stop(vid),delete(vid),clear vid;