Getting started with Kinect on Ubuntu 12.04 – OpenNI, Nite , SimpleopenNI and Processing

Posted: July 8, 2012 in Kinect
Tags: , , , , ,

The objective of this tutorial is –
1) To install OpenNI, Nite (drivers that help  getting data from the kinect) in Ubuntu 12.04.
2) To set up Processing and  SimpleOpenNI ( OpenNI and Nite wrapper for Processing  ) using which you can get started with Kinect coding.

What you need?

Kinect with usb cable and a computer with Ubuntu installed. It is not recommended to run Ubuntu as a wubi installer from Windows when working with Kinect. Better install Ubuntu  in a new partition and run it.

1) Installing OpenNI and NITE

1) I highly recommend installing 32 bit versions of all  even if yours is a 64 bit system.  Download OpenNI_Nite installer package from here. eg: I downloaded OpenNI_NITE_Installer-Linux32-0.27.zip . Now extract the zip file to a folder.

Tip:

Instead of navigating to different folders using cd command you can enable Open in terminal  option when you right click in any folder. To get that open terminal and type:

sudo apt-get install nautilus-open-terminal

After installing type : killall nautilus && nautilus in terminal to activate the change immediately.


2) Navigate to OpenNI-Bin-Dev-Linux-x86-v1.5.4.0 folder ( version could have changed if you are seeing at a later point in time) in the unzipped folder using terminal and type the following command  to install –

sudo ./install.sh
 
 
 

3) Navigate to NITE-Bin-Dev-Linux-x86-v1.5.2.21 folder ( version could have changed if you are seeing at a later point in time) in the unzipped folder and type the following command  to install –

sudo ./install.sh
 

4) Navigate to Kinect folder and then to Sensor-Bin-Linux-x86-v5.1.2.1 folder ( version could have changed if you are seeing at a later point in time) in the unzipped folder and type the following command  to install –

sudo ./install.sh
 
Testing the installation:

Connect the kinect and ensure that the green Led on it is blinking. Now, navigate to the unzipped folder OpenNI_NITE_Installer-Linux32-0.27. Then to OpenNI-Bin-Dev-Linux-x86-v1.5.4.0  -> Samples -> Bin -> x86-Release and  try out the following sample in the the terminal.

./NiViewer

The output with my Kinect:

2) Setting up Processing and SimpleOpenNI for Kinect coding

1)Download processing for Linux from here.

2) Install OpenJDK Java7 Runtime by searching it from Ubuntu Software center.

3) Download simpleOpenNI from here and extract it. I downloaded SimpleOpenNI-0.27.zip which works for all platforms.

4) Unzip the downloaded processing folder, navigate to it and run ./processing in terminal.

When started for the first time Processing asks where to place the sketchbook folder. I let it place in the default folder. It’s path in my computer is  /home/sanmarino/sketchbook

Create a folder named libraries inside Sketchbook folder and place the unzipped folder SimpleOpenNI from step3 inside it.

5) Restart processing again . Now you should be able to see SimpleOpenNI as shown under.

Now we are done with installation.

Running processing Demo

In the processing menu under File ->Examples-> SimpleOpenNI(scroll down to see) ->OpenNI you will find DepthImage. Double click on it to bring up the code. Make sure that the kinect is properly connected. Now run the code by pressing the run button (that is right below the File menu). You should be able to see the output.

Now if you want to systematically learn kinect coding using processing and SimpleOpenNI you can follow this book called Making things See. If you just want to try out few other  examples , the codes from the book are available here.

Feel free to comment if any of the steps are unclear and if you face any problem. I shall be glad to offer the help  I can.

Errors in my case:

error while loading shared libraries: libglut.so.3: cannot open shared object file: No such file or directory

Installing freeglut3 from Ubuntu software center fixed it.

