Processing's “Export” functionality does not work with SimpleOpenNI Kinect application

edited August 2016 in Kinect

I'm running Processing 2.2.1 along with SimpleOpenNI 1.96 (based on instructions at http://shiffman.net/p5/kinect/). I modified the DepthImage example sketch and added file writing (code below).

I'm trying to output the depth data from Kinect to .txt files in a folder of my choice. In the Processing IDE, the sketch runs fine; the depth is written to the files correctly.

However I would like this functionality in an .exe file so that another program can run this .exe and read from those files, at run time. Export functionality in Processing IDE runs without errors and I get both win32 and win64 application folder. But if I execute .exe present in either one of them, nothing happens; I cannot see any errors anywhere. Even if I select "Present Mode" while exporting, only a gray screen appears but I cannot see any files being written to the path I supply. Toggle various selections (PresentMode/Export java) on the Export options windows hasn't helped.

I also tried to use savePath() because someone else (not using a kinect application) was able to write data into folders using that. But it did not work for me.

Following is my sketch that works correctly in the IDE:

import SimpleOpenNI.*;
SimpleOpenNI  context;

int[] dmap;
int dsize;
float[] dmapf;
PrintWriter output;
int fitr;
String path;

void setup()
{
   size(640*2, 480);
   fitr=1;
   context = new SimpleOpenNI(this);
   if (context.isInit() == false)
   {
        println("Can't init SimpleOpenNI, maybe the camera is not connected!"); 
        exit();
        return;
   }



 // mirror is by default enabled
  context.setMirror(false);

  // enable depthMap generation 
  context.enableDepth();

  // enable ir generation
  context.enableRGB();

  path = savePath("E:\\SYMMBOT\\DepthReading");  
}

void draw()
{
  // update the cam
  context.update();
  dmap = context.depthMap();
  //dmapf = dmap.array();

  output = createWriter(path+"\\depth"+fitr+".txt");
  fitr++;
  int itr = 0;
  for(int i=0; i<480; i++){
    for(int j=0;j<640;j++){
      output.print(dmap[itr]+" ");
      itr++;
    }
    output.println();
  }
  output.flush();
  output.close();
  //dsize = context.depthMapSize();
  background(200, 0, 0); //<>//

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

  // draw irImageMap
  image(context.rgbImage(), context.depthWidth() + 10, 0);
}

Answers

  • Just go into the application package contents/java/, delete the folders "osx" and "NiTE" and copy the whole SimpleOpenNI folder to this directory.

    fubbi

  • So I got some questions about this and to clarify:

    the folder is ...yourapplication/Contents/Java/_simpleOpenNi/

    because the link part in that error /SimpleOpenNI/library/libSimpleOpenNI.jnilib is a relative link and that relation turned out to be to the java folder, like this ...yourapplication/Contents/Java/SimpleOpenNI/library/libSimpleOpenNI.jnilib

    hope it works for you

Sign In or Register to comment.