<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>Tagged with #kinect - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=%23kinect</link>
      <pubDate>Sun, 08 Aug 2021 20:46:31 +0000</pubDate>
         <description>Tagged with #kinect - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/tagged%23kinect/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>New TV/Music project - where's a good place to find talent?</title>
      <link>https://forum.processing.org/two/discussion/19328/new-tv-music-project-where-s-a-good-place-to-find-talent</link>
      <pubDate>Sun, 27 Nov 2016 11:58:22 +0000</pubDate>
      <dc:creator>tommcdonnell</dc:creator>
      <guid isPermaLink="false">19328@/two/discussions</guid>
      <description><![CDATA[<p>Hello all. I'm looking for someone to help with a really exciting Processing project in music, using Kinect to generate visuals as part of a live TV production. Is anyone able to advise where a good place to find expertise - both visual and development? Ideally UK/London based but the project is destined for Spain, so we can be flexible on location.</p>
]]></description>
   </item>
   <item>
      <title>Anyone been able to install Processing 2.1 and import SimpleOpenNi library on RPi3?</title>
      <link>https://forum.processing.org/two/discussion/18209/anyone-been-able-to-install-processing-2-1-and-import-simpleopenni-library-on-rpi3</link>
      <pubDate>Mon, 19 Sep 2016 04:14:11 +0000</pubDate>
      <dc:creator>esreyna95</dc:creator>
      <guid isPermaLink="false">18209@/two/discussions</guid>
      <description><![CDATA[<p>So I have been trying to install Processing 2.2.1 on the Raspberry Pi 3 Model B since it was the last version to support the most powerful (used to be open-sourced) libraries for the Kinect. I currently have the Processing 2.1 installed on my Mac and the simpleOpenNi libraries. I now want to see if the RPi3 can as well. I've been seeing that some people on this forum that have Processing 2 installed already on their RPi2 so I was wondering if someone could give me some detailed steps on how to build it as I receive errors after trying to run it:</p>

<pre><code>    ...java/bin/java: "weird ASCII characters here" not found
    /home/pi/Desktop/processing-2.2.1/java/bin/java: 2: /home/pi/Desktop/processing-2.2.1/java/bin/java: Syntax error: "(" unexpected
</code></pre>

<p>As for the SimpleOpenNi, any direction on building it would be greatly appreciated as I get errors:</p>

<pre><code>    /Installing OpenNI
    *********************************

    copying shared libraries...OK
    copying executables...OK
    copying include files...OK
    creating database directory...OK
    registering module 'libnimMockNodes.so' .../usr/bin/niReg: 1: /usr/bin/niReg: Syntax error: word unexpected (expecting ")")
</code></pre>
]]></description>
   </item>
   <item>
      <title>«Non-Finito» generative sculpture</title>
      <link>https://forum.processing.org/two/discussion/17122/non-finito-generative-sculpture</link>
      <pubDate>Mon, 13 Jun 2016 10:37:21 +0000</pubDate>
      <dc:creator>alexr4</dc:creator>
      <guid isPermaLink="false">17122@/two/discussions</guid>
      <description><![CDATA[<p>Hi everyone.</p>

<p>I would like to share with you our last piece "Non-Finito", an interactive installation creating a 3D marble sculpture from users who enter into a kinect field of view.  We use the kinect v2 library and GLSL Shader for materials and generative marble texture.</p>

<p>We hope you wil like it.</p>

<p>Non-Finito :
<a rel="nofollow" href="http://www.bonjour-lab.com/project/non-finito/">http://www.bonjour-lab.com/project/non-finito/</a></p>

<p>You wan also see some making of still here : <a rel="nofollow" href="https://www.flickr.com/photos/alexr4/sets/72157666351804994">https://www.flickr.com/photos/alexr4/sets/72157666351804994</a></p>

<p><img src="http://www.bonjour-lab.com/wp-content/uploads/2016/06/06_non_finito.jpg" alt="" /></p>
]]></description>
   </item>
   <item>
      <title>Interactive Island Networks</title>
      <link>https://forum.processing.org/two/discussion/15548/interactive-island-networks</link>
      <pubDate>Thu, 17 Mar 2016 22:48:32 +0000</pubDate>
      <dc:creator>Attarr</dc:creator>
      <guid isPermaLink="false">15548@/two/discussions</guid>
      <description><![CDATA[<p>This is my final year project so I have been spending some time on it, both researching and developing it. It uses a kinect to track the positions of the islands through tsps and then various processing rules to determine if, when and where the boats go.</p>

<p>check out more here <a href="http://simonsloan.com/logistic" target="_blank" rel="nofollow">http://simonsloan.com/logistic</a></p>

<p><img src="https://mir-s3-cdn-cf.behance.net/project_modules/max_1200/661e7435141171.56eb26354b667.jpg" alt="" /></p>

<p><img src="https://mir-s3-cdn-cf.behance.net/project_modules/max_1200/4b642935141171.56eb26354d1fd.jpg" alt="" /></p>

<p><img src="https://mir-s3-cdn-cf.behance.net/project_modules/max_1200/b0556a35141171.56eb26354d86e.jpg" alt="" /></p>

<p>check out more here <a href="http://simonsloan.com/logistic" target="_blank" rel="nofollow">http://simonsloan.com/logistic</a></p>
]]></description>
   </item>
   <item>
      <title>changing polygon class into shapes</title>
      <link>https://forum.processing.org/two/discussion/14443/changing-polygon-class-into-shapes</link>
      <pubDate>Wed, 13 Jan 2016 23:25:16 +0000</pubDate>
      <dc:creator>mistah_jay</dc:creator>
      <guid isPermaLink="false">14443@/two/discussions</guid>
      <description><![CDATA[<p>hey guys,
I just started coding in processing and want to know if it is it possible to change a code i found. The code I want to use is the CAN kinect physics code. <a href="https://dl.dropboxusercontent.com/u/94122292/CANKinectPhysics.zip" target="_blank" rel="nofollow">https://dl.dropboxusercontent.com/u/94122292/CANKinectPhysics.zip</a>.</p>

<p>It uses the custom shapes class to create different shapes. would it be possible to change the code in such a way that i can change te shapes into images, i.e leaves or snow flakes? and if so, would anyone be so kind to help me in the right direction?</p>

<p>This is the CustomShape class that creates a shape and interacts with the shape of my body.</p>

<pre><code>import java.util.List;
import java.util.Arrays;

class CustomShape {
  // to hold the box2d body
  Body body;
  // to hold the Toxiclibs polygon shape
  Polygon2D toxiPoly;
  // custom color for each shape
  color col;
  // radius (also used to distinguish between circles and polygons in this combi-class
  float r;

  CustomShape(float x, float y, float r, BodyType type) {
    this.r = r;
    // create a body (polygon or circle based on the r)
    makeBody(x, y, type);
    // get a random color
    col = getRandomColor();
  }

  void makeBody(float x, float y, BodyType type) 
  {
    // define a dynamic body positioned at xy in box2d world coordinates,
    // create it and set the initial values for this box2d body's speed and angle
    BodyDef bd = new BodyDef();
    bd.type = type;
    bd.position.set(box2d.coordPixelsToWorld(new Vec2(x, y)));
    body = box2d.createBody(bd);
    body.setLinearVelocity(new Vec2(random(-8, 8), random(2, 8)));
    body.setAngularVelocity(random(-5, 5));

    // box2d polygon shape
    //PolygonShape sd = new PolygonShape();
    /* toxiPoly = new Polygon2D(Arrays.asList(new Vec2D(-r, r*1.5), 
     new Vec2D(r, r*1.5), 
     new Vec2D(r, -r*1.5), 
     new Vec2D(-r, -r*1.5)));*/

    if (r == -1) 
    {
      // box2d polygon shape
      PolygonShape sd = new PolygonShape();
      // toxiclibs polygon creator (triangle, square, etc)
      toxiPoly = new Circle(random(5, 20)).toPolygon2D(int(random(3, 6)));
      // place the toxiclibs polygon's vertices into a vec2d array
      Vec2[] vertices = new Vec2[toxiPoly.getNumPoints()];

      for (int i=0; i&lt;vertices.length; i++) 
      {
        Vec2D v = toxiPoly.vertices.get(i);
        vertices[i] = box2d.vectorPixelsToWorld(new Vec2(v.x, v.y));
      }
      // put the vertices into the box2d shape
      sd.set(vertices, vertices.length);
      // create the fixture from the shape (deflect things based on the actual polygon shape)
      body.createFixture(sd, 1);
    }

    else 
    {
      // box2d circle shape of radius r
      CircleShape cs = new CircleShape();
      cs.m_radius = box2d.scalarPixelsToWorld(r);
      // tweak the circle's fixture def a little bit
      FixtureDef fd = new FixtureDef();
      fd.shape = cs;
      fd.density = 1;
      fd.friction = 0.01;
      fd.restitution = 0.3;
      // create the fixture from the shape's fixture def (deflect things based on the actual circle shape)
      body.createFixture(fd);
    }
  }




  // method to loosely move shapes outside a person's polygon
  // (alternatively you could allow or remove shapes inside a person's polygon)
  void update() 
  {
    // get the screen position from this shape (circle of polygon)
    Vec2 posScreen = box2d.getBodyPixelCoord(body);
    // turn it into a toxiclibs Vec2D
    Vec2D toxiScreen = new Vec2D(posScreen.x, posScreen.y);
    // check if this shape's position is inside the person's polygon
    boolean inBody = poly.containsPoint(toxiScreen);
    // if a shape is inside the person
    if (inBody) {
      // find the closest point on the polygon to the current position
      Vec2D closestPoint = toxiScreen;
      float closestDistance = 9999999;
      for (Vec2D v : poly.vertices) 
      {
        float distance = v.distanceTo(toxiScreen);
        if (distance &lt; closestDistance) 
        {
          closestDistance = distance;
          closestPoint = v;
        }
      }
      // create a box2d position from the closest point on the polygon
      Vec2 contourPos = new Vec2(closestPoint.x, closestPoint.y);
      Vec2 posWorld = box2d.coordPixelsToWorld(contourPos);
      float angle = body.getAngle();
      // set the box2d body's position of this CustomShape to the new position (use the current angle)
      body.setTransform(posWorld, angle);
    }
  }

  // display the customShape
  void display() {
    // get the pixel coordinates of the body
    Vec2 pos = box2d.getBodyPixelCoord(body);
    pushMatrix();
    // translate to the position
    translate(pos.x, pos.y);
    noStroke();
    // use the shape's custom color
    fill(col);

    if (r == -1) {
      // rotate by the body's angle
      float a = body.getAngle();
      rotate(-a); // minus!
      gfx.polygon2D(toxiPoly);
    } 
    else {
      ellipse(0, 0, r*2, r*2);
    }

    popMatrix();
  }

  // if the shape moves off-screen, destroy the box2d body (important!)
  // and return true (which will lead to the removal of this CustomShape object)
  boolean done() {
    Vec2 posScreen = box2d.getBodyPixelCoord(body);
    boolean offscreen = posScreen.y &gt; height;
    if (offscreen) {
      box2d.destroyBody(body);
      return true;
    }
    return false;
  }
}
</code></pre>

<p>EOF</p>

<p>Thanks in advance</p>
]]></description>
   </item>
   <item>
      <title>Kinect Pointclouds for 3d shader or Mesh?</title>
      <link>https://forum.processing.org/two/discussion/8619/kinect-pointclouds-for-3d-shader-or-mesh</link>
      <pubDate>Fri, 12 Dec 2014 12:32:10 +0000</pubDate>
      <dc:creator>DaimonW</dc:creator>
      <guid isPermaLink="false">8619@/two/discussions</guid>
      <description><![CDATA[<p>Hi everyone.
I would like use the pointclouds from kinect for link them as mesh, or particular, or other fluid simulation.
What is the best way about generate it in real-time and easy to do? GLS shaders or some library as _he_mesh, toxilibs?
I do not know programming gls shaders and could help me some editor and after export the code. One exists ?</p>

<p>I can't find a way.
Thanx!!</p>
]]></description>
   </item>
   <item>
      <title>Jop opportunity</title>
      <link>https://forum.processing.org/two/discussion/13188/jop-opportunity</link>
      <pubDate>Thu, 22 Oct 2015 21:20:08 +0000</pubDate>
      <dc:creator>kukomultimedia</dc:creator>
      <guid isPermaLink="false">13188@/two/discussions</guid>
      <description><![CDATA[<p>Hello, I got an offer from a BMW dealership in New Jersey,  United States, to have bmw logos falling down the screen for people to play with it. I got the kinect 360 and processing 3 the only library that I have is kinect from shiffman. I am stocked trying to get the skeleton library my commission is around $700 i'll split it in half to someone who can help me to set up the code.</p>
]]></description>
   </item>
   <item>
      <title>How to change the range of PWM value</title>
      <link>https://forum.processing.org/two/discussion/12642/how-to-change-the-range-of-pwm-value</link>
      <pubDate>Tue, 22 Sep 2015 16:20:00 +0000</pubDate>
      <dc:creator>ahmadtaufiq</dc:creator>
      <guid isPermaLink="false">12642@/two/discussions</guid>
      <description><![CDATA[<p>Hello there! I'm doing some project using kinect + processing + arduino. Fyi I am so so new with this software. Here i have code that control the brightness of led using hand movement that i get from internet. But the problem is i don understand where to initialize the first value in frame that construct by processing?</p>

<p>import processing.serial.*;
import java.util.Map;
import java.util.Iterator;
import SimpleOpenNI.*;
import processing.serial.*;
SimpleOpenNI context;
Serial myPort;</p>

<p>int handVecListSize = 20;
Map&lt;Integer,ArrayList&gt;  handPathList = new HashMap&lt;Integer,ArrayList&gt;();
color[]       userClr = new color[]{ color(255,0,0),
                                     color(0,255,0),
                                     color(0,0,255),
                                     color(255,255,0),
                                     color(255,0,255),
                                     color(0,255,255)
                                   };</p>

<p>void setup()
{
//  frameRate(200);
  size(640,480);
  context = new SimpleOpenNI(this);</p>

<p>if(context.isInit() == false)
  {
     println("Can't init SimpleOpenNI, maybe the camera is not connected!"); 
     exit();
     return;<br />
  }</p>

<p>// enable depthMap generation 
  context.enableDepth();</p>

<p>// disable mirror
  context.setMirror(true);</p>

<p>// enable hands + gesture generation
  //context.enableGesture();
  context.enableHand();
  context.startGesture(SimpleOpenNI.GESTURE_WAVE);
  String portName = Serial.list()[0]; // This gets the first port on your computer.
  myPort = new Serial(this, portName, 9600);</p>

<p>// set how smooth the hand capturing should be
  //context.setSmoothingHands(.5);
 }</p>

<p>void draw()
{
  // update the cam
  context.update();</p>

<p>image(context.depthImage(),0,0);</p>

<p>// draw the tracked hands
  if(handPathList.size() &gt; 0)<br />
  {<br />
    Iterator itr = handPathList.entrySet().iterator();<br />
    while(itr.hasNext())
    {
      Map.Entry mapEntry = (Map.Entry)itr.next(); 
      int handId =  (Integer)mapEntry.getKey();
      ArrayList vecList = (ArrayList)mapEntry.getValue();
      PVector p;
      PVector p2d = new PVector();</p>

<pre><code>    stroke(userClr[ (handId - 1) % userClr.length ]);
    noFill(); 
    strokeWeight(1);        
    Iterator itrVec = vecList.iterator(); 
    beginShape();
      while( itrVec.hasNext() ) 
      { 
        p = (PVector) itrVec.next(); 

        context.convertRealWorldToProjective(p,p2d);
        vertex(p2d.x,p2d.y);
      }
    endShape();   

    stroke(userClr[ (handId - 1) % userClr.length ]);
    strokeWeight(4);
    p = vecList.get(0);
    context.convertRealWorldToProjective(p,p2d);
    point(p2d.x,p2d.y);

      myPort.write('S');
</code></pre>

<p>// Send the value of the mouse's x-position
  myPort.write(int(255*  p2d .x/width));
  // Send the value of the mouse's y-position
  myPort.write(int(255*  p2d.y/height));</p>

<pre><code>}        
</code></pre>

<p>}
}</p>

<p>// -----------------------------------------------------------------
// hand events</p>

<p>void onNewHand(SimpleOpenNI curContext,int handId,PVector pos)
{
  println("onNewHand - handId: " + handId + ", pos: " + pos);</p>

<p>ArrayList vecList = new ArrayList();
  vecList.add(pos);</p>

<p>handPathList.put(handId,vecList);
}</p>

<p>void onTrackedHand(SimpleOpenNI curContext,int handId,PVector pos)
{
  //println("onTrackedHand - handId: " + handId + ", pos: " + pos );</p>

<p>ArrayList vecList = handPathList.get(handId);
  if(vecList != null)
  {
    vecList.add(0,pos);
    if(vecList.size() &gt;= handVecListSize)
      // remove the last point 
      vecList.remove(vecList.size()-1); 
  }<br />
}</p>

<p>void onLostHand(SimpleOpenNI curContext,int handId)
{
  println("onLostHand - handId: " + handId);
  handPathList.remove(handId);
}</p>

<p>// -----------------------------------------------------------------
// gesture events</p>

<p>void onCompletedGesture(SimpleOpenNI curContext,int gestureType, PVector pos)
{
  println("onCompletedGesture - gestureType: " + gestureType + ", pos: " + pos);</p>

<p>int handId = context.startTrackingHand(pos);
  println("hand stracked: " + handId);
}</p>

<p>// -----------------------------------------------------------------
// Keyboard event
void keyPressed()
{</p>

<p>switch(key)
  {
  case ' ':
    context.setMirror(!context.mirror());
    break;
  case '1':
    context.setMirror(true);
    break;
  case '2':
    context.setMirror(false);
    break;
  }
}</p>

<p>void onRecognizeGesture(String strGesture, PVector idPosition, PVector endPosition)
{
// SimpleOpenNI.GESTURE_HAND_RAISE
//endPosition
  context.endGesture(SimpleOpenNI.GESTURE_HAND_RAISE );
  context.startTrackingHand(endPosition);
//  context.startGesture(SimpleOpenNI.GESTURE_WAVE);
}</p>
]]></description>
   </item>
   <item>
      <title>Stravinsky's INFERNAL DANCE, using Processing and a Kinect</title>
      <link>https://forum.processing.org/two/discussion/12628/stravinsky-s-infernal-dance-using-processing-and-a-kinect</link>
      <pubDate>Tue, 22 Sep 2015 00:52:51 +0000</pubDate>
      <dc:creator>carcaju</dc:creator>
      <guid isPermaLink="false">12628@/two/discussions</guid>
      <description><![CDATA[<p><a rel="nofollow" href="http://www.mathieuplasse.com/danseinfernale/"><strong>mathieuplasse.com/danseinfernale</strong></a></p>

<p>Here's a video I made to animate Stravinsky's Infernal dance, from "The Firebird".</p>

<p>I developed the project with the help of two dancers in a studio, here in Quebec city. I've been working with Processing for some time now, but this is the first time I work with the Kinect and with pro dancers.</p>

<p>Hope you enjoy how it came out. Comments are welcome.</p>
]]></description>
   </item>
   <item>
      <title>Problems with java using jmcvideo library: constructor error</title>
      <link>https://forum.processing.org/two/discussion/12392/problems-with-java-using-jmcvideo-library-constructor-error</link>
      <pubDate>Fri, 04 Sep 2015 00:08:14 +0000</pubDate>
      <dc:creator>wbandel</dc:creator>
      <guid isPermaLink="false">12392@/two/discussions</guid>
      <description><![CDATA[<p>I am creating a sketch using the kinect with the simpleopenni library and jmcvideo library to do video scrubbing. I found a basic example and edited it to work with the kinect. Everything worked fine on my Mac, but now that I am trying to move everything over to a PC I can't get the libraries to work right. I finally got java to work on the PC using the library, but I am now getting an error that reads "The constructor JMCMovie(videojumpkinect, String, int) is undefined and it hightlights "return new JMCMovie(this, filename, RGB);" and I can not figure out why it doesn't like that part of the code because it worked fine on my Mac.</p>

<p>I tried using other libraries, such as the default video library and a sketch I found for that, which didn't work. And then the gsvideo library, which gave me no errors, but only showed a black screen (the background). I'd prefer to use this library, because I know it at least works on Macs. Any help would be greatly appreciated as my knowledge of code is very limited.</p>

<pre lang="javascript">
import SimpleOpenNI.*;
SimpleOpenNI kinect;

import jmcvideo.*;
import processing.opengl.*;
JMCMovie myMovie;
double movieDuration;
float ratio =0.0;
float old_mouse_pos = 0;

void setup() {
  kinect = new SimpleOpenNI(this);
  kinect.enableDepth();
  kinect.enableUser();

  size(640, 480, P2D);
  //size(640,480,P2D);
  //background(0);
  // stroke(255, 0, 0);
  //strokeWeight(5);
  //textSize(20);

  myMovie = movieFromDataPath("drop.mov");

  myMovie.pause();

  movieDuration = myMovie.getDuration();
}

JMCMovie movieFromDataPath(String filename)
{
  return new JMCMovie(this, filename, RGB);
}

void draw()
{
  kinect.update();

  PImage depthImage =kinect.depthImage();
 // image(depthImage, 640, 0);

  IntVector userList = new IntVector();
  kinect.getUsers(userList);

  if (userList.size()&gt;0) {
    int userId = userList.get(0);

    if (kinect.isTrackingSkeleton(userId)) {
      PVector leftHand = new PVector();
      //  PVector rightHand = new PVector();

      kinect.getJointPositionSkeleton(userId, SimpleOpenNI.SKEL_LEFT_HAND, leftHand);

      //  kinect.getJointPositionSkeleton(userId, SimpleOpenNI.SKEL_RIGHT_HAND, rightHand);

      // println(leftHand.y, rightHand.y);

      image(myMovie, 0, 0, 640, 480);
      //  image(myMovie, 0, 0, myMovie.width, myMovie.height);
      if (old_mouse_pos !=leftHand.y) {
        ratio=(float)(height+leftHand.y)/(2*height);
        myMovie.setCurrentTime((1-ratio)*movieDuration);
      }
      old_mouse_pos=leftHand.y;
    }
  }
  if (userList.size()</pre>
]]></description>
   </item>
   <item>
      <title>How to Attach two more Servo motors to Kinect Skeleton?</title>
      <link>https://forum.processing.org/two/discussion/11977/how-to-attach-two-more-servo-motors-to-kinect-skeleton</link>
      <pubDate>Wed, 05 Aug 2015 09:26:11 +0000</pubDate>
      <dc:creator>yoryeline</dc:creator>
      <guid isPermaLink="false">11977@/two/discussions</guid>
      <description><![CDATA[<p>Hi! I am trying to solve this little problem with an example from the book "Making things see" where with the use of Kinect Processing and Arduino you can control two servo motors by moving your left arm. The kinect through the Skeleton App reads the movement of the joints on your arm. It works perfectly with one side but now I would like to add the right arm with other two servo motors. There is definitely something that I am not understanding because I have tried copying the code and replacing it with for example "SimpleOpenNI.SKEL_LEFT_ELBOW, SimpleOpenNI.SKEL_LEFT_HAND, SimpleOpenNI.SKEL_LEFT_SHOULDER" and so on and nothing changes. It might not be as easy as I thought. I am struggling with this that's why I decided to ask it here to see if someone could help me with a hint.</p>

<p>Here I post the Processing code and after the Arduino code.</p>

<p>Thanks in advance for your help!</p>

<pre><code>import SimpleOpenNI.*;
SimpleOpenNI  kinect;
  import processing.serial.*;
     Serial port;

void setup() { 
  size(640, 480);
  kinect = new SimpleOpenNI(this);
  kinect.enableDepth();
  kinect.enableUser(SimpleOpenNI.SKEL_PROFILE_ALL);
  kinect.setMirror(true);
   println(Serial.list());
     String portName = Serial.list()[8];
     port = new Serial(this, portName, 9600);
}
void draw() {
  kinect.update();
  PImage depth = kinect.depthImage();
  image(depth, 0, 0);
  IntVector userList = new IntVector();
  kinect.getUsers(userList);
  if (userList.size() &gt; 0) {
    int userId = userList.get(0);
    if ( kinect.isTrackingSkeleton(userId)) {
      // get the positions of the three joints of our arm
      PVector rightHand = new PVector();
      kinect.getJointPositionSkeleton(userId,
                                      SimpleOpenNI.SKEL_RIGHT_HAND,
                                      rightHand);
      PVector rightElbow = new PVector();
      kinect.getJointPositionSkeleton(userId,
                                      SimpleOpenNI.SKEL_RIGHT_ELBOW,
                                      rightElbow);
      PVector rightShoulder = new PVector();
      kinect.getJointPositionSkeleton(userId,
                                      SimpleOpenNI.SKEL_RIGHT_SHOULDER,
                                      rightShoulder);
      // we need right hip to orient the shoulder angle
      PVector rightHip = new PVector();
      kinect.getJointPositionSkeleton(userId,
                                      SimpleOpenNI.SKEL_RIGHT_HIP,
                                      rightHip);
// reduce our joint vectors to two dimensions
PVector rightHand2D = new PVector(rightHand.x, rightHand.y); 
PVector rightElbow2D = new PVector(rightElbow.x, rightElbow.y);
PVector rightShoulder2D = new PVector(rightShoulder.x,
                                            rightShoulder.y);
      PVector rightHip2D = new PVector(rightHip.x, rightHip.y);
      // calculate the axes against which we want to measure our angles
      PVector torsoOrientation =
PVector.sub(rightShoulder2D, rightHip2D); 
PVector upperArmOrientation =
        PVector.sub(rightElbow2D, rightShoulder2D);

        // calculate the angles between our joints
float shoulderAngle = angleOf(rightElbow2D, 
                                        rightShoulder2D,
                                        torsoOrientation);
          float elbowAngle    = angleOf(rightHand2D,
                                        rightElbow2D,
                                        upperArmOrientation);
          // show the angles on the screen for debugging
          fill(255,0,0);
          scale(3);
          text("shoulder: " + int(shoulderAngle) + "\n" +
                " elbow: " + int(elbowAngle), 20, 20);
     byte out[] = new byte[2];
     out[0] = byte(shoulderAngle);
     out[1] = byte(elbowAngle);
     port.write(out);
        }

} }
    float angleOf(PVector one, PVector two, PVector axis) {
      PVector limb = PVector.sub(two, one);
      return degrees(PVector.angleBetween(limb, axis));
}
    // user-tracking callbacks!
    void onNewUser(int userId) {
      println("start pose detection");
      kinect.startPoseDetection("Psi", userId);
    }
    void onEndCalibration(int userId, boolean successful) {
      if (successful) {
        println("  User calibrated !!!");
        kinect.startTrackingSkeleton(userId);
      }
      else {
        println("  Failed to calibrate user !!!");
        kinect.startPoseDetection("Psi", userId);
} }
    void onStartPose(String pose, int userId) {
      println("Started pose for user");
      kinect.stopPoseDetection(userId);
      kinect.requestCalibrationSkeleton(userId, true);
}
</code></pre>

<p>Arduino code</p>

<pre><code>#include &lt;Servo.h&gt; 
// declare both servos
Servo shoulder;
Servo elbow;

// setup the array of servo positions 
int nextServo = 0;
int servoAngles[] = {0,0};

void setup() {
// attach servos to their pins 

shoulder.attach(9); 
elbow.attach(10); 
Serial.begin(9600);
}
void loop() { 
  if(Serial.available()){ 

    int servoAngle = Serial.read();
    servoAngles[nextServo] = servoAngle;
    nextServo++;
        if(nextServo &gt; 1){
          nextServo = 0;
        }
shoulder.write(servoAngles[0]); 
elbow.write(servoAngles[1]);
} }
</code></pre>
]]></description>
   </item>
   <item>
      <title>Help! Processing getting stuck at context.update();!</title>
      <link>https://forum.processing.org/two/discussion/11647/help-processing-getting-stuck-at-context-update</link>
      <pubDate>Fri, 10 Jul 2015 21:07:01 +0000</pubDate>
      <dc:creator>DeadSound12</dc:creator>
      <guid isPermaLink="false">11647@/two/discussions</guid>
      <description><![CDATA[<p>Hello everyone! I am having a serious and mysterious issue with my kinect project for school.
We're using an Kinect for Xbox 360, with Kinect SDK 1.7, and SimpleOpenNI Library 1.96 in Processing.</p>

<p>This program is much like the <a rel="nofollow" href="https://www.youtube.com/watch?v=Ki8UXSJmrJE">AR SandBox</a> project done with Kinect, Linux and some kind of version of C, but for our project we are using processing so that we can add more onto the code (for example, have fish swim in the areas that are supposed to be blue).</p>

<p>Here is the most recent code:
`</p>

<pre><code>import SimpleOpenNI.*;


SimpleOpenNI context;
float        zoomF =0.5f;
float        rotX = radians(180);  // by default rotate the hole scene 180deg around the x-axis, 
                                   // the data from openni comes upside down
float        rotY = radians(0);
boolean      autoCalib=true;


ArrayList &lt;PVector&gt; darkGreenPoints = new ArrayList &lt;PVector&gt;();
ArrayList  &lt;PVector&gt; greenPoints = new ArrayList &lt;PVector&gt; ();
ArrayList &lt;PVector&gt; yellowPoints = new ArrayList &lt;PVector&gt;();
ArrayList &lt;PVector&gt; brightBluePoints = new ArrayList &lt;PVector&gt;(); 
ArrayList &lt;PVector&gt; bluePoints = new ArrayList &lt;PVector&gt;();
ArrayList &lt;PVector&gt; darkBluePoints = new ArrayList &lt;PVector&gt;();


///variables to modify the depth level colors
int dgreenStart=609;
int dgreenEnd=837;
int greenEnd=1065;
int yellowEnd=1293;
int bblueEnd=1521;
int blueEnd=1749;
int dblueEnd=1977;

void setup()
{

  size(1024,768,P3D); 
  println("start setup");
  context = new SimpleOpenNI(this);
  if(context.isInit() == false)
  {
     println("Can't init SimpleOpenNI, maybe the camera is not connected!"); 
     exit();
     return;  
  }
  if(context.isInit() == true)
  {
     println("done!"); 
  }

  // disable mirror
  context.setMirror(false);

  // enable depthMap generation 
  context.enableDepth();

  // enable skeleton generation for all joints

  stroke(255,255,255);
  smooth();  
  perspective(radians(45),float(width)/float(height),10,150000);     
  println("end setup");
 }

void draw()
{
  println("begin draw");
  // update the cam
  println("updating cam");
  /////Here is where I'm having problems, the program gets stuck at the update method.
  context.update();
  println("cam updated");
  background(0,0,0);

  // set the scene pos
  translate(width/2, height/2, 0);
  rotateX(rotX);
  rotateY(rotY);
  scale(zoomF);

  println("map vars");
  int[]   depthMap = context.depthMap();
  int     steps   = 3;  // to speed up the drawing, draw every third point
  int     index;
  PVector realWorldPoint;

  println("color dot code");
  depthColor();

  translate(0,0,-1000);  // set the rotation center of the scene 1000 infront of the camera
  println("original dot code");
  // draw the pointcloud
  beginShape(POINTS);
  for(int y=0;y &lt; context.depthHeight();y+=steps)
  {
    for(int x=0;x &lt; context.depthWidth();x+=steps)
    {
      index = x + y * context.depthWidth();
      if(depthMap[index] &gt; 0)
      { 
        // draw the projected point
        realWorldPoint = context.depthMapRealWorld()[index];
        stroke(100);
        point(realWorldPoint.x,realWorldPoint.y,realWorldPoint.z);
      }
    } 
  } 
  println("new dot code");
  for (int i=0;i&lt;darkGreenPoints.size();i++){
   PVector d = darkGreenPoints.get(i);
   stroke(0,100,0);
   point(d.x,d.y,d.z); 
  }
  for (int i=0;i&lt;bluePoints.size();i++){
   PVector d = bluePoints.get(i);
   stroke(0,0,200);
   point(d.x,d.y,d.z); 
  }
  for (int i=0;i&lt;greenPoints.size();i++){
   PVector d = greenPoints.get(i);
   stroke(0,255,0);
   point(d.x,d.y,d.z); 
  }
  for (int i=0;i&lt;yellowPoints.size();i++){
   PVector d = yellowPoints.get(i);
   stroke(255,255,0);
   point(d.x,d.y,d.z); 
  }
  for (int i=0;i&lt;brightBluePoints.size();i++){
   PVector d = brightBluePoints.get(i);
   stroke(100,100,255);
   point(d.x,d.y,d.z); 
  }
  for (int i=0;i&lt;darkBluePoints.size();i++){
   PVector d = darkBluePoints.get(i);
   stroke(0,0,100);
   point(d.x,d.y,d.z); 
  }
  endShape();  

  println("clearinglists");
  ///clearing lists to reset them, so that the drawing is exactly
  ///what the kinect sees in each current frame, not previous ones
  println(darkGreenPoints.size(), "before");
  darkGreenPoints.clear();
  bluePoints.clear();
  greenPoints.clear();
  yellowPoints.clear();
  brightBluePoints.clear();
  darkBluePoints.clear();
  println(darkGreenPoints.size(), "after");


  println("end draw");
}

void depthColor(){
    PVector b;
    println("depth color method");
    for(int i=0;i&lt;context.depthMapRealWorld().length;i++){
     b=context.depthMapRealWorld()[i];
     if (b.z&gt;dgreenStart &amp;&amp; b.z&lt;dgreenEnd){
      darkGreenPoints.add(b); 
     }
      if (b.z&gt;dgreenEnd &amp;&amp; b.z&lt;greenEnd){
      greenPoints.add(b); 
      }
      if (b.z&gt;greenEnd &amp;&amp; b.z&lt;yellowEnd){
      yellowPoints.add(b); 
     }
      if (b.z&gt;yellowEnd &amp;&amp; b.z&lt;bblueEnd){
      brightBluePoints.add(b); 
     }
     if (b.z&gt;bblueEnd &amp;&amp; b.z&lt;blueEnd){
      bluePoints.add(b); 
     }
     if (b.z&gt;blueEnd &amp;&amp; b.z&lt;dblueEnd){
      darkBluePoints.add(b); 
     }
    }
  }
</code></pre>

<p>`
This code was working beautifully a couple of weeks ago, and I have not made any drastic changes to it in between then, just some clean up. After adding in println() statements, I see that Processing doesn't go farther than context.update(). I get no errors in the code, and when I remove context.update(), the rest of the code is able to run. All I get is a grey screen.</p>

<p>I have been on the ultimate and extremely frustrating goose chase to find a way to fix this problem. The kinect is functional, as proven when plugged into a 360.</p>

<p>Please help me. I don't know what to do anymore.</p>

<p>Sincerely,</p>

<p>The incredibly defeated student</p>
]]></description>
   </item>
   <item>
      <title>SimpleOpenNi + Export Application = fail</title>
      <link>https://forum.processing.org/two/discussion/10018/simpleopenni-export-application-fail</link>
      <pubDate>Tue, 24 Mar 2015 23:48:09 +0000</pubDate>
      <dc:creator>dhall5150</dc:creator>
      <guid isPermaLink="false">10018@/two/discussions</guid>
      <description><![CDATA[<p>Hello all,
I'm trying to export a processing sketch as an application on Win8.1 (64bit) and the end EXE is not running.   The sketch runs perfectly within processing.</p>

<p>I see a lot of users are reporting the same problem online, but I've not found any solutions that work for Windows.</p>

<p>Can anyone tell me what the 'fix' is?<br />
thanks</p>
]]></description>
   </item>
   <item>
      <title>Kinect pixel array is flipped when copied to PGraphics?</title>
      <link>https://forum.processing.org/two/discussion/11370/kinect-pixel-array-is-flipped-when-copied-to-pgraphics</link>
      <pubDate>Fri, 19 Jun 2015 00:46:42 +0000</pubDate>
      <dc:creator>msp</dc:creator>
      <guid isPermaLink="false">11370@/two/discussions</guid>
      <description><![CDATA[<p>Hi all</p>

<p>Can someone please tell what I'm doing wrong here?</p>

<p>I'm <a rel="nofollow" href="https://github.com/msp/MspSyphonSceneImageBasic/blob/master/MspSyphonSceneImageBasic.pde#L82">copying the implicit canvas</a> (this.g) to my VDMXCanvas (PGraphics) and something is causing the pixels to be flipped 180 degrees - check the screenshot!</p>

<p>I've overlaid the VDMXCanvas at the bottom half of the screen so I can see the two together. Here's the patch:</p>

<p><a href="https://github.com/msp/MspSyphonSceneImageBasic/blob/master/MspSyphonSceneImageBasic.pde" target="_blank" rel="nofollow">https://github.com/msp/MspSyphonSceneImageBasic/blob/master/MspSyphonSceneImageBasic.pde</a></p>

<p>Any thoughts welcome!</p>

<p>Cheers</p>

<p>Matt</p>

<p><img src="http://forum.processing.org/two/uploads/imageupload/961/DTXEEOU6UGIW.jpg" alt="kinect-reverse" title="kinect-reverse" /></p>
]]></description>
   </item>
   <item>
      <title>Kinect Pixel Mirror</title>
      <link>https://forum.processing.org/two/discussion/10862/kinect-pixel-mirror</link>
      <pubDate>Sun, 17 May 2015 19:56:43 +0000</pubDate>
      <dc:creator>wirginia</dc:creator>
      <guid isPermaLink="false">10862@/two/discussions</guid>
      <description><![CDATA[<p>hello, everyone!! im working on a project with the kinect and processing. İ have to do this for my final project of my course till thursday. I want to ask you how can i write a code like this link: <a href="http://tech.yeesiang.com/kinect-pixel-mirror/" target="_blank" rel="nofollow">http://tech.yeesiang.com/kinect-pixel-mirror/</a></p>
]]></description>
   </item>
   <item>
      <title>Octree from pointclouds of Kinect by Toxiclibs</title>
      <link>https://forum.processing.org/two/discussion/10786/octree-from-pointclouds-of-kinect-by-toxiclibs</link>
      <pubDate>Tue, 12 May 2015 23:19:32 +0000</pubDate>
      <dc:creator>DaimonW</dc:creator>
      <guid isPermaLink="false">10786@/two/discussions</guid>
      <description><![CDATA[<p>Ciao everyone!</p>

<p>I am tring to have an <strong>oc-tree</strong> from <strong>pointclouds</strong> of kinect.
Problem I had, was convert the</p>

<pre><code>kinect.depthMapRealWorld()
</code></pre>

<p>that is <strong>PVector</strong> array, to a <strong>Vec3D</strong> because I am usin <strong>Toxiclibs</strong> library.
Finally I have a Vec3D array with all points inside. Now I have another big problem. If I use</p>

<pre><code>tree.addAll(new ArrayList(toxVecs.length));
</code></pre>

<p>it draw me only one cube of the octree and not all points.
Instead if i write</p>

<pre><code>for (int i = 0; i &lt; toxVecs.length-1; i++)
{

  tree.addPoint(toxVecs[i]);
}
</code></pre>

<p>i receive the "Java heap error"!! toxVecs [] is my array with all pointclouds inside.</p>

<ul>
<li>Any help?</li>
<li>Do you have other approach to solve this problem? </li>
</ul>

<p>Help me please, don't leave me alone!</p>

<p>Thank you,
Dam</p>
]]></description>
   </item>
   <item>
      <title>how to find out where a user is pointing</title>
      <link>https://forum.processing.org/two/discussion/9435/how-to-find-out-where-a-user-is-pointing</link>
      <pubDate>Sun, 15 Feb 2015 17:50:27 +0000</pubDate>
      <dc:creator>plux</dc:creator>
      <guid isPermaLink="false">9435@/two/discussions</guid>
      <description><![CDATA[<p>Hi all, I have an idea for a project but, as I've never used the kinect before I want to know if it can be done with it. What I want to do is to find out where a user is pointing to (in 3d space). Then ok, I want to detect the skeleton of his arm (and I saw this can be done) and then virtually 'extend' it (drawing a line for example) to check where is pointing in the space. Basically I will have a wall and I want to find out where (which area) the user arm is pointing on that wall (and the user won't be touching the wall, of course).
If you know any interesting source I'd really appreciate it.</p>

<p>sorry for my english.</p>

<p>thanks :)</p>
]]></description>
   </item>
   <item>
      <title>Issues with code with Arduino, Kinect, and moving 2 Servo Motors</title>
      <link>https://forum.processing.org/two/discussion/9750/issues-with-code-with-arduino-kinect-and-moving-2-servo-motors</link>
      <pubDate>Sun, 08 Mar 2015 03:29:23 +0000</pubDate>
      <dc:creator>maddiem</dc:creator>
      <guid isPermaLink="false">9750@/two/discussions</guid>
      <description><![CDATA[<p>Hello! I have been working on a project with the Arduino and Kinect by moving a servo motor based on the closest depth value. This worked successfully, but when I split the screen into two, I was unable to get both motors to work separately (based off of two different closest values). I know that the Kinect is able to sense the two different values, but I am not sure where I am going wrong! There is some issue with the second motor (in port 9/closestdepthvalue2 in my code). It won't move at all, like it's not registering the values sent from Processing. There is nothing wrong with my servo motors, and my Arduino board seems to be working fine. If someone could look at my code to see if there are any glaring errors/any tips that you have, that would be so nice and helpful!  :) I'm sorry, I'm just new at programming and robotics, and I don't quite have the skills to do this debugging all by myself. I'll post my Processing code and Arduino code at the end of the post. Thank you!</p>

<p>Here's some more information on my code, if it will help: I use the closest depth value from the one half of the screen to send information to my first servo motor using closestDepthValue1, and I send the other half to the second servo using closestDepthValue2. Because I want the two servos to have the same angles, I sent the same value to each depending on the depth, but just incremented by 200 to differentiate. So closestDepthValue2 would send 220 as a value, but the motor would hopefully only move to 20 degrees. (Is there a more efficient/practical way to do this?) I also print the depth image from the Kinect to see what the camera is actually sensing, and that seems to work pretty well, just that Processing is not communicating with the Arduino correctly.</p>

<p>Thank you again! Sorry for the inconvenience! :)</p>

