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:
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.
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
compiler: Microsoft Visual C++ 2008 SP1
Sensor Driver 22.214.171.124
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.
ZHU HONGMIN (Herman)
University of Macau, Macau SAR, China
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
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?
After HONGMIN ZHU help, finally I can run the code with kinect and I have RGB and depth node only. Many thanks Zhu
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
I've tested it with 64bits. You can modify the compile_cpp_files.m as follows:
c = computer;
tis64 = strcmp('64',c(end-1:end));
tis64 = 0;
error('OpenNI path not found, Please call the function like compile_cpp_files(''examplepath\openNI'')');
lib = '-lopenNI64';
lib = '-lopenNI';
mex('-v',['-L' OpenNiPathLib],lib,['-I' OpenNiPathInclude],Filename);
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.
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?
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.
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?
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.
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 ?