im a beginner in programmation. So here's my code. When I do my print, it prints, for example, (pos1 180 pos2 0 posmoyenne 90). The issue is pos2 outputs 0. But, in the code where the message is sent, there's a value. Here are my two codes that communicate together.
import hypermedia.video.*;
import java.awt.*;
import oscP5.*;
import netP5.*;
OscP5 oscP5;
NetAddress remote;
OpenCV opencv;
int w = 320;
int h = 240;
int threshold = 0; //Ajuster automatiquement le threshold
int hauteur1;
int hauteur2;
PFont font;
void setup() {
boolean find=true;
/* start oscP5, listening for incoming messages at port 12000 */
oscP5 = new OscP5(this,"127.0.0.1",6000);
/* myRemoteLocation is a NetAddress. a NetAddress takes 2 parameters,
* an ip address and a port number. myRemoteLocation is used as parameter in
* oscP5.send() when sending osc packets to another computer, device,
* application. usage see below. for testing purposes the listening port
* and the port of the remote location address are the same, hence you will
* send messages back to this sketch.
*/
//myRemoteLocation = new NetAddress("127.0.0.1",12000);
size( w*2+30, h*2+30 );
opencv = new OpenCV( this );
opencv.capture(w, h);
font = loadFont( "AndaleMono.vlw" );
textFont( font );
println( "Drag mouse inside sketch window to change threshold" );
println( "Press space bar to record background image" );
I have been coding all day and seriously, I can't think anymore.. My brain has exploded many many times. I am relatively new to processing so forgive me for my newbie-ness. And I'm french too so I'm also sorry for my english.
Ok here's my poject. I'm using OpenCV for blob detection and well, everythings working really fine. I'm using OSC to pass the Y position of the blob to another computer which passes it to an ellipse. The goal is to detect the jump motion of a human and use his Y position to create a game. The problem is, I need to do a lot of configurations to set up the ellipse movement so it's fluid and working.
I want to evaluate the last position of the ellipse so I can determine if the ellipse is ascending or descending. Should I use an array to store the Y positions and use a for ? Is it possible to check the value of the Y position at the last frame so if posY=posYLastFrame || posY<posYLastFrame, i know the object is descending? (which would be much easier and less head-bashing)
Thank you very much for your help and if you don't understand my problem I'll be glad to re-explain it! thank you!