chaohuig / simple-openni

Automatically exported from code.google.com/p/simple-openni
0 stars 0 forks source link

Can't work with OS X 10.8.2 #59

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
Running any example of the library produces the following code 

*Display 0 does not exist, using the default display instead.
SimpleOpenNI Version 0.27
SimpleOpenNI Error: ContextWrapper::checkLicenses, there is no valid license, 
please check your installation !

Can't open the depthMap, maybe the camera is not connected! *

and running the following code.-
import SimpleOpenNI.*;
SimpleOpenNI kinect;

int clickPositionDepth;
PVector v1, v2; //iniatilize vectors
float centimeters1, centimeters2;
int click = 0;
float distance;

void setup()
{
 size(640, 480);
 kinect = new SimpleOpenNI(this);
 kinect.enableDepth();
 v2 = new PVector(0.0, 0.0, 0.0);
}

void draw()
{
 kinect.update();

 PImage depthImage = kinect.depthImage();

 image(depthImage, 0, 0);

 if (v2.x != 0){ //find a way to check if null
     line(v1.x,v1.y,v2.x,v2.y);
 }

}

void mousePressed(){
  int[] depthValues = kinect.depthMap();

  /*if (click == 1) {
  int clickPosition = mouseX + (mouseY * 640);
  println("mouse position = "+ mouseX);
  }
  */

  if ( click ==0){
      clickPositionDepth = mouseX + (mouseY * 640);
      int millimeters = depthValues[clickPositionDepth]; //get depth values in click position
      centimeters1 = millimeters / 10.0; //Conversion from millimeters to centimeters
      v1 = new PVector(mouseX, mouseY, centimeters1); //make a vector with the object position
  }
  else {
      clickPositionDepth = mouseX + (mouseY * 640);
      int millimeters = depthValues[clickPositionDepth]; //get depth values in click position
      centimeters2 = millimeters / 10.0; //Conversion from millimeters to centimeters
      v2 = new PVector(mouseX, mouseY, centimeters2);
      distance = sqrt (centimeters1*centimeters1 - centimeters2*centimeters2);
      println("Distance.- "+ distance );
  }

  click = click + 1; 
  if (click > 1){ //restart click counting
          println("mouse position = "+ mouseX);
      //  println("cm: " + centimeters1 +" "+centimeters2);
          println("PVector v1= " + v1 + "PVector v2 = " + v2);
          click = 0;
  }
}

Produces (with processing 1.5.1)  .- 
Display 0 does not exist, using the default display instead.
SimpleOpenNI Version 0.27
SimpleOpenNI Error: ContextWrapper::checkLicenses, there is no valid license, 
please check your installation !

Exception in thread "Animation Thread" java.lang.NullPointerException
    at SimpleOpenNI.SimpleOpenNI.updateDepthImage(SimpleOpenNI.java:838)
    at SimpleOpenNI.SimpleOpenNI.depthImage(SimpleOpenNI.java:426)
    at distance.draw(distance.java:50)
    at processing.core.PApplet.handleDraw(PApplet.java:1631)
    at processing.core.PApplet.run(PApplet.java:1530)
    at java.lang.Thread.run(Thread.java:680)

with processing 2.0b3.-
SimpleOpenNI Version 0.27
SimpleOpenNI Error: ContextWrapper::checkLicenses, there is no valid license, 
please check your installation !

Exception in thread "Animation Thread" java.lang.NullPointerException
    at SimpleOpenNI.SimpleOpenNI.updateDepthImage(SimpleOpenNI.java:838)
    at SimpleOpenNI.SimpleOpenNI.depthImage(SimpleOpenNI.java:426)
    at distance.draw(distance.java:51)
    at processing.core.PApplet.handleDraw(PApplet.java:2128)
    at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:190)
    at processing.core.PApplet.run(PApplet.java:2006)
    at java.lang.Thread.run(Thread.java:680)

What version of the product are you using? On what operating system?
Running on OS X 10.8.2, Processing 1.5.1 and 2.0b3, and the following installer 
for OS X http://code.google.com/p/simple-openni/wiki/Installation
Before installing OS X 10.8 I was working with 10.6 and all was just fine 

Original issue reported on code.google.com by manuel2...@gmail.com on 18 Jan 2013 at 6:49

GoogleCodeExporter commented 8 years ago
I was able to fix this (and various other strange error messages) by repairing 
the permissions to 755 for directories and 644 for files copied by the 
installer script (OS X "short way"). My umask is 022 so probably when I 
unzipped files were created without the necessary permissions; installed by 
root (sudo) and therefore unreadable by Processing.

I wonder if upgrading OS X changed the permissions on system directories, like 
/var/lib where the license data seems to be stored...

Original comment by t...@1251.org on 17 Mar 2013 at 4:03

GoogleCodeExporter commented 8 years ago
http://decyborg.wordpress.com/2013/01/19/kinect-on-os-x-10-8-and-processing/

This is the problem I had. OSX 10.8 and camera wouldn't connect.
Finally worked after following the instructions on the above website.
There is an entry of mine further down the page that is nearly the same, but 
this subject heading nails it.
Hopefully, someone won't have to spend hours figuring it out.

Original comment by Don.spee...@gmail.com on 6 Apr 2013 at 9:56

GoogleCodeExporter commented 8 years ago
http://decyborg.wordpress.com/2013/01/19/kinect-on-os-x-10-8-and-processing/

This is the problem I had. OSX 10.8 and camera wouldn't connect.
Finally worked after following the instructions on the above website.
There is an entry of mine further down the page that is nearly the same, but 
this subject heading nails it.
Hopefully, someone won't have to spend hours figuring it out.

Original comment by Don.spee...@gmail.com on 6 Apr 2013 at 9:56

GoogleCodeExporter commented 8 years ago
haha thank you that's actually my blog I forgot to post it in here 

Original comment by manuel2...@gmail.com on 7 Apr 2013 at 1:52