Code covered by the BSD License  

Highlights from
Kinect_NITE_PointViewer_matlab

5.0

5.0 | 3 ratings Rate this file 15 Downloads (last 30 days) File Size: 14.1 KB File ID: #31195
image thumbnail

Kinect_NITE_PointViewer_matlab

by

 

Kinect, OpenNI wrapper, NITE PointViewer example, Hand Tracking, IR & Depth, matlab interface

| Watch this File

File Information
Description

This zip-file provides a matlab interface for the NITE PointViewer example, with some c++ wrapper functions written for the Microfost Kinect, OpenNI and NITE library.

The work is based on Dirk-Jan Kroon's contribution(http://www.mathworks.com/matlabcentral/fileexchange/30242-kinect-matlab), description of modifications of related files are:

./Mex/
PointDrawer.h -- from NITE PointViewer example, functions to draw by glut are deleted.
mxNiCreateContext.cpp -- add session manager, flow control, point control, callbacks for session manager, code from NITE PointViewer example
mxNiDeleteContext.cpp -- unchange
mxNiDepth.cpp -- the index of pointer is updated
mxNiInfrared.cpp -- the index of pointer is updated
mxNiUpdateContext.cpp -- add update of session manager
mxNiHandPosition.cpp -- created, motivated by Dirk-Jan Kroon's work

the detail of the usage of each fucntion can be found in cooresponding .m file.

./Config/Sample-Tracking.xml
Since I use another camera which is similiar to Kinect except that it has no RGB sensor, there's no 'image' node in my xml file. you can modify it if you are interested, and make use of functions provided by Dirk-Jan Kroon.

./ExampleHand.m -- script for testing the PointViewer example.

The code is tested on:
Windows XP professional 32bit
matlab R2009a
compiler: Microsoft Visual C++ 2008 SP1
OpenNI 1.0.0.27
NITE 1.3.0.17
Sensor Driver 5.0.0.27

You need to firstly run compile_cpp_files.m to compile .cpp to mex files, check the OpenNI and NITE paths if there are errors.

when you successfully get all mex files, run ExampleHand.m to test.

-------------
Specifical thanks to Dirk-Jan Kroon for his code.
http://www.mathworks.com/matlabcentral/fileexchange/30242-kinect-matlab
-------------

ZHU HONGMIN (Herman)
contact: zhu.herman@gmail.com
University of Macau, Macau SAR, China

Acknowledgements

Kinect Matlab inspired this file.

MATLAB release MATLAB 7.8 (R2009a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (11)
24 Jul 2012 Christian Weis

hi! i managed to get your code working but unfortunately i get the same hand coordinates from the mxNiHandPosition as Martin.
i'm using a kinect, osx 10.7 (64bit) & matlabR2011b.
any ideas or suggestions what could be wrong?
kind regards and thank you in advance, christian

19 Jan 2012 lev

I too have the same error while compiling.. C:\PROGRA~1\MATLAB\R2011A\BIN\MEX.PL: Error: Link of 'mxNiCreateContext.mexw32' failed.
How to fix it?

26 Nov 2011 Mahmoud

After HONGMIN ZHU help, finally I can run the code with kinect and I have RGB and depth node only. Many thanks Zhu

18 Nov 2011 Mahmoud

Martin, Do you success to run Example hand file with kinect? I can't compile it, it seems error with mxNiCreateContext file but I still do not know how to solve it?
every time I compile the Mix files, I get this error : C:\PROGRA~2\MATLAB\R2010B\BIN\MEX.PL: Error: Link of 'mxNiCreateContext.mexw32' failed

01 Nov 2011 Emanuele Ruffaldi

I've tested it with 64bits. You can modify the compile_cpp_files.m as follows:

try
c = computer;
tis64 = strcmp('64',c(end-1:end));
catch me
tis64 = 0;
end

if(nargin<1)
OpenNiPathInclude=getenv('OPEN_NI_INCLUDE');
OpenNiPathLib=getenv('OPEN_NI_LIB');
if(isempty(OpenNiPathInclude)||isempty(OpenNiPathLib))
error('OpenNI path not found, Please call the function like compile_cpp_files(''examplepath\openNI'')');
end
else
OpenNiPathLib=[OpenNiPath 'Lib'];
if tis64
OpenNiPathLib=[OpenNiPath 'Lib64'];
end
OpenNiPathInclude=[OpenNiPath 'Include'];
end

if tis64
lib = '-lopenNI64';
else
lib = '-lopenNI';
end

cd('Mex');
files=dir('*.cpp');
for i=1:length(files)
Filename=files(i).name;
clear(Filename);
mex('-v',['-L' OpenNiPathLib],lib,['-I' OpenNiPathInclude],Filename);
end
cd('..');

18 Oct 2011 HONGMIN ZHU

Actually I used another alternative camera named like "Xtion pro" from prime sense, when I wrote this wapper. Now I have a kinect and plan to develop with Microsoft's SDK. There's not OpenNI and NITE installed currently in my computer so I can't tell which config file. You can check the google group for OpenNI.

18 Oct 2011 Martin Dale

I just downloaded it today so I'm guessing it is the latest. I can't get it to track either of the hands. The return from mxNiHandPosition is constantly
hp = 1.0e+009 *

4.2950 -0.0000 -0.0000 -0.0000 0 0

I'm new to working with the Kinect. What config file changes might be needed?

18 Oct 2011 HONGMIN ZHU

Hi, Martin,
Is the MultipleHands.ONI file the lastest update? I tried the orignal PointViewer project in VS2008, only a parameter need to be changed in the configuration file for multiple hand tracking. But the result is not so robust and it seems to be very slow.
Sorry I haven't tried the wrap of multi-hand case.

18 Oct 2011 Martin Dale

Hongmin, I've merged yours and Dirks programs and tried to use hand tracking with the MultipleHands.ONI file from the OpenNI downloads but it doesn't appear to detect any hands. Any idea why not?

Martin

29 Apr 2011 HONGMIN ZHU

hi, Brahim,
Sorry, I haven't encountered this error, but what version of matlab you used?
I found a similiar issue related to R2006b, and hope it's the cause of yours.

29 Apr 2011 Brahim HAMADICHAREF

the mex compile properly (with Microsoft Visual C++ 2008 Express in C:\Program Files\Microsoft Visual Studio 9.0) but when running the HandExample script I get the following error:

'What() is:Access violation - no RTTI data!'

Any ideas how to fix this ?

Brahim

Contact us