We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpVideo Capture,  Movie Playback,  Vision Libraries › Communication between EyesWeb and Processing
Pages: 1 2 3 
Communication between EyesWeb and Processing (Read 6292 times)
Re: Communication between EyesWeb and Processing
Reply #30 - Sep 26th, 2005, 5:38pm
 
I've solved (at least to a preliminary extent) the threading issue with Manuel's implementation of Rune Andersen's eyesweb-p5 code.

I'll post a zip file with my changes in the near future, but I've got to run to class soon, so I'll just describe what I did here.

First, I downloaded the CubbyHole.java file from java.sun.com.  This is a simple synchronized data structure. I modified it to store Objects instead of ints.  

Then I modified Manuel's version of Rune's eyeswebsocket.java to have a private CubbyHole object, and put the received data into that CubbyHole after it is received. I also added a getCubbyHole() method to retrieve the cubbyhole object for use by the main part of the program.

Then I added the following code to my main Processing project file:

public class Javaserver3 extends PApplet {

eyeswebsocket myServer;
       private volatile Thread serverThread = null;
CubbyHole myQueue;
int[][] myMatrix;

void setup() {
size(800,600);
myServer = new eyeswebsocket(7777);
myQueue = myServer.getQueue();
myServer.Verbose=true; // No debug messages
myServer.blocking=false;  //change this to true to put it back the way it was
myServer.waitconn();

   
               if (serverThread == null) {
                  serverThread = new Thread(myServer, "Server1");
                  serverThread.start();
               }
}

void draw() {
println("frame!");
background(0);
fill(255,0,0);
myMatrix = (int[][]) myQueue.get();
rect(myMatrix[0][0],myMatrix[1][0],myMatrix[2][0],myMatrix[3][0]);
 }
}

You should be able to figure out the important parts, but basically this sets up the eyeswebserver, then waits for a connection. Once the connection is detected, it creates a new thread to handle the data recieve stuff.  The draw function just draws a rectangle (in this case, my input is a mocap entry converted to a matrix, so its the x, y, width, height of the rectangle).

I hope this proves helpful; as I said, I'll make a more generalized version and post it in an archive later tonight.

Ryan
Re: Communication between EyesWeb and Processing
Reply #31 - Sep 29th, 2005, 11:01pm
 
Hi there,

great that it works for you now, but actually the socketstuff is working good so far, it was a stupid mistake in the first place that it was blocking everything. The version that you can download on my site (basically it is exactly Runes with some few changes) is working.

I assume that the cubbyhole is being used for preventing that the data is not retrieved in total from the socket or what exactly is it doing?
Re: Communication between EyesWeb and Processing
Reply #32 - Sep 30th, 2005, 1:29pm
 
Haylp!

I've got a String being piped over to Processing using OSC working fine. Even upacking the String and everything is working hunky dory.

My issue is that I don't know the port or host settings for comms between two machines. I've got two nice and fast university PCs but no communication yet.

Code:

void initOsc() {
//I don't know how to set the next 3 properties
receiveAtPort = 12000;
sendToPort = 57120;
host = "127.0.0.1";
oscP5event = "oscEvent";
oscP5 = new OscP5(
this,
host,
sendToPort,
receiveAtPort,
oscP5event
);
}

My knowledge of networks and hardware is very limited I'm afraid. All I know is that I plug it into the wall - there's some houdoo - and then I get internet or I'm plugged into another machine. I generally have to rely on an I.T. friend for networking.

At the moment though I'm on my own. Any help?
Re: Communication between EyesWeb and Processing
Reply #33 - Sep 30th, 2005, 2:22pm
 
1st identify the IPs of the PROCESSING machine by doing START > Programs > Accessories > Command prompt  and enter "ipconfig /all" and hit Enter

Write down the IP of your network card (should be structured similar to 192.168.0.12)

Then enter this number in the EyesWeb OSCsend block. Furthermore pick a port that you want to send the data to( lets pick 12000 for now) enter this as the port.

In processing, use 12000 as "receiveAtPort" and 12001 as "sendToPort" (we will not use it).
As host you can leave 127.0.0.1 since this means localhost, and processing will be the host, eyesweb is a client.


