Ryan Durrant
Ryan Durrant

Reputation: 1040

Kinect UnsatisfiedLinkError: SimpleOpenNI.SimpleOpenNIJNI.swig_module_init()V

I am trying to follow the steps in "Making Things See" by Greg Borenstein. http://www.amazon.co.uk/Making-Things-See-Processing-MakerBot/dp/1449307078

And though I have used the Kinect before, I did it using the Windows SDK and not using the OpenNI Library which it suggests. So I uninstalled the SDK and the device drivers as suggested. But am having a hard time getting the OpenNI to work with the examples. When trying to run the c# examples in Processing (http://www.processing.org/download/) I am recieving this error:

UnsatisfiedLinkError: SimpleOpenNI.SimpleOpenNIJNI.swig_module_init()V

Which has this information:

Can't load SimpleOpenNI library (SimpleOpenNI32) : java.lang.UnsatisfiedLinkError: C:\Users\Ryan\Documents\Processing\libraries\SimpleOpenNI\library\SimpleOpenNI32.dll: Can't find dependent libraries Verify if you installed SimpleOpenNI correctly. http://code.google.com/p/simple-openni/wiki/Installation Exception in thread "Animation Thread" java.lang.UnsatisfiedLinkError: SimpleOpenNI.SimpleOpenNIJNI.swig_module_init()V at SimpleOpenNI.SimpleOpenNIJNI.swig_module_init(Native Method) at SimpleOpenNI.SimpleOpenNIJNI.(SimpleOpenNIJNI.java:1575) at SimpleOpenNI.ContextWrapper.(ContextWrapper.java:54) at SimpleOpenNI.SimpleOpenNI.(SimpleOpenNI.java:212) at DepthImage.setup(DepthImage.java:41) at processing.core.PApplet.handleDraw(PApplet.java:2103) at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:190) at processing.core.PApplet.run(PApplet.java:2006) at java.lang.Thread.run(Thread.java:662)

and having searched the internet a few times I have yet to find a solution to this problem. I have seen it suggested that I simply needed to reboot windows here: http://code.google.com/p/simple-openni/issues/detail?id=27 Though having tried this twice I still have the error.

Note: I would rather use Windows Visual Studio than Processing though am not sure how to import the library, or if I should just reference it. I am quite used to coding and developing but not so much using libraries such as this.

Upvotes: 1

Views: 4047

Answers (1)

George Profenza
George Profenza

Reputation: 51867

I've used SimpleOpenNI with Processing on WindowsXP and it works fine on my machine. Here's my configuration:

WinXP SP3 with OpenNI dev 32bit (OpenNI1.5.4.0,Nite1.5.2.21,avin2 SensorKinect5.1.2.1) and Processing 1.5.1 with SimpleOpenNI 0.20 (also tested with 0.27)

AFAIK SimpleOpenNI uses JNI to communicate with the OpenNI library and drivers, so the error above might come from two places:

  1. OpenNI not being installed properly
  2. The SimpleOpenNI library isn't installed properly

The easiest thing way to check if OpenNI is installed properly is to run on the samples that ships with it, like NiViewer (which should be in C:\Program Files\OpenNI\Samples\Bin\Debug). If that doesn't run, it's a good indication there's something wrong with the OpenNI installation.

I've noticed there are Sensor Driver/OpenNI/Nite installers on the SimpleOpenNI project page, but I don't remember using those on my machine. I've manually installed:

  1. OpenNI 32bit unstable
  2. Nite 32bit unstable
  3. avin2's compatible SensorKinect driver

in the above order. Try uninstalling/cleaning up then reinstalling and trying the OpenNI samples.

If the OpenNI/Nite/SensorKinect are properly installed and you can run the samples, the issue on the Java/JNI side. Check the following:

  1. The SimpleOpenNI folder is in %homepath%\My Documents\Processing\libraries
  2. OpenNI System variables (OPEN_NI_BIN,OPEN_NI_INCLUDE,OPEN_NI_INSTALL_PATH,OPEN_NI_LIB) are set in Windows' Environment Variables

You've also noted that you'd rather use Visual Studio instead of Processing. I agree, Processing isn't the best of IDEs (it's targeting beginners and meant to be minimal/simple AFAIK). If you'd like to carry on with the exact code from Making Things See in a nicer environment I recommend using eclipse with the Proclipsing plugin. Eclipse is a decent IDE (autocomplete/refactoring/etc.) and Proclipsing makes it easy to manage Processing projects (including the ones using external libraries like SimpleOpenNI).

Another thing that comes to mind is to use OpenFrameworks with VisualStudio and the ofxOpenNI addon. OpenFrameworks is somewhat similar to Processing and the ofxOpenNI wrapper has some nice features, but you will probably need to port Processing/SimpleOpenNI syntax to oF/ofxOpenNI.

Personally I think SimpleOpenNI is really easy to start with (the nicest OpenNI wrapper I've seen) if you're just started with Kinect development and want to easily follow the Making Things See example, it will probably be simpler to stick to Processing(with or without eclipse) and SimpleOpenNI. Depends how you tackle this: it will be simpler to just use the example code as is or take the extra effort to port it but understand more about how OpenNI itself works (withouth the wrapper/'training wheels').

The idea is to get started in a way most comfortable. SimpleOpenNI does make things simpler, but if you're not used to Processing/Java and are an experienced developer, you can probably work out how to use the original OpenNI API in C# using the documentation.

As you can notice, there are C# samples as well shipped with OpenNI. For example C:\Program Files\OpenNI\Samples\SimpleViewer.net. I recommend either moving SimpleViewer.net.exe from the obj\x86\Debug folder back to obj or changing the path of SAMPLE_XML_FILE in MainWindow.cs

A bit off topic: it might be possible to actually use both the official Kinect SDK and OpenNI using a bridge library, but I haven't used it myself yet, so can't advise from experience.

HTH

Upvotes: 2

Related Questions