<p>Arduino Code:
<code>#include &lt;Servo.h&gt;
Servo one;
Servo two;
int nextServo = 0;
int servoAngles = 0;
void setup()
{
  one.attach(8);
  two.attach(9);
  Serial.begin(9600);
}
void loop()
{
  if(Serial.available())
  {
    int servoAngle = Serial.read();
    if(servoAngle &lt;= 160)
    {
      servoAngles = servoAngle;
      one.write(servoAngles);
    }
    if(servoAngle &gt; 160)
    {
      servoAngles = servoAngle - 200;
      two.write(servoAngles);
    }
  }
}</code></p>

<p>Processing Code:
`import processing.serial.*;
Serial myPort;
import SimpleOpenNI.*;
SimpleOpenNI kinect;
int closestValue1;
int closestValue2;
int closestX;
int closestY;
int closestP;
int closestM;
void setup()
{
  size(640, 480);
  String portName = Serial.list()[4];
  myPort = new Serial(this, portName, 9600);
  kinect = new SimpleOpenNI(this);
  kinect.enableDepth();
}
void draw()
{
  closestValue1 = 8000;
  closestValue2 = 8000;
  kinect.update();
  int[] depthValues = kinect.depthMap();
  for (int y = 0; y &lt; 480; y++)
  {
    for (int x = 0; x &lt; 320; x++)
    {
      int i = x + y * 320;
      int currentDepthValue1 = depthValues[i];
      if (currentDepthValue1 &gt; 0 &amp;&amp; currentDepthValue1 &lt; closestValue1)
      {
        closestValue1 = currentDepthValue1;
        closestX = x;
        closestY = y;
        if (currentDepthValue1 &gt;= 890)
        {
          myPort.write(20);
        }
        if (currentDepthValue1 &gt;= 803 &amp;&amp; currentDepthValue1 &lt; 890)
        {
          myPort.write(90);
        }
        if (currentDepthValue1 &lt; 803)
        {
          myPort.write(160);
        }
      }
    }
  }
  for (int p = 0; p &lt; 480; p++)
  {
    for (int m = 320; m &lt; 640; m++)
    {
      int t = m + p * 320;
      int currentDepthValue2 = depthValues[t];
      if (currentDepthValue2 &gt; 0 &amp;&amp; currentDepthValue2 &lt; closestValue2)
      {
        closestValue2 = currentDepthValue2;
        closestM = m;
        closestP = p;
        if (currentDepthValue2 &gt;= 890)
        {
          myPort.write(220);
        }
        if (currentDepthValue2 &gt;= 803 &amp;&amp; currentDepthValue2 &lt; 890)
        {
          myPort.write(290);
        }
        if (currentDepthValue2 &lt; 803)
        {
          myPort.write(360);
        }
      }
    }
  }</p>

<p>image(kinect.depthImage(), 0, 0);
  fill(255, 0, 0);
  ellipse(closestX, closestY, 25, 25);
  ellipse(closestM, closestP, 25, 25);
}`</p>
]]></description>
   </item>
   <item>
      <title>Hand drawing on the kinect</title>
      <link>https://forum.processing.org/two/discussion/9553/hand-drawing-on-the-kinect</link>
      <pubDate>Tue, 24 Feb 2015 04:02:50 +0000</pubDate>
      <dc:creator>itsnikusha</dc:creator>
      <guid isPermaLink="false">9553@/two/discussions</guid>
      <description><![CDATA[<p>Hello all!</p>

<p>After a long first semester, my partner and I have finished our first code! Of course, with the help of many along the way, which we would like to thank. Without the Processing community, this code would not have been possible.</p>

<p>This is a kinect code, so be sure to plug it in before drawing!</p>

<p>P.S. There is a small glitch that causes the program to close.</p>

<pre><code>//main code from SIMPLEOPENNI library examples

//imported libraries
import java.util.Map;
import java.util.Iterator;

import SimpleOpenNI.*;
import java.util.ArrayDeque;
import java.util.Queue;

//initizalizing data - global
static final int INTERVAL = 2 * 15000; 
static final int HUE = 1&lt;&lt;10, FPS = 200, TOLERANCE = 40, ALIASING = 2;
static final int DIM = 100, MAX = 03000, DETAIL = 1000, DEPTH = 2000;
final Queue&lt;PVector&gt; points = new ArrayDeque(MAX);
int resetAt;

SimpleOpenNI context;
float handVecListSize = 20;
Map&lt;Integer,ArrayList&lt;PVector&gt;&gt;  handPathList = new HashMap&lt;Integer,ArrayList&lt;PVector&gt;&gt;();





void setup(){
thread("timedShots");

 //regular setup
  smooth(8);
  frameRate(300);
  size(640,480);
  background(0);





  //controls color of lines
  colorMode(HSB, HUE, 1, 1);
  smooth(ALIASING);
  noFill();
 // println("x: " + x);

//if the camera isn't connected
  context = new SimpleOpenNI(this);
  if(context.isInit() == false)
  {
     println("Can't init SimpleOpenNI, maybe the camera is not connected?"); 
     exit();
     return; 

  }   

  // enable depthMap generation 
  context.enableDepth();

  // disable mirror
  context.setMirror(true);

  // enable hands + gesture generation
  //context.enableGesture();
  context.enableHand();
  context.startGesture(SimpleOpenNI.GESTURE_WAVE);


 }
void reset(){
  resetAt= millis() + 30000;
}
void draw(){
  // update the cam
  context.update();

  fill(0);
  textSize(12);
  int timeLeft = resetAt - millis();
  text(timeLeft, 20, 20);



  if(timeLeft&lt;3000){
    fill(0);
    noStroke();
    rectMode(CENTER);
    rect(width/8, height/8, 40,40);
    textSize(30);
    fill(255);
    textAlign(CENTER, CENTER);
    int countDown = 1 + (timeLeft / 1000);
    text( countDown, width/8, height/8);
  }
  if (millis () &gt;= resetAt) {
    reset();
    background(0);
  }







 // image(context.depthImage(),0,0);

  // draw the tracked hands
  if(handPathList.size() &gt; 0)  
  {    
    Iterator itr = handPathList.entrySet().iterator();     
    while(itr.hasNext())
    {
      Map.Entry mapEntry = (Map.Entry)itr.next(); 
      int handId =  (Integer)mapEntry.getKey();
      ArrayList&lt;PVector&gt; vecList = (ArrayList&lt;PVector&gt;)mapEntry.getValue();
      //PVector p;
      PVector p2;
      PVector p2d = new PVector();
      PVector p2d2 = new PVector();
      lines(vecList, p2d, 0, 2); //makes the three lines
      lines(vecList, p2d, 5, 2);
      lines(vecList, p2d, 10, 2);

    }        
  }
}

// Adding multiple lines
void lines(ArrayList&lt;PVector&gt; vl, PVector p2d, int distance, int thickness) {
      int fc = frameCount;

      //makes stroke change color
  stroke (fc++ &amp; HUE-1, 1, 10);
        noFill(); 
        strokeWeight(thickness);        
        Iterator itrVec = vl.iterator(); 
        beginShape();
          while( itrVec.hasNext() ) 
          { 
            PVector p = (PVector) itrVec.next(); 

            context.convertRealWorldToProjective(p,p2d);
            vertex(p2d.x-distance,p2d.y-distance);
          }
        endShape();  
}



// -----------------------------------------------------------------
// hand events
//if a hand starts moving
void onNewHand(SimpleOpenNI curContext,int handId,PVector pos){
  //let us know hand is found
  println("onNewHand - handId: " + handId + ", pos: " + pos);

   //startscreen goes away when new hand is sensed
 /*if (f_startscreen) {
    f_startscreen = false;
   background(0) ;
 */

  ArrayList&lt;PVector&gt; vecList = new ArrayList&lt;PVector&gt;();
  vecList.add(pos);

  handPathList.put(handId,vecList);
  }
//}

//if the hand is tracked
void onTrackedHand(SimpleOpenNI curContext,int handId,PVector pos)
{
  //println("onTrackedHand - handId: " + handId + ", pos: " + pos );

  ArrayList&lt;PVector&gt; vecList = handPathList.get(handId);
  if(vecList != null)
  {
    vecList.add(0,pos);
    if(vecList.size() &gt;= handVecListSize)
      // remove the last point 
      vecList.remove(vecList.size()-1); 
  }  
}
//if the hand is lost
void onLostHand(SimpleOpenNI curContext,int handId)
{
  //let us know the hand is lost
  println("onLostHand - handId: " + handId);
  handPathList.remove(handId);

  //startscreen comes back if no hand
  //f_startscreen = true;
}

// -----------------------------------------------------------------
// gesture events

void onCompletedGesture(SimpleOpenNI curContext,int gestureType, PVector pos)
{
  println("onCompletedGesture - gestureType: " + gestureType + ", pos: " + pos);

  int handId = context.startTrackingHand(pos);
  println("hand stracked: " + handId);
}

// -----------------------------------------------------------------

//timer
void timedShots() {
  for (;; delay(INTERVAL))  saveFrame(dataPath("####.jpg"));
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Using kinect</title>
      <link>https://forum.processing.org/two/discussion/9514/using-kinect</link>
      <pubDate>Fri, 20 Feb 2015 21:36:34 +0000</pubDate>
      <dc:creator>Dehiv</dc:creator>
      <guid isPermaLink="false">9514@/two/discussions</guid>
      <description><![CDATA[<p>Hi! 
How can i use SimpleOpenNI to Use kinect sensor v1 to paint and how i can substitute the mouse with the kinect?</p>

<p>Thanks a lot!</p>
]]></description>
   </item>
   <item>
      <title>Smoothing the skeleton movement.</title>
      <link>https://forum.processing.org/two/discussion/9405/smoothing-the-skeleton-movement</link>
      <pubDate>Fri, 13 Feb 2015 05:49:25 +0000</pubDate>
      <dc:creator>icekerim</dc:creator>
      <guid isPermaLink="false">9405@/two/discussions</guid>
      <description><![CDATA[<p>I am trying to smoothen my skeleton in a processing sketch with SimpleOpenNI in the official documentation I have found <a rel="nofollow" href="https://simple-openni.googlecode.com/svn-history/r411/trunk/SimpleOpenNI/dist/all/SimpleOpenNI/documentation/SimpleOpenNI/SimpleOpenNI.html">setSmoothingSkeleton</a> but with the latest version it just says that the function does not exist heres how Im using it</p>

<p>`    import processing.opengl.*;
    import SimpleOpenNI.*;</p>

<pre><code>SimpleOpenNI  kinect;
import saito.objloader.*;
OBJModel model;
void setup() { 
  size(1028, 768, OPENGL);
  model = new OBJModel(this, "kinect.obj", "relative", TRIANGLES);
  model.translateToCenter();
  BoundingBox box = new BoundingBox(this, model); 
  model.translate(box.getMin()); 
  kinect = new SimpleOpenNI(this);
  kinect.enableDepth();
  kinect.enableUser();
  kinect.setSmoothingSkeleton(0.6);

  kinect.setMirror(true);
}`
</code></pre>
]]></description>
   </item>
   <item>
      <title>Kinect Corner Detection</title>
      <link>https://forum.processing.org/two/discussion/9381/kinect-corner-detection</link>
      <pubDate>Wed, 11 Feb 2015 16:41:52 +0000</pubDate>
      <dc:creator>thwump</dc:creator>
      <guid isPermaLink="false">9381@/two/discussions</guid>
      <description><![CDATA[<p>Hi, I'm currently trying to develop a program for a final year University project that uses Processing and a Kinect with an Arduino controlled turntable to scan a room and create a 3D mesh for acoustic analysis. I'm having some trouble writing a code that will detect corners of objects and record their coordinates into a .stl that I can import into MeshLab. The idea is that the code will record the corners of objects instead of scanning every depth point the Kinect can see.
Has anyone tried looking in to this before?</p>

<p>I've included the code below just incase it helps to see how I'm working so far.  Its to satisfy my project's minimum objective of being a glorified range finder. I'm using v.1.5.1 as it supports the macbook I'm working on, so sorry if this is in the wrong place.</p>

<pre><code>import SimpleOpenNI.*;
import unlekker.util.*;
import unlekker.modelbuilder.*;
import processing.opengl.*;
import processing.serial.*;

SimpleOpenNI kinect;
UGeometry model;
UVertexList vertexList;
Serial myPort;

boolean scanning = false;
boolean printval = false;

boolean turn1 = false;
boolean turn2 = false;
boolean turn3 = false;
boolean turn4 = false;
boolean firstcontact = false;

String val;
PrintWriter output;

void setup ()
{
  size (940, 480);
  background(0);

  kinect = new SimpleOpenNI(this);
  kinect.enableDepth();

  model = new UGeometry();
  vertexList = new UVertexList();

  output = createWriter("depths.csv");

  String portName = Serial.list()[0];
  myPort = new Serial(this, portName, 57600);
  myPort.bufferUntil('\n');
}

void draw ()
{
  kinect.update();

PImage depthImage = kinect.depthImage();
image(depthImage, 0 ,0);

int furthestValue = 0;

if (turn1 &amp;&amp; !scanning)
{
  myPort.write('1');
  myPort.readStringUntil('\n');
  scanning = true;
}

if (turn2 &amp;&amp; !scanning)
{
  myPort.write('2');
  myPort.readStringUntil('\n');
  scanning = true;
}

if (turn3 &amp;&amp; !scanning)
{
  myPort.write('3');
  myPort.readStringUntil('\n');
  scanning = true;
}  

if (turn4 &amp;&amp; !scanning)
{
  myPort.write('4');
  myPort.readStringUntil('\n');
  scanning = true;
  output.close(); //finishes the csv file
}

if (scanning)
{
// get the depth array from the kinect  
int[] depthValues = kinect.depthMap();
// for each row in depth image
for (int y = 0; y &lt; 480; y++){
//look at each pixel in the row
  for(int x = 0; x &lt; 640; x++){
// pull out the corresponding value from the depth array
    int i = x + y * 640;
    int currentDepthValue = depthValues[i];    
//if that pixel is the furthest so far
    if(currentDepthValue &gt; 0 &amp;&amp; currentDepthValue &gt; furthestValue){
//save the value
      furthestValue = currentDepthValue;
    }
  }
scanning = false;
}
printval = true;
}

if (printval){
  float centimeters = furthestValue / 10;
  float inches = furthestValue / 25.4;
  println("Furthest Depth: " + furthestValue + " mm / "  
  + centimeters + " cm / " + inches + " inches");
//  output. println(centimeters + " cm"); 
  printval = false;
}
//output.close(); //finishes the csv file
// exit(); //exits program
}

void keyPressed() {
  if (key == ' ') {
    turn1 = true;
  }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Problem with OpenNi user, in windows 7 x64</title>
      <link>https://forum.processing.org/two/discussion/9299/problem-with-openni-user-in-windows-7-x64</link>
      <pubDate>Thu, 05 Feb 2015 01:37:45 +0000</pubDate>
      <dc:creator>Tino</dc:creator>
      <guid isPermaLink="false">9299@/two/discussions</guid>
      <description><![CDATA[<p>The problem is the window, when I run the program the background in the window is transparent and it do not show anything. That do not show any problem.
like that:
<img src="http://forum.processing.org/two/uploads/imageupload/621/BFJICT5UKGUQ.png" alt="problema" title="problema" /></p>

<p>Thank you very much in advance.</p>
]]></description>
   </item>
   <item>
      <title>Kinect to Processing to OSC to Blender</title>
      <link>https://forum.processing.org/two/discussion/9188/kinect-to-processing-to-osc-to-blender</link>
      <pubDate>Mon, 26 Jan 2015 23:01:00 +0000</pubDate>
      <dc:creator>dhall5150</dc:creator>
      <guid isPermaLink="false">9188@/two/discussions</guid>
      <description><![CDATA[<p>Hello everyone,
I've started a project to create a sketch that produces compatible OSC output to use NIMate's official Blender plugin unmodified in blender.</p>

<p>So far my results are fantastic - except for 1 joint rotation I can not figure out. When reaching up to cover the models eyes, for example, there is a point where the elbow does an unnatural rotation. It seems like when the hand joint is higher than the elbow joint the hand twists around, in an impossible way, showing the palm. Continuing to the eyes, the rotation eventually comes back to a natural position.</p>

<p>The sketch, and the version of NIMate's Big Buck Blender Model I'm using can be found here <a rel="nofollow" href="http://1drv.ms/1BstWXN">1drv.ms/1BstWXN</a></p>

<p>The sketch is using simpleopenni, and a few other libraries that I've included in the link.</p>

<p>Surprisingly the math up to this point has been easy to understand.<br />
Right now the bulk of the math sits in the "OSC" file inside the "sendJointMsg" function.   I am rotating the majority of joints based on its relation to the body's CoM.</p>

<p>The only 2 that I'm not doing that with is the shoulder and the elbow.  When I use CoM the positions of the arms aren't matching me.   Instead, I found using  a new vector of (1,0,0)  satisfies those joints, but the limbs seem more rigid compared to leg motions, head motions, leaning forward/backward, etc.</p>

<p>Finally, one more puzzle is that using NIMates plugin in blender, you can auto-generate shapes at joint points.    Using a blank blend, and enabling this option, you see a human shape and the joints seem to be rotating like you would expect.  Its hard to know that for sure since there is no bone between joints though.</p>

<p>Any help on getting the arms to rotate naturally would be appreciated
thanks</p>
]]></description>
   </item>
   <item>
      <title>Digital Paint on Lycra</title>
      <link>https://forum.processing.org/two/discussion/9254/digital-paint-on-lycra</link>
      <pubDate>Sun, 01 Feb 2015 10:51:27 +0000</pubDate>
      <dc:creator>Dehiv</dc:creator>
      <guid isPermaLink="false">9254@/two/discussions</guid>
      <description><![CDATA[<p>Good mornig,
i'm new in this forum and i'm a beginner!
I want to replicate an installation using the kinect to paint on a lycra tissue, like this (or similar): <a href="http://www.creativeapplications.net/processing/soak-dye-in-light-processing-kinect/" target="_blank" rel="nofollow">http://www.creativeapplications.net/processing/soak-dye-in-light-processing-kinect/</a></p>

<p>I'm using Processing 2.2.1, Kinect v.1, and i have the appropriate libraries but i have some problems to understand how con i replicate this.</p>

<p>Is there anyone who can help me?
Thank you.</p>
]]></description>
   </item>
   <item>
      <title>Kinect</title>
      <link>https://forum.processing.org/two/discussion/8757/kinect</link>
      <pubDate>Mon, 22 Dec 2014 12:04:26 +0000</pubDate>
      <dc:creator>Isabel</dc:creator>
      <guid isPermaLink="false">8757@/two/discussions</guid>
      <description><![CDATA[<p>Hello guys
I have this problem:</p>

<p>A sketch of processing forms with generative and particle I would make it react with the movement of those who pass in front of the kinect (x, y, and even z)
I enclose sketch</p>

<p>how do I?
What do you recommend to add?</p>

<hr />

<p>void setup(){</p>

<p>size(1300, 800, P3D);</p>

<p>background(0);</p>

<p>stroke(100, 150);</p>

<p>fill(255, 255, 255);</p>

<p>float xstart = random(150);</p>

<p>float ynoise = random(150);</p>

<p>translate(width/2, height/2, 0);</p>

<p>for(float y = -(height/8); y &lt;=(height/8); y+=3){</p>

<p>ynoise += 0.01;</p>

<p>float xnoise = xstart;</p>

<p>for (float x =-(width/8); x &lt;=(width/8); x+=3) {</p>

<p>xnoise +=0.02;</p>

<p>drawPoint(x, y, noise(xnoise, ynoise));</p>

<pre><code>}
</code></pre>

<p>}
}</p>

<p>void drawPoint(float x, float y, float noiseFactor) {</p>

<p>pushMatrix();</p>

<p>translate(x * noiseFactor * 5, y * noiseFactor * 5, -y);</p>

<p>float edgeSize = noiseFactor * 6;</p>

<p>ellipse(2, 2, edgeSize, edgeSize);</p>

<p>popMatrix();
}</p>
]]></description>
   </item>
   <item>
      <title>Is it possible to replace Opengl with Kinect?</title>
      <link>https://forum.processing.org/two/discussion/8129/is-it-possible-to-replace-opengl-with-kinect</link>
      <pubDate>Thu, 13 Nov 2014 12:10:35 +0000</pubDate>
      <dc:creator>itsnikusha</dc:creator>
      <guid isPermaLink="false">8129@/two/discussions</guid>
      <description><![CDATA[<p>Hello!</p>

<p>I am currently working on a project that tracks motion, which then draws depending on where the motion is sensed. At first, I was working with Opengl, however I now want to import a Kinect instead of using the built in camera. Please note that I am still in high school and am fairly new to processing. For the Kinect, I am using the library SimpleOpenNI.</p>

<p>Should I replace Opengl with Kinect or can I run them side by side without the libraries interfering with each other?</p>

<p>Thank you!</p>
]]></description>
   </item>
   <item>
      <title>Kinect SDK v2 With OpenNI2</title>
      <link>https://forum.processing.org/two/discussion/7840/kinect-sdk-v2-with-openni2</link>
      <pubDate>Tue, 28 Oct 2014 09:21:21 +0000</pubDate>
      <dc:creator>tka</dc:creator>
      <guid isPermaLink="false">7840@/two/discussions</guid>
      <description><![CDATA[<p>Hi guys, I'm trying to use OpenNI2 Kinect SDK 2.0 but I've had enough problems, does anyone know how to implement it? I'm pretty confused with it. Greetings!</p>
]]></description>
   </item>
   <item>
      <title>Body orientation angle calculation</title>
      <link>https://forum.processing.org/two/discussion/7676/body-orientation-angle-calculation</link>
      <pubDate>Sat, 18 Oct 2014 03:06:51 +0000</pubDate>
      <dc:creator>kosalacool</dc:creator>
      <guid isPermaLink="false">7676@/two/discussions</guid>
      <description><![CDATA[<p>I want to calculate the angle of a body spindle with respect to y axis.  any suggestion please?</p>
]]></description>
   </item>
   <item>
      <title>Anyone got Kinect V2 working on a Mac?</title>
      <link>https://forum.processing.org/two/discussion/7637/anyone-got-kinect-v2-working-on-a-mac</link>
      <pubDate>Thu, 16 Oct 2014 02:02:52 +0000</pubDate>
      <dc:creator>nicohsieh</dc:creator>
      <guid isPermaLink="false">7637@/two/discussions</guid>
      <description><![CDATA[<p>Hey guys,</p>

<p>I'm trying to get a Kinect V2 to run on a Mac. I followed the instruction here <a href="http://blogs.msdn.com/b/kinectforwindows/archive/2014/07/28/developing-with-kinect-v2-on-a-mac.aspx" target="_blank" rel="nofollow">http://blogs.msdn.com/b/kinectforwindows/archive/2014/07/28/developing-with-kinect-v2-on-a-mac.aspx</a> installed Window To Go into an USB on Windows8, and tried booting my Mac from there but it just went to a black screen. My USB port is 3.0 as it requires. Just wondering if anyone got Kinect V2(or even windows to go) working on a Mac?</p>

<p>Thanks!!</p>
]]></description>
   </item>
   </channel>
</rss>