# Spout + open cv

**URL:** https://discourse.processing.org/t/spout-open-cv/25353
**Category:** Libraries
**Created:** [November 11, 2020, 7:31pm UTC](https://discourse.processing.org/t/spout-open-cv/25353 "2020-11-11T19:31:49Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Heidacraft](https://avatars.discourse-cdn.com/v4/letter/h/d9b06d/32.png) [@Heidacraft](https://discourse.processing.org/u/Heidacraft)
#### Post date: [November 11, 2020, 7:31pm UTC](https://discourse.processing.org/t/spout-open-cv/25353/1 "2020-11-11T19:31:49Z")

</div>

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 🙂

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](https://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](https://c.read)();  
}

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

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

}
