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
Capture.list() & Example Code (Read 1426 times)
Capture.list() & Example Code
Sep 2nd, 2007, 11:59pm
 
So, I'm trying to initialize Processing Video and connect my DV camera. First step: figure out the name Capture uses to reference the camera. I'm using the following example code:

import processing.video.*;  

Capture video;

void setup() {  
 size(640, 480);
 frameRate(30);
 
 print("Devices: " + Capture.list());
}

This results in the following output to the P5 console:

Devices: [Ljava.lang.String;@a77106

That looks to me like print() tried to print the reference to the string rather than the string itself. I'm a bit mystified considering the example code on the library page and here in the forums tends to use the print(Capture.list()); syntax; I can't imagine the library was changed and nobody remembered to update the API.  That suggests there's something wonky going on with my Processing.

To give the complete background: I did a clean install of Processing-0125 a couple of days ago. Initially the code would hang on the Capture.list() call, so I reinstalled Quicktime. Now I'm getting the weird reference issue.

Ryan

[edit: Oh, I'm on a mac G4 running OS 10.4.10, Quicktime 7.2.]
Re: Capture.list() & Example Code
Reply #1 - Sep 3rd, 2007, 12:43am
 
Hi,

i've got the same issue with 125, but not with 124.



If you want to use a firewire DV camera with your mac you can follow this thread (Capture syntax compatible 125 only)

http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Video;action=display;num=1188556348

Just replace the String according to your camera:

Built-in iSight (Intel Mac)
Quote:
String myCam = "USB Video Class Video";


Firewire external iSight or miniDV Camera
Quote:
String myCam = "DV Video";


If you want to use 124, the myCam string must be written before the capture resolution values.

Processing 124
Quote:
video = new Capture(this, myCam, 640, 480, 25);


Processing 125
Quote:
video = new Capture(this, 640, 480, myCam, 25);


Wink
Re: Capture.list() & Example Code
Reply #2 - Sep 3rd, 2007, 1:17am
 
Thank you jaylfk, that gets me running with one camera at least.  Do you have any idea what happens when more than one DV device is connected?
Re: Capture.list() & Example Code
Reply #3 - Sep 3rd, 2007, 2:10am
 
I can't get my two FireWire Cameras to work at the same time (MiniDV and HDV), but can use the USB built-in iSight (macbook pro) and one of the two firewire Cameras with this code.

Quote:
import processing.video.*;  
 
Capture video;
Capture video2;
 
void setup() {  
 size(1280, 480, P3D);
 frameRate(25);
 
 // print(Capture.list());  
 
 String myCam = "USB Video Class Video";  
 // This is for the iSight but you can change  
 // the above string value to any available
 // capture device connected to your computer
 // shown in your Processing Console.
 
 String myCam2 = "DV Video";  
 
 video = new Capture(this, 640, 480, myCam, 25);  
 video2 = new Capture(this, 640, 480, myCam2, 25);
 // For speed purpose you can replace
 // 640 and 480 to any other resolution.
}

void captureEvent(Capture video){
 video.read();
}

void draw() {
background(0);
image(video,0,0,width/2,height);
image(video2,width/2,0,width/2,height);
}


[EDIT] Looks like we are not alone >> http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Video;action=display;num=1177987108;start=0#0
Re: Capture.list() & Example Code
Reply #4 - Sep 3rd, 2007, 2:14am
 
Huh. I was hoping to use my MiniDV camera and an external iSight, but I may have to make do with the iSight and a crappy USB webcam. Hmh. Thank you for the input anyway. Smiley
Re: Capture.list() & Example Code
Reply #5 - Sep 5th, 2007, 4:34pm
 
use println(Capture.list()) to see the list of names (this is why we use that in all the examples). Capture.list() returns a String[] array. the println() command is smart enough to print the individual elements of the array, but if you use println("cameras: " + Capture.list()), then you're treating the array as a reference, so the reference to the array is what's printed. just language semantics. print(Capture.list()) does the same thing, since it's not clear what calling print() on an array would do (just jam all the elements next to one another? put commas between them?)

you should be able to use multiple cameras of different types. if you can't, it's just quicktime not playing nice.

multiple cameras with the same name require that you use the settings() method to specify the second input. this is because apple's quicktime api selects capture devices by their name (not by index or some other method), so there's no way to specify identically named devices from code.
Page Index Toggle Pages: 1