two equal webcams -> bug
in
Core Library Questions
•
4 months ago
hi, I'm trying to get it managed to use two webcams of the same kind in my program, but the only way to get two different streams at the same time is when i plug in the first USB-Webcam, start skript one, then plug in the other Webcam and start skript two. Although list() lists all usable webcam-resulutions and I choose for webcam1 Index 0 and for Webcam2 Index 10, it will use just the same stream. And because you can only have one stream per camera, the second stream is just gray. :(
here the output from list() with two webcams plugged in:
here the output from list() with two webcams plugged in:
Available cameras:
0: name=USB-Videogerät,size=640x480,fps=30
1: name=USB-Videogerät,size=352x288,fps=30
2: name=USB-Videogerät,size=320x240,fps=30
3: name=USB-Videogerät,size=176x144,fps=30
4: name=USB-Videogerät,size=160x120,fps=30
5: name=USB-Videogerät,size=640x480,fps=30
6: name=USB-Videogerät,size=352x288,fps=30
7: name=USB-Videogerät,size=320x240,fps=30
8: name=USB-Videogerät,size=176x144,fps=30
9: name=USB-Videogerät,size=160x120,fps=30
10:name=USB-Videogerät,size=640x480,fps=30
11:name=USB-Videogerät,size=352x288,fps=30
12:name=USB-Videogerät,size=320x240,fps=30
13:name=USB-Videogerät,size=176x144,fps=30
14:name=USB-Videogerät,size=160x120,fps=30
15:name=USB-Videogerät,size=640x480,fps=30
16:name=USB-Videogerät,size=352x288,fps=30
17:name=USB-Videogerät,size=320x240,fps=30
18:name=USB-Videogerät,size=176x144,fps=30
19:name=USB-Videogerät,size=160x120,fps=30
"USB-Videogerät" => I'm using a Win7 with german language and processing isn't able to show the sign "ä" :)
^ it means "USB-Videodevice"
my Code:
^ it means "USB-Videodevice"
my Code:
- import processing.video.*;
- Capture cam;
- Capture cam2;
- void setup() {
- size(640,480);
- String[] cameras = Capture.list();
- if (cameras.length == 0) {
- println("There are no cameras available for capture.");
- exit();
- } else {
- println("Available cameras:");
- for (int i = 0; i < cameras.length; i++) {
- if(i<10){
- println(i + ": " + cameras[i]);
- } else {
- println(i + ":" + cameras[i]);
- }
- }
- // The camera can be initialized directly using an
- // element from the array returned by list():
- cam = new Capture(this, cameras[2]);
- cam2 = new Capture(this, cameras[12]);
- cam.start();
- cam2.start();
- }
- }
- void draw() {
- if (cam.available() == true) {
- cam.read();
- }
- if (cam2.available() == true) {
- cam2.read();
- }
- image(cam, 0, 0);
- image(cam2, 320, 0);
- }
1