Hello world in Kinect with processing

I hope everyone have configured processing and OpenNI. If not go to my first Blog post from here.


First I will processing code for getting depth image and I will explain line by line and properties of images



Copy this code and phase it on processing sketch                                                                          Now Run it  result is something like that below..


Now I will go through line by line so that you can understand the code

  • import SimpleOpenNI.*;

This import the SimpleOpenNI Library  to this program

  • SimpleOpenNI kinect;

This create a object form the SimpleOpenNI so that we can call method in side the SimpleOpenNI. If you are familiar with any of object oriented language like java. You can understand easily.

  • Then the basic structure of processing  processing has  two main method setup() and draw()

setup() will call single time when sketch is running

draw() method call as loop until kill the program

  • size(640*2,480);

this  inbuilt method create window of size 640*2 times 480 because incoming both two images have width and height of  640pix  and 480 pix

  • kinect = new SimpleOpenNI(this);

then initiate the  created object  using   new as in Java

  • then the next two line enable both depth image and the RGB color image so that it can access inside the draw() function


  • Then inside the draw function

kinect.update()  is called .it  update the data to the latest  when every time calls it

  • Then both latest Depth and latest RGB data loads to PImage Object using next two lines
  • then image(PImage,positionX,positionY) function draw the both depth and RGB image on the window using next two line.



One thought on “Hello world in Kinect with processing

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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s