We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello
I'm new here, I am compositor artist/tool developer for Nuke and Maya. I work in Berlin and I'm discovering the fascinating world of real time and interaction withs images :D
I'm trying control my processing sketch with Pure Data. It works very well with floats, but if I want to receive a string or a int, it doesn't work and display this error :
to a method in your program. please check your code for any possible errors that might occur in the method where incoming OscMessages are parsed e.g. check for casting errors, possible nullpointers, array overflows ... . method in charge : oscEvent java.lang.reflect.InvocationTargetException
The weird thing is that even if I receive float, if I received for example 1.0, I get this errors. Did you ever seen something like that ?
this is my code : of course, when I try to receive int or string, I change the oscEvent function :)
import processing.video.*;
import oscP5.*;
import netP5.*;
OscP5 oscP5;
Capture cam;
FloatDict param;
float c;
float bright;
float display;
PImage camImage;
void setup() {
oscP5 = new OscP5(this, 9999);
size(640, 480);
cam = new Capture(this, 640, 480, 30);
cam.start();
param = new FloatDict();
// set default
param.set("keyer1", 0);
param.set("keyer2", 1);
param.set("keyer3", 1);
param.set("keyer4", 1);
param.set("display", 0.5);
param.set("blur", 0);
}
void draw() {
if (cam.available()) {
cam.read();
}
// println(display);
println(param.get("display"));
if (param.get("display") < 1) {
image(cam, 0, 0);
}
if (param.get("display") > 1) {
println("looool");
PImage keyer;
keyer = cam;
camImage = cam;
keyer = keyerProcess(camImage);
image(keyer, 0, 0);
}
}
PImage keyerProcess(PImage source) {
PImage dest = source;
for (int x = 0; x < cam.width; x++) {
for (int y = 0; y < cam.height; y++ ) {
int loc = x + y*cam.width;
bright = brightness(source.pixels[loc])/255;
if (bright < param.get("keyer1")) {
dest.pixels[loc] = color(0);
}
if (bright > param.get("keyer1" ) && (bright < param.get("keyer2" ))) {
c = ((param.get("keyer2" )-param.get("keyer1" ))*bright+(param.get("keyer1" )));
c = c*255;
dest.pixels[loc] = color(c);
}
if (bright > param.get("keyer2" ) && (bright < param.get("keyer3" ))) {
dest.pixels[loc] = color(255);
}
if (bright > param.get("keyer3" ) && (bright < param.get("keyer4" ))) {
c = ((param.get("keyer4" )-param.get("keyer3" ))*bright+(param.get("keyer2" )));
c = c*255;
dest.pixels[loc] = color(c);
}
if (bright > param.get("keyer4")) {
dest.pixels[loc] = color(0);
}
}
}
return dest;
}
void oscEvent(OscMessage theOscMessage) {
String Key = (theOscMessage.addrPattern());
println(Key);
if (Key == "display") {
float value = (theOscMessage.get(0).floatValue());
param.set(Key, value);
} else {
float value = (theOscMessage.get(0).floatValue());
param.set(Key, value);
println(param.get(Key));
}
}