Spout + open cv

Hi, im trying to send this interactive code from open cv, to arkaos with spout. I dont know what im doing wrong, but i can´t make it works. Thanks for the help :slight_smile:

import gab.opencv.;
import processing.video.
;
import java.awt.;
import spout.
;

Capture webcam;
Movie video;
OpenCV opencv;
Spout spout;

PImage imageBN;//imagen threshold
PGraphics pgr;

int th=50;
ArrayList contours;
float cR = 100;
float cG = 255;
float cB = 100;

void setup () {
size(1024, 768,P2D);

webcam = new Capture(this, 1024, 768);
//video = new Movie(this, “street.mov”);
opencv= new OpenCV(this, 1024, 768);
webcam.start();
//video.play();
spout = new Spout(this);

spout.createSender(“Spout Processing”);

}

void draw () {

fill(0, 10);
rect(0, 0, width, height);//efecto cebolla
if (webcam.available()==true) {
webcam.read();
}

opencv.loadImage(webcam);
opencv.gray();
opencv.threshold(th);
imageBN = opencv.getOutput();
contours = opencv.findContours();
spout.sendTexture();

//+++++++++±---------------------image(webcam, 0, 0,640,480 );
//image(imageBN, 0, 0, 0, 0);
if (frameCount 50 == 0) { // =modulo
cR = random(0, 255);
cG = random(0, 255);
cB = random(0, 255);
}
for (int i=0; i<contours.size(); i=i+1) {
Contour c= contours.get(i);
fill(cR, cG, cB, 50);
stroke(100, 255, 100);
c.draw();
Rectangle r = c.getBoundingBox();
noFill();
stroke(255-cR, 255-cG, 255-cB);
if (r.width > 100) {
rect(r.x+200, r.y+200, r.width, r.height);
stroke(255, 128, 0);
ellipse(r.x+r.width/2, r.y+r.height/2, 10, 10);
}
}

fill(random(0, 255), random(0, 255), random(0, 255), 50);
text(“th:”+th, 20, 500);

//void captureEvent(Capture c) {
//c.read();
}

void keyPressed() {
if (key == ‘+’) {
cR = random(0, 255);
cG = random(0, 255);
cB = random(0, 255);
}
if (key == ‘+’) {
th++;
}

if (key == ‘-’) {
th–;
}

}