First run Processing then Eyesweb. Should work Smiley
Re: Communication between EyesWeb and Processing
Reply #34 - Sep 30th, 2005, 5:04pm
 
Slightly different method to what I used. I went into Network Connections and set the IP of PC1 to 198.162.0.1 and set PC2 to 198.162.0.2

Then I set the host on PC1 to the IP of PC2 and vice versa.

I used the Command Prompt to send a ping to check everything was coolio.

It worked!

Then we plugged a DV camera into a capture card on the PC. We used the WDM input block (not the DV Camera) and waved different coloured stuff in front of the camera and watched it move circle markers around on the Processing PC.

A fantastic day.

I will modify this post on Monday evening to include a link to the files used so far. Our next step is to get a second camera input streaming out data from a perpendicular angle to camera two - 3D motion tracking! Will post findings.

Incidentally v3ga's blob tracking can reduce a silhouette to a continuous line. Unless you're already going down this route, it might be a way to reduce the data being sent.

http://www.v3ga.net/show.php?id=6&type=0

You could send an array composed of the points in the drawing routine.

Update:

http://www.robotacid.com/PBeta/motion
Re: Communication between EyesWeb and Processing
Reply #35 - Oct 7th, 2005, 2:05pm
 
3D Tracking!

Works with capture cards and web cams. Need to try multiple web cams though. Can't just yet because the drivers are at home. In all honesty it looks a bit crap and I have to reassign the object to be tracked on the screen. I haven't tried it in a large capture space yet or with higher resolution. Hopefully these bugs can be wormed out. I just need some kind of 3D package export now.

Credit due to v3ga and Ariel for the arcball on the GUI which still needs a bit of work though (my bugs, not theirs).
Re: Communication between EyesWeb and Processing
Reply #36 - Oct 15th, 2005, 9:48am
 
HAllo,
st33d
do you know if is possible have a silhouette to a continuous line or array of edge under eyesweb like with v3ga or Jmayron traking lib..

ciao

thetoad
Re: Communication between EyesWeb and Processing
Reply #37 - Oct 15th, 2005, 10:29am
 
Hi Toad,

I do this manually in Processing by checking in a 160*120 (bigger mostly not required) b/w picture that's output from Eyesweb containing the silhouette in black and the subtracted background in white.
I simply check which white pixel have a blck neighbour, these obviously sit on the border.
Works fine for me.
Re: Communication between EyesWeb and Processing
Reply #38 - Oct 15th, 2005, 1:57pm
 
Looks like I spoke too soon. I've translated v3ga's edge detection into Beta.

Edge Detection

But it doen't seem to adapt to the polygon detection you're looking for. I imagine you'd want to use some simple algorithm like this one:

Polygon test

Which would be looking for one polygon mass.
Re: Communication between EyesWeb and Processing
Reply #39 - Oct 15th, 2005, 11:22pm
 
i try to modify the edge detection code by v3ga and st33d port to beta...
for poligon drawing like in Jmyronn
but v3ga code is much faster...

i soon i have some improvment i let u know

thetoad
Re: Communication between EyesWeb and Processing
Reply #40 - Oct 19th, 2005, 10:04am
 
I have one idea but i dont have the skill to doit...(or to try)

what about to do a hack from eyesweb dll lib direct to processing using JNI (http://java.sun.com/j2se/1.4.2/docs/guide/jni/)

thetoad

Re: Communication between EyesWeb and Processing
Reply #41 - Dec 2nd, 2005, 2:36pm
 
I have added a feature in the blobDetection library which allows to draw blobs as polygons. I will release this add-on very very soon. ( see a screenshot at http://v3ga.net/blog/?p=11 )
Re: Communication between EyesWeb and Processing
Reply #42 - Jan 20th, 2006, 9:03am
 
hey, wanted to thank all of the eyesWeb guys for laying the groundwork for the 8-blobs tracking patch i built that sends the coordinates and the number of blobs to processing.

i posted the patch as well as the prototype sketch in my weblog:

http://www.sport4minus.de/blog/?p=46

feel free to use it... and please, if theres any eyesWeb "pro" reading this post, let me know if the patch makes sense "as is" or if theres a smarter way to do this...

greetings from berlin,
jens
http://www.sport4minus.de
Pages: 1 2 3