We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
multiple capture devices (Read 503 times)
multiple capture devices
Sep 18th, 2008, 1:19am
 
I'm interested in working with multiple video capture devices at the same time, for example: two or more webcams capturing and displaying video at the same time in the same computer.
Is this possible? and if so, in wich library should I look?
Thanks in advance.
Re: multiple capture devices
Reply #1 - Sep 26th, 2008, 9:33pm
 
Hi,

Try:

File>Examples>Libraries>Video(Capture)>GettingStartedCapture

I started with that and created the code below. It shows two video inputs side by side. You might have to tweak the device numbers for your cameras.

Sorry, I don't have more time at the moment to add comments and a better explanation.


// CODE STARTS HERE
import processing.video.*;

Capture cam1;
Capture cam2;

void setup() {
 size(640, 240);
 String[] devices = Capture.list();
 println(devices);
 cam1 = new Capture(this, 320, 240, devices[1]);
 cam2 = new Capture(this, 320, 240, devices[2]);
}

void draw() {
 if (cam1.available() == true) {
   cam1.read();
   image(cam1, 0, 0);
 }
 if (cam2.available() == true) {
   cam2.read();
   image(cam2, 320, 0);
 }
}
Re: multiple capture devices
Reply #2 - Sep 27th, 2008, 3:03am
 
Thank you!!
It works fine for me
Page Index Toggle Pages: 1