Jump to content


Check out our Community Blogs





- - - - -

Matlab Code For Real Time 3d Red-Cyan Creation Using Two Webcams

Posted by SkHacker, 20 January 2013 · 4037 views

matlab 3d real time red-cyan using two webcams
Matlab Code For Real Time 3d Red-Cyan Creation Using Two Webcams Developers FB contact: https://www.facebook.../saurabhhacker2
Requirements:
  • Two webcams of same company and model number.
  • A laptop with installed Matlab software.
The theory of creating a red-cyan 3D image is really very simple.
There are two images taken using two webcams. The aim is to provide these 2 different images to our two different eyes using only a single image. So, we take the red component of left webcam image and cyan(blue+green) component of right webcam image and mix them together creating a final image.


Now, before moving further we should know that a red-cyan glass has has a red glass on left eye and cyan glass on right eye. When an end user uses a red-cyan glasses then the red part of the final image is passed to left eye (filtering cyan out of the image) and cyan part of the image is passed to the right eye (filtering red out of the image).
When we look to out 1st para we would get that the filtering of the glass has sent the left webcam image(red) to left eye and right webcam image(cyan) to right eye.
This process is exactly the same that happens with our two naked eyes and then the human brain processes the information to 3 dimensional view...

Here I have posted a simple matlab code for your better understanding.

%Taking Input From Left Camera
camera1=videoinput('winvideo',1,'YUY2_640x480');
set(camera1,'FramesPerTrigger',1);
set(camera1,'TriggerRepeat',Inf);
start(camera1);

%Taking Input From Right Camera
camera2=videoinput('winvideo',2,'YUY2_640x480');
set(camera2,'FramesPerTrigger',1);
set(camera2,'TriggerRepeat',Inf);
start(camera2);

while(1)
cam1_img=getsnapshot(camera1); % left camera
cam2_img=getsnapshot(camera2); % right camera
cam1_img(:,:,2:3)=0; % removing cyan from left cam image to get red component
cam2_img(:,:,1)=0; % removing red from right cam image to get cyan component
final_img=cam1_img+cam2_img;
imshow(final_img);
end


  • 1



My Picture

Search My Blog

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download