Advertisements
Comments
  1. piyush joshi says:

    I follow your instructions….but not run when i run NiViewer sample
    this error has occured
    ……………………………………………………………………………………
    One or more of the following nodes could not be enumerated:

    Device: PrimeSense/SensorKinect/5.1.2.1: The device is not connected!
    Device: PrimeSense/SensorV2/5.1.2.1: The device is not connected!
    Device: PrimeSense/SensorKinect/5.1.2.1: The device is not connected!
    Device: PrimeSense/SensorV2/5.1.2.1: The device is not connected!

    Press any key to continue . . .

    • Hi Piyush,

      Sorry for the delayed response.
      Try $ sudo rmmod gspca_kinect
      This used to happen when I used ubuntu as wubi installed inside windows. Also which version of ubuntu are u using?

      Cheers,
      Ramsri

      • sridhar says:

        Hi Ramsri,

        I am having the same problem, I did same what you mentioned, my OS ubuntu 12.04 32 bit, single partition with only ubuntu. And my kinect is blinking green.

        ipl-ubuntu1@iplubuntu1-OptiPlex-GX620:~/Downloads/OpenNI_NITE_Installer-Linux32-0.27/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Samples/Bin/x86-Release$ ./NiViewer
        One or more of the following nodes could not be enumerated:

        Device: PrimeSense/SensorV2/5.1.2.1: The device is not connected!

        any solution?
        Thank you

  2. Hi Sridhar,

    Please see if you can find solution in these threads –
    https://groups.google.com/forum/?fromgroups=#!topic/openni-dev/hISHuIV7tmg
    https://groups.google.com/forum/?fromgroups=#!msg/openni-dev/h0F6kYCNigs/BR6iqqFhSJ8J

    I shall let you know if I find any specific solution to your problem. Keep us posted if u get this solved.
    cheers,
    Ramsri

    • sridhar says:

      Thank you for your links, it worked now.
      installed unstable version from
      http://www.openni.org/Downloads/OpenNIModules.aspx
      OpenNI-Bin-Dev-Linux-x86-v1.5.4.0

      and
      to install SensorKinect:

      git clone https://github.com/avin2/SensorKinect.git
      cd SensorKinect
      git checkout unstable
      cd Platform/Linux/CreateRedist
      ./RedistMaker
      cd ../Redist/*
      sudo ./install.sh
      problem solved!

      • Thanks for updating , Sridhar.

      • javingka says:

        thank you all for shared this.
        I’m a little bit ashamed to ask this, but I can’t solve this problem.
        Where do I place this SensorKinect folder?.
        Do you re-downloaded the OpenNI-Bin-Dev-Linux-x86-v1.5.4.0?

        I still get this response:

        Device: PrimeSense/SensorKinect/5.1.2.1: The device is not connected!

        Thanks again.

        Cheers

      • javingka says:

        It works!!

        I solved this problem…

        thanks anyway!!

      • Sorry for the delay. Glad to know that you solved it!

      • Yiyuan says:

        hey man, i tried your method here but I still got the same error message. Does this method still work for now? Thanks!

      • mechqro says:

        Thank you for your comment! i solve my problem. it`s okay to progress second solution! thank you.

      • Anonymous says:

        hello bro.. need your urgent help regarding ur blog for Getting started with Kinect on Ubuntu 12.04 – OpenNI, Nite , SimpleopenNI and Processing .. i have tried the same way on ubuntu 12.04 and got the same error like you.. then as u recommended Installing freeglut3 from Ubuntu software center fixed it. But unfortunately this doesnt solve my problem. Plz help me as i am working on this from 2 weeks and not getting any success

  3. Arasch says:

    Hi Ramsri,

    Thanks for the detailed description setting up Kinect with Processing. What would change in this process if you use the Xtion Pro Life?
    Thanks

  4. Ramakrishna says:

    Hi Ramsri
    ./NiViewer is working but when i run the example in processing it gives me the follwoing error ….

    Can’t load SimpleOpenNI library (SimpleOpenNI64) : java.lang.UnsatisfiedLinkError: /home/ramakrishna/processing-2.0b3/sketchbook/libraries/SimpleOpenNI/library/libSimpleOpenNI64.so: libXnVNite_1_5_2.so: wrong ELF class: ELFCLASS32
    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 Scene.setup(Scene.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(Unknown Source)

    • Hi Ramakrisha,
      Sorry for the really late response.
      Please see if there was any problem with the version of simple openni and necessary java installation for it. I don’t seem to have much idea about the error.

      Cheers,
      Ramsri

    • Kingsley says:

      it crashed proenssicg itself.Here is the weird thing: it crashed both mac and pc. I doubt that I can install both of them wrong but thanks for answering anyway It’s good to know that I seem to be the only one having this problem

  5. You know one thing i was frustrated installing so many lib’s on same environment …it seems finally i got nice guide .. Thanks alot …Will come back to u soon…

  6. Alexa says:

    Great Post!!!

      • Shinoj says:

        Hello Greg, everyone,Amazing prcjoet!I was trying to get the sets of lengths of all joint-to-joint of the skeleton, and also the approximate measurements of the actual body-mass around key sections of such skeleton. If a BMI body-mass-index could be calculated from this, it would be fantastic. What do you think it is the best way to approach this?Are there any libraries/classes/functions that could help me get this kind of data?Thanks in advance for your help,Art.

  7. Anonymous says:

    awesome thank you so much

  8. Brando says:

    Hi Ramsi,
    I’ve tried to install SensoreKinect module but when i type
    ./RedistMaker
    i get this error:
    /usr/bin/ld: cannot find -lOpenNI
    collect2: error: ld returned 1 exit status

    Can you help me?
    Thanks in advance

    Brando

  9. Kelvin says:

    Hi, im trying to install on linux, however when i do./install, it says copying folders …ok create folder ok.. however i get an error
    registering module ‘libnimMockNodes.so’…/usr/bin/niReg: 1: /usr/bin/niReg: Syntax error: word unexpected (expecting “)”)

    I do not know what is wrong. i have been reading the comments on https://code.google.com/p/simple-openni/wiki/Installation and it seems other people have similar problems. I either do not see the solutions on the comments or that i have seen it but have no idea what it means

    Hope to get your help.
    Kelvin

  10. Yiyuan says:

    Hey Ramsri:

    I got the same problem with this:
    Device: PrimeSense/SensorKinect/5.1.2.1: The device is not connected!
    Device: PrimeSense/SensorV2/5.1.2.1: The device is not connected!
    Device: PrimeSense/SensorKinect/5.1.2.1: The device is not connected!
    Device: PrimeSense/SensorV2/5.1.2.1: The device is not connected!

    This website http://www.openni.org/Downloads/OpenNIModules.aspx is not valid now. So I can’t find the unstable version. Where should I go or what should I do now?

    Thanks!

  11. very good tutorial that help me in the process of setup Kinect sensor on Windows. Also, I add a link to this tutorial into an article with many more tutorial related to Kinect sensor http://www.intorobotics.com/working-with-kinect-3d-sensor-in-robotics-setup-tutorials-applications/

  12. Tom says:

    Bro this is an awesome tutorial thanks so much for taking the time to do this

  13. […] instalación la realicé basándome principalmente en esta página, y en ella dan algunos consejos que son útiles para seguir los pasos siguientes: 1.- Entra en la […]

  14. Saiteja says:

    I followed the installation process as mentioned above .But while executing ./NiViewer ,i am getting ‘ A timeout has occurred when waiting for new data!’ error. please any one help me out from this problem

  15. […] bibliotecas correspondientes para nuestra Kinect .. muchos tutoriales ya hay dando vueltas [1] [2][3], Nos encontramos con PyOpenNI y PyGame para demostrar lo sencillo que es interactuar con sensores […]

  16. Undeniably consider that which you said. Your favourite justification appeared to be on the net the easiest thing to be mindful of.

    I say to you, I certainly get annoyed even as folks think about
    concerns that they just don’t understand about.
    You managed to hit the nail upon the top and defined out the whole
    thing without having side-effects , other people can take a
    signal. Will likely be back to get more. Thank you

  17. Funny things says:

    Cool things allows you to discover and share as much as possible
    cool. Be it an excellent new gadget or a hot
    new car, some thing cool to accomplish or possibly a cool destination to
    visit. We cover every one of the cool stuff.
    https://www.facebook.com/wwwgopolinocom

  18. Carmella says:

    Hi there would you mind letting me know which hosting company you’re utilizing?

    I’ve loaded your blog in 3 completely different internet
    browsers and I must say this blog loads a lot faster
    then most. Can you recommend a good web hosting provider at a reasonable price?
    Thanks, I appreciate it!

  19. Hello colleagues, how is all, and what you desire to say about this article,
    in my view its truly remarkable in favor of me.

  20. bhupender says:

    hello bro.. need your urgent help regarding ur blog for Getting started with Kinect on Ubuntu 12.04 – OpenNI, Nite , SimpleopenNI and Processing .. i have tried the same way on ubuntu 12.04 and got the same error like you.. then as u recommended Installing freeglut3 from Ubuntu software center fixed it. But unfortunately this doesnt solve my problem. Plz help me as i am working on this from 2 weeks and not getting any success

  21. Khadim says:

    hi,
    I spent a lot of time to have the skeleton in ubuntu 14.04 with the xbox kinect . thank you for helping me

  22. What i don’t understood is in reality how you are now not
    actually a lot more well-appreciated than you may be now.
    You’re so intelligent. You understand therefore significantly in relation to
    this subject, produced me individually consider it from numerous various angles.
    Its like men and women aren’t fascinated until it is something to accomplish with
    Girl gaga! Your personal stuffs outstanding. At all times deal
    with it up!

  23. noaman says:

    http://www.apple.com/openni-sdk/openni-sdk-history-2/ even this link is not working … m using ubuntu 14.04 and getting the error

    Device: PrimeSense/SensorKinect/5.1.2.1: The device is not connected!

    anybody please help

    thanks in advance

  24. amoliane says:

    Hello,

    I received my kinect this morning and can’t have it working. If I test NiViewer, I have this result :

    One or more of the following nodes could not be enumerated:

    Device: PrimeSense/SensorKinect/5.1.2.1: The device is not connected!

    Can you help me please ?

    I am on Linux Mint.

  25. […] instalación la realicé basándome principalmente en esta página, y en ella dan algunos consejos que son útiles para seguir los pasos siguientes: 1.- Entra en la […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s