Assuming you have done everything right and shot your left and right video, you can follow the next steps to mix them into one that can be watched using a pair of red-cyan 3-D glasses (using the imfuse
function we have already discussed in the previous chapter):
>> left = VideoReader('left.avi'), % Open left video file >> right = VideoReader('right.avi'), % Open right video file
>> vidOut = VideoWriter('Vid3D.avi'), % Open 3D video file >>open(vidOut);
>> for i = 1:left.NumberOfFrames % For all frames l = read(left,i); % Load i-th left frame r = read(right,i); % Load i-th right frame %Fuse the right and left channel into a red-cyan false color image v3 = imfuse(r,l,'falsecolor','ColorChannels','red-cyan'), writeVideo(vidOut ,v3); % Write frame to video end close(vidOut);
This was pretty simple, right? The process of making a 3-D false-colored video is really a piece of cake, provided you have shot your left and right channels. The steps are very few, since the only things that have to be done are opening the input videos for the left and right camera, creating an output video for the fused 3-D frame sequence, and then reading each frame of the right and left channel and fusing them using imfuse
. The generated image was written as a new frame in the output video. When the whole process was over, we closed the open video object used for writing, so that the video was finalized.