Hey there.
I've been trying to get faceAPI&Processing working via 6dofstreamer.
The program acquires the String stream sent by 6dofstreamer and parses it into separate fields so i can simply move around a rect via face tracking.
The problem is im getting "ArrayIndexOutOfBoundsException: 1" on line
Code:float secondNumber = Float.parseFloat(nums[1]);
it throws the exception time to time not always. I guess its a problem with the str stream i get.
Should i put the lines dealing with acquiring&parsing data into a try&catch block? Would that solve the problem? And most importantly how ?
Heres the code:
Code:
// Example by Tom Igoe
import processing.net.*;
Client myClient;
String inString;
void setup() {
size (500, 500);
// This example will not run if you haven't
// previously started a server on this port
myClient = new Client(this, "127.0.0.1", 29129);
}
void draw() {
if (myClient.available() > 0) {
background(0);
inString = myClient.readString();
String[] nums = split(inString, ' ');
float firstNumber = Float.parseFloat(nums[0]);
float secondNumber = Float.parseFloat(nums[1]);
println(firstNumber);
println(secondNumber);
rect(firstNumber*-10,secondNumber*-10,20,20);
}
}
My second question is: Is it possible to get multiple streams from a web cam?
Since faceAPI uses the web cam im not able to use it from processing as well. Thus i cant merge the real image with, say, a horse face!
Thx in advance.