Hello world with Kinect and processing


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

http://techgeekon.blogspot.com/2016/07/installingopenni-in-ubuntu-14.html

First I will show you the processing code for getting depth image and I will explain line by line and properties of image


  

Copy this code and phase it on processing or download it from here

Now Run it  result is something like that showing below below..

image is containing depth image and color image side by side 





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 this 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 periodically  as loop until kill the program

·         size(640*2,480);

                 this  inbuilt method create window of size 640*2 times 480 because incoming  images  

                  have width and height of  640pix  and 480 pix  

·         kinect = new SimpleOpenNI(this);
 
                 then initiate the  kinect 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 images on the

        window .


Comments

Popular posts from this blog

Measuring 3D Distances between points using Kinect

Implementation - Robot Navigation

Full stack development of Robot navigation