Hi,
I've checked all the board about this question, i wasn't able to find any topic related to..
I try to send an ellipse (blob) coordinates with oscp5 but i can't find any information on how to...
here is the code i try to test :
Quote:import processing.video.*;
import oscP5.*;
OscP5 oscP5;
NetAddress myRemoteLocation;
Capture video;
float targetRed = 255.0; //set some numbers for the target you are chasing
float targetGreen = 0.0;
float targetBlue = 0.0;
void setup()
{
video = new Capture(this, 360, 288, 12);
size(360, 288);
oscP5 = new OscP5(this,57121);
myRemoteLocation = new NetAddress("127.0.0.1",57120);
}
void captureEvent(Capture camera)
{
camera.read();
}
void draw()
{
float worldRecord = 1000.0; //intialize the worldrecord
int xFound = 0; // initialize the location of the green tracking dot
int yFound = 0;
loadPixels();
for(int j=0; j < video.height; j=j+1) { //for each row
for(int i=0; i < video.width; i=i+1) { //for each column
//get the color of this pixels
//find pixel in linear array using formula: pos = row*rowWidth+column
color pix = video.pixels[j*video.width+i];
//find the difference
float diff = abs(targetRed - red(pix)) + abs(targetGreen - green(pix)) + abs(targetBlue - blue(pix));
if (diff< worldRecord){ // if this is closest to our target color
worldRecord = diff;
yFound = j; //mark the spot for drawing it later
xFound = i;
// println ("j="+j, "i="+i);
println ("i"+i);
}
}
}
image(video,0,0); //draw the video, this might be optional
//after all the pixels have been tested, draw the winner
fill(0,255,0);
ellipse(xFound, yFound, 10, 10);
// get(xFound, yFound);
// println(xFound, yFound);
}
void mousePressed() {
OscMessage myMessage = new OscMessage("/null");
myMessage.add(new int[] {yFound, xFound});
oscP5.send(myMessage, myRemoteLocation);
}
when i check with println, i can see the coordinates in the console.
I would like to know/learn how to send both "yFound" and "xFound" values to osc
e.g: sent together, separated with a coma.
Thx