OpenSource For You

KINECT WORLD

The first article of this series (in the February 2012 issue of LFY) gave an introducti­on to Kinect. In this second part, I cover the installati­on of libfreenec­t. Since these articles are also addressed to newbies, do pardon the inclusion of some of the b

- By: Samarth Shah The author is a FOSS advocate and loves to learn new technologi­es. His areas of interest include Kinect, Linux, Arduino and Image Processing using Opencv. In his spare time he writes motivation­al thoughts and shares them on his blog shahs

For programmin­g with Kinect, we need Opencv (Open Source Computer Vision), a library for real-time computer vision; so let me show you how to install this on Ubuntu 10.04, along with libfreenec­t. To install Opencv dependenci­es, use the following commands: sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavforma­t-dev libjpeg62-dev libtiff4-dev cmake libswscale-dev libjasper-dev cd ~

Download Opencv-2.1.0 from http://bit.ly/czluzs and extract it. Change to the extracted folder. After the cmake step, check whether the ffmpeg value is 1. If not, run it again. cd Opencv-2.1.0/ cmake . make sudo make install sudo gedit /etc/ld.so.conf.d/opencv.conf

At the end of the le, add ‘/usr/local/lib’, then save it, and run the following: sudo gedit /etc/bash.bashrc

Add the following two lines at the end of the le (it should not be empty): export PKG_CONFIG_PATH

Now Opencv-2.1.0 has been installed. Open another terminal to check some of the samples: cd ~ cd Opencv-2.1.0/samples/c chmod +x build_all.sh ./build_all.sh

To check any sample, go to that folder, and run the sample. For example, in the c folder, we have contours2, so to run it: cd c ./contours2

Libfreenec­t

To install libfreenec­t, we need to install some prerequisi­tes for building it: essential libxmu-dev libxi-dev libusb-1.0-0-dev

Next, clone its source from Github, change into the ‘libfreenec­t’ directory, create a ‘build’ sub-directory and cd to it, then run cmake to generate native and workspaces that can be used in the compiler environmen­t of your choice: git clone git://github.com/openkinect/libfreenec­t.git cd libfreenec­t

mkdir build cd build cmake ..

The make program uses the and the lastmodi cation times of binary les to decide which les need to be updated. Sudo lets us run commands as the superuser, which is required for two steps: make sudo make install

sudo adduser $user video

Run the sample project glview; the result is shown in Figure 1.

sudo glview

Now we are done with the complete environmen­t set-up, and can program Opencv using libfreenec­t. To write your own code for Opencv, add the libfreenec­t.h header to your code. In case you have any dif culty, you can mail me (address given below).

References

[1] http://www.cmake.org/ [2] http://openkinect.org/ [3] http://opencv.willowgara­ge.com/wiki/

 ??  ?? Part—2
Part—2
 ??  ?? Figure 1: Running glview
Figure 1: Running glview
 ??  ??

Newspapers in English

Newspapers from India