Saturday, 26 May 2012

Kinect, Python and first few lines of code

Baba Gyani Triviani remembered:
"Example is always better than precept"

Many times, we are interested to do something but we don't find  the right resources. Some times, we find resources badly presented or presented at a very high level and when we beginners try to skim through the material, we are reminded of the feelings we had while skimming through Engineering text books, fondly remembered by EC students as "Over head transmission".

I intend to keep this post short at this moment, for my knowledge in the subject is very very limited. However, as I pick on more stuff, I will perhaps update this post with more stuff or provide links to newer posts.

In this post, I would like to show two simple programs to capture a normal photograph as well as to capture an IR photograph and show it on screen using Kinect, Python and OpenCV. If you don't know how to get up and running with Kinect, refer to my previous post here.

The program to capture normal photo


If you run the program above, you should be able to get a normal photo. If instead of a normal, you wish to get the IR image, replace the line img = freenect.sync_get_video() with img = freenect.sync_get_depth() and you are done. As you can see, this program is small and very self explanatory.

No comments: