jeudi 22 mai 2014

image - créer des anaglyphes en temps réel vidéo matlab - Stack Overflow


I currently have this code which overlays two images, however it is only in semi-realtime. Can anyone point me in the right direction as to how to create live anaglyph preview in matlab. Thanks


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;


I currently have this code which overlays two images, however it is only in semi-realtime. Can anyone point me in the right direction as to how to create live anaglyph preview in matlab. Thanks


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;

0 commentaires:

Enregistrer un commentaire