Code covered by the BSD License  

Highlights from
Kinect Matlab

4.70588
4.7 | 34 ratings Rate this file 166 Downloads (last 30 days) File Size: 6.22 MB File ID: #30242
image thumbnail

Kinect Matlab

by

Dirk-Jan Kroon (view profile)

 

31 Jan 2011 (Updated )

Microsoft Kinect, OpenNI wrapper, Skeleton, Depth

| Watch this File

File Information
Description

This zip-file contains c++ wrapper functions for the Microsoft Kinect, OpenNI 1.* and OpenNI 2.* libary.
This code is compatible with Matlab 32bit and 64bit, Windows, MacOs and Linux.

Note!, OpenNI 2.* only depth/video stream support.

To compile the code to mex-files use the Microsoft Visual Studio (Express) or MacOS/Linux Gcc (x64/x86) C++ compiler.

To use OpenNI version 1.* install:
- OpenNI 1.5.4.0
- NITE 1.5.2.21
- SensorKinect093 v5.1.2.1

To use OpenNI version 2.* install:
- OpenNI 2.2.0
- NITE 2.2.0
- Microsoft KinectSDK v1.7

Start Matlab, go to OpenNi1 or OpenNI2 and execute compile_cpp_files. Now the mex-files are ready to use.

- Example : Will load an recorded Kinect file, and show the depth and image movie.

- ExampleIR : Will connect to your Kinect Hardware, and show a high-res IR image.

- ExampleRS : Will show the difference between the IR reference and measurement, Depth of a ROI is equal to movement of the ROI between reference and measurement. This depth can be calculated using a horizontal "tilt and scaling" invariant normalized cross correlation (included version is not invariant).

- ExampleSK : Will show Skeleton tracking on recorded Kinect movie.

- ExampleRW: Will show a depth surface overlay-ed with the photo-camera stream in real-world coordinates (mm)

- ExampleCP : Will capture the Kinect streams to a file

Acknowledgements

This file inspired Kinect Nite Point Viewer Matlab, Mx Ni Real World2 Pixel (An Addition To The Kinect/Open Ni/Nite Wrapper Of D.Kroon)), Simulink For Pcv (Point Cloud Viewer), Simulink Support For Kinect, and Matlab Wrapper For Open Ni 2.2.

MATLAB release MATLAB 7.11 (R2010b)
Other requirements Installed OpenNI 1.* or 2.*, and Gcc or Visual Studio (Express) C++ compiler.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (138)
21 Apr 2015 momo hamo

piyush gupta, I don't know if you still have the same or you have solved it!
Anyway, i had the same problem but the note in the file "compile_cpp_files" it was the solution

Note!, on strange compile errors change ['-I' OpenNiPathInclude '\'] to ['-I' OpenNiPathInclude '']

:)

13 Apr 2015 piyush gupta

Hi, I am using Matlab R2013b, on window 7(32 bit).
Visual Studio 2012 is installed.
I am getting following error while compiling compile_cpp_files.m

Error in compile_cpp_files (line 51)
mex('-v',['-L' OpenNiPathLib],'-lopenNI',['-I' OpenNiPathInclude ''],Filename);

Do anyone have solution of this ????
Thanks

Comment only
22 Dec 2014 Sinan kececi

I have also this problem. Is there a solution for this?
Error using mex
mxNiChangeDepthViewPoint.cpp
C:\Users\Sinan\Desktop\KINECT\OpenNI1\Mex\mxNiChangeDepthViewPoint.cpp(3) : fatal error C1083: Cannot open include file:
'XnOpenNI.h': No such file or directory

Error in compile_cpp_files (line 49)
mex('-v',['-L' OpenNiPathLib],'-lopenNI64',['-I' OpenNiPathInclude ''],Filename);

Comment only
10 Dec 2014 Juan Terven

Hi, Is it possible to get the depth image registered with the RGB image (or viceversa)?

11 Sep 2014 hira

hira (view profile)

 
30 Jul 2014 Ulrich

Ulrich (view profile)

I have a few questions:
1) What is the difference between OpenNI1 and 2?
2) How do I change the Picture Size?
3) Why are mxNiSkeleton and other missing in OpenNi2?

Comment only
30 Jul 2014 Ulrich

Ulrich (view profile)

Yes, Microsoft KinectSDK v1.8 works as well.

Comment only
30 Jul 2014 Ulrich

Ulrich (view profile)

Does it work with Microsoft KinectSDK v1.8?

Comment only
17 Jul 2014 azim aziz

Hello,
I successfully compiled the compile_cpp_file but when i run the Example.m, i got this error :-

Attempt to execute SCRIPT mxNiCreateContext as a function:
C:\Users\zg834397\Documents\MATLAB\kinect_matlab\OpenNI1\Mex\mxNiCreateContext.m

Error in Example (line 6)
KinectHandles = mxNiCreateContext(SAMPLE_XML_PATH,filename);

Could someone help me?

Thank you

13 Jun 2014 Anshul Joshi

I noticed atleast one person who got the following error:

mxNiChangeDepthViewPoint.cpp:3:22: fatal error: XnOpenNI.h: No such file or directory
compilation terminated.

mex: compile of ' "mxNiChangeDepthViewPoint.cpp"' failed.

??? Error using ==> mex at 222
Unable to complete successfully.

Error in ==> compile_cpp_files at 51
mex('-v',['-L' OpenNiPathLib],'-lopenNI',['-I' OpenNiPathInclude
''],Filename);

I'm compiling on ubuntu 12.04, with Matlab2010a. I've installed openni, nite and sensor kinect (it seems to be working on those samples with kinect). I changed compile_cpp_files.m lines 49 and 51 as stated in the last comment in that file.

If anyone has a hint why this is happening, please respond. Thank you in advance

Comment only
30 May 2014 Mark

Mark (view profile)

I've been happily using this for a while now and recently noticed that mxNiStopCapture doesn't actually stop my recordings (although mxNiDeleteContext does).

That is, if I continue to loop mxNiUpdateContext after having called mxNiStopCapture, new data will continue to be added to the recording.

Has anyone else had this issue?

06 May 2014 Taygun Kekec

@SonerUlun have you tried turning on and off again?

Comment only
13 Apr 2014 simbaforrest

works great with Matlab R2011a, Win7 64bit and OpenNI1.

When compile, use the short folder names:
OpenNiPathLib='C:\Progra~1\OpenNI\Lib64';
OpenNiPathInclude='C:\Progra~1\OpenNI\Include';

otherwise the compiler cl gives some error.

22 Mar 2014 Swami

Swami (view profile)

I am running this in windows-64bit with OpenNI2 and I am able to compile the associated mex files. I am running into the following error when I try to run a pre-recorded oni file :

***********************************
Error using mxNiPhoto:
No Video Node in Kinect Context
***********************************

Any pointers regarding this ?

Comment only
10 Mar 2014 Abdulkadir SENGUR

hi, i used the openni2 example.m. The depth image's size is 320, 240. How can i change it to 640, 480. i tried to change it in SamplesConfig.xml, but it did not work...

Comment only
26 Feb 2014 Soner Ulun

Hi,

When I use ExampleSk it runs fine but when video stops Matlab crashes and i need to restart it. Is it same for anyone else ??

Comment only
21 Feb 2014 yashin

yashin (view profile)

hello,

i am using OpenNI version 2 , i am compiling correctly compile_cpp_files , but when i compile Example.m
this error appear ;

After initialization:

SimpleViewer: Device open failed:
DeviceOpen using default: no devices found

you can help me

thank you very much

Comment only
16 Jan 2014 Qiyuan

Qiyuan (view profile)

Hello,
I have solved this problem. If I change the parameters 'xRes="1280" yRes="1024" FPS="15"' in the file SamplesIRConfig.xml into 'xRes="640" yRes="480" FPS="30"', then it works.

Comment only
14 Jan 2014 Qiyuan

Qiyuan (view profile)

Hello,
when i use ExampleIR.m , the IR-picture shows so much noise. And sections of rows shift a lot. There are many strips. I have not found where the problem is.

Comment only
15 Nov 2013 Marc Martinez Camarena

Hi,
I am having these problems to read .oni files and .xml files.

>> KinectHandles = mxNiCreateContext('SamplesConfig.xml');
One or more of the following nodes could not be enumerated:
Error using mxNiCreateContext
Kinect Error

>>KinectHandles = mxNiCreateContext('SamplesConfig.xml','SkelShort.oni');
Can't open recordin SkelShort.oni: Can't create any node of the requested type!
Error using mxNiCreateContext
Kinect Error

What can I do to solve that?
Thanks.

Comment only
29 Oct 2013 Sanjay Saini

i am using OpenNI version 2. and i have install properly all three software in my system
- OpenNI 2.2.0
- NITE 2.2.0
- Microsoft KinectSDK v1.7
But while i am compiling compile_cpp_files with openNI2 path address like compile_cpp_files ('C:\Program Files\OpenNI2')
it is saying ??? Error: File: compile_cpp_files.m Line: 1 Column: 28
Unexpected MATLAB expression. i am not getting what unexpected matlab expression i have used anyone can provide me solution for that
and i am using VS 2010 professional compiler and 2011b MATLAB

Comment only
02 Oct 2013 Jean-Jacques

To use this toolbox, use compile_cpp_files('C:\Progra~1\OpenNI2\') and not compile_cpp_files('C:\Progra~1\OpenNI2') or compile_cpp_files('C:\Program Files\OpenNI2\')

Otherwise, it works great.

Note that the Kinect is directly supported since R2013a if you have the image acquisition toolbox

28 Aug 2013 Paarth

Paarth (view profile)

I have question regarding the purchase of Kinect. Do I have to buy the Kinect for windows, to connect and run the programs, or Kinect for XBox will do the same stuff?
Please help me as soon as possible.
Thanks for the programs.

29 Jul 2013 Hussein

I use the mxNiChangeDepthViewPoint(KinectHandles) to align depth and color images, its working fine if I'm online streaming using the Kinect device, but if I used a .oni file I the two images are not aligned, could anyone please advise me how to fix it as I don't have a fulltime access to a Kinect device.
Many Thanks for your kind assistance and support

Comment only
17 Jul 2013 Jeffrey

Hi everyone,

I just downloaded and installed OpenNI 2.2.0 and NITE 2.2.0 and I am trying to run compile_cpp_files in matlab.

Every time I run the function I get the following error:

"Error using mex (line 206)
Unable to complete successfully.

Error in compile_cpp_files (line 50)
mex('-v',['-L' OpenNiPathLib],'-lopenNI2',['-I' OpenNiPathInclude '\'],Filename);"

I currently have Microsoft Visual Studio 2010 express installed but it does not seem to be detected.

Any help would be greatly appreciated.

Thanks,

Comment only
10 May 2013 john

john (view profile)

How is the real world depth information actually calculated?

Comment only
04 May 2013 fariba

fariba (view profile)

hello i am student of emu university master degree and my thesis about gaze tracking and i want to use kinect could you please give me some guide about your software

Comment only
03 Apr 2013 Jacopo Foglietti

Anyone tried to compile with openNI 2.1.0 for MacoOSX-x64? I get this error:

mex: compile of ' "mxNiChangeDepthViewPoint.cpp"' failed.

Error using mex (line 206)
Unable to complete successfully.

Error in compile_cpp_files (line 39)
mex('-v',['-DMX_COMPAT_32_OFF -L'
OpenNiPathLib],'/Users/standard/Documents/OpenNI-2.1.0/Redist/libOpenNI2.dylib',['-I'
OpenNiPathInclude],Filename);

Comment only
12 Mar 2013 Emiliano

Hi Rusty Buts,...

you should set the Current Folder in Matlab to the folder 'Kinect_Matlab_version1f'. In my case: MYDOCUMENTS\MATLAB\Kinect_Matlab_version1f\

You will see the files contained in such folder and the subfolders Config; Example; Mex.

Good luck

Comment only
09 Feb 2013 Rusty Buts

help, i get this error when i try to run compile_cpp_files.m :

Error using cd
Cannot CD to Mex (Name is nonexistent or not a directory).

Error in compile_cpp_files (line 47)
cd('Mex');

am i supposed to replace the word 'Mex' with some directory? thanks

Comment only
04 Feb 2013 Luis

Luis (view profile)

Works great with Matlab 2012b and OpenNI x64 bits on Windows7 professional.

03 Feb 2013 kiam nasri  
01 Feb 2013 Michitaka

Great work!

Do these functions support multiple senosr? (e.g. two kinect or two xtion sensors) If so, how to use mulitple sensors?

Comment only
24 Jan 2013 Luciano

Can't get compile_cpp_files to work. I have VS2010 installed and mex works with most packages. Any advice? I apprecite.

Comment only
24 Jan 2013 Turgay Akdogan  
16 Jan 2013 Tiago

Tiago (view profile)

Does anybody understands the function mxNiChangeDepthViewPoint.m?
I don't and there's no example using it...

Everything is working on Ubuntu 12.04 and MATLAB r2012b thanks to Ujwal's turtorial

24 Oct 2012 Matthew Foreman

Hi all,

I had this package working great on a Windows 7 computer running a 32-bit version of Matlab.

Then, all of a sudden, Matlab could not connect to the Kinect, giving the error "Nodes could not be enumerated..."

I reinstalled the drivers, reinstalled Matlab, made sure that firewall and security settings had not changed (all off), etc. I can't figure out why all of a sudden its not working. The Kinect still connects to other interfaces like FAAST and OSCeleton. Any ideas why Matlab can't connect all of a sudden?

Thanks,

Matt

Comment only
10 Oct 2012 Jacopo Foglietti

i've found this link very useful to resolve compiling problem in MacOSX Lion 10.7.5, with Matlab 2012a and Xcode 4.3.2

http://www.mathworks.it/support/solutions/en/data/1-FR6LXJ/

Comment only
10 Oct 2012 Jacopo Foglietti

ds

11 Sep 2012 feng yuxuan

function compile_cpp_files_update(OpenNiPath)
% This function compile_cpp_files will compile the c++ code files
% which wraps OpenNI for the Kinect in Matlab.
%
% Please install first on your computer:
% - NITE-Bin-Win32-v1.3.0.18
% - OpenNI-Bin-Win32-v1.0.0.25
%
% Just execute by:
%
% compile_c_files
%
% or with specifying the OpenNI path
%
% compile_cpp_files('C:\Program Files (x86)\OpenNI\');
%
% Modify: update to support 64bit in win7

%reset the mex
mex -setup;

%detect the version of system
try
cs = computer;
is64 = strcmp('64', cs(end-1:end));
catch
disp('Unable to detect the version of the system!');
end

if is64
disp('The system is 64bit system!');
else
disp('The system is 32bit system!')
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

cd('Mex');
files=dir('*.cpp');
if ~is64
% for 32bit
OpenNiPathLib=[OpenNiPath 'Lib'];
OpenNiPathInclude=[OpenNiPath 'Include'];

for i=1:length(files)
Filename=files(i).name;
clear(Filename);
mex('-v',['-L' OpenNiPathLib],'-lopenNI',['-I' OpenNiPathInclude],Filename);
end
else
%for 64bit
OpenNiPathLib=[OpenNiPath 'Lib64'];
OpenNiPathInclude=[OpenNiPath 'Include'];

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

Comment only
11 Sep 2012 feng yuxuan

Hi! I modify a little of the code to support 64bit system in Win7.

function compile_cpp_files_update(OpenNiPath)
% This function compile_cpp_files will compile the c++ code files
% which wraps OpenNI for the Kinect in Matlab.
%
% Please install first on your computer:
% - NITE-Bin-Win32-v1.3.0.18
% - OpenNI-Bin-Win32-v1.0.0.25
%
% Just execute by:
%
% compile_c_files
%
% or with specifying the OpenNI path
%
% compile_cpp_files('C:\Program Files (x86)\OpenNI\');
%
% Modify: update the code to support 64bit

%reset the mex
mex -setup;

%detect the version of system
try
cs = computer;
is64 = strcmp('64', cs(end-1:end));
catch
disp('Unable to detect the version of the system!');
end

if is64
disp('The system is 64bit system!');
else
disp('The system is 32bit system!')
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

cd('Mex');
files=dir('*.cpp');
if ~is64
% for 32bit
OpenNiPathLib=[OpenNiPath 'Lib'];
OpenNiPathInclude=[OpenNiPath 'Include'];

for i=1:length(files)
Filename=files(i).name;
clear(Filename);
mex('-v',['-L' OpenNiPathLib],'-lopenNI',['-I' OpenNiPathInclude],Filename);
end
else
%for 64bit
OpenNiPathLib=[OpenNiPath 'Lib64'];
OpenNiPathInclude=[OpenNiPath 'Include'];

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

28 Aug 2012 Kassem Al Ismaeil

Does it work with Asus XtionPRO live? Thanks

Comment only
27 Jul 2012 Kyle

Kyle (view profile)

Any thoughts on how to fix this error? I have all the OpenNI binaries installed

Open failed: Give Pointer to Kinect as input
??? Error using ==> mxNiSkeleton
Kinect Error

Comment only
27 Jul 2012 Lim

Lim (view profile)

Thanks a million!

I've been working on OpenNI, Visual Studio and Matlab for over a month! Yet I can't get Matlab to run my xbox kinect. With your files, I can proceed with my work easily!

For other user to take note,
I'm using the following and it works for me...
Windows 7 Home Premium,
Microsoft Visual Studio 2008,
Matlab 7.10.0 (R2010a),
OpenNI V1.5.2.23
Xbox Kinect

Comment only
27 Jul 2012 Lim

Lim (view profile)

 
17 Jul 2012 Steven Cadavid

nuiCapture can export Kinect sensor data to Matlab <http://www.nuicapture.com>

10 Jul 2012 reinhardt

It works in my win7, with newest unstable edition of openNI:

function compile_cpp_files(OpenNiPath)
% This function compile_cpp_files will compile the c++ code files
% which wraps OpenNI for the Kinect in Matlab.
%
% Please install first on your computer:
% - NITE-Bin-Win32-v1.3.0.18
% - OpenNI-Bin-Win32-v1.0.0.25
%
% Just execute by:
%
% compile_c_files
%
% or with specifying the OpenNI path
%
% compile_cpp_files('C:\Program Files (x86)\OpenNI\');
%
%openNI64.lib
if(nargin<1)
OpenNiPathInclude=getenv('OPEN_NI_INCLUDE');
% OpenNiPathLib=getenv('OPEN_NI_LIB');
OpenNiPathLib=getenv('OPEN_NI_LIB64');
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'];
% OpenNiPathInclude=[OpenNiPath 'Include'];
OpenNiPathLib= fullfile(OpenNiPath, 'Lib64');
OpenNiPathInclude= fullfile(OpenNiPath, 'Include');
end

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

Comment only
09 Jul 2012 Steven

Steven (view profile)

Thanks for this code. I'm having difficulty getting it to work.

Please can I ask, does it work with Kinect XBOX 360 or just Kinect for Windows?

Comment only
06 Jul 2012 Sergiy

Sergiy (view profile)

Mac OSX 10.7 & Matlab 2012a

1) Install OPENNI, SENSORKINECT, NITE by following these detailed instructions: http://developkinect.com/resource/mac-os-x/install-openni-nite-and-sensorkinect-mac-os-x
2) Run compile_cpp_files(sPath_OPENNI), where sPath_OPENNI is the path to OpenNI on your drive.

02 Jul 2012 Watcharapong Chuesa-ard

I have a problem please help me, I using Matlab 2012a Windows7 x64 compile and test program to found

Invalid MEX-file 'C:\MATLAB\filenamexxx.mexw64': The
specified module could not be found.

thanks

22 Jun 2012 Chris Atkin

I was having issues installing this on Mac OS X 10.7.4 (11E53), MATLAB R2011a 64-bit. I have the latest version of Xcode installed at the time (4.3.3).

The exact error I was having can be found at http://pastebin.com/dnjtuq2Q.

In order to solve this, I first changed compile_cpp_files as directed by Tim earlier (changing OpenNiPathInclude and OpenNiPathLib, modifying the mex command to build 64-bit versions).

Then, I needed to change my ~/.matlab/R2011a/mexopts.sh script on line 167 - changing SDKROOT to '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk' instead of the (now outdated) '/Developer' location.

Comment only
20 Jun 2012 Ming

Ming (view profile)

Nice job

Comment only
15 Jun 2012 le

le (view profile)

thanks

01 Jun 2012 Axel

Axel (view profile)

Hi all,
I am having troubles with mxNiDeleteContext. When I call it, Matlab freezes on 'Busy' and there's no way to recover but with a killall.

I also tried to execute the mxNiDeleteContext in a for loop on each non-zero value of the handles vector, both in normal and in debug mode, but the situation doesn't change.

I tested it both on a Ubuntu 11.04 with Matlab R2010b and on a Ubuntu 12.04 with Matlab 2012a.

Did someone encounter similar problems? Any clue about it?

Thank you so much for your help!!!

Best

Comment only
01 Jun 2012 Manuel

Manuel (view profile)

Hi all,

I wasn't able to capture Depth and RGB using all resolution of my ASUS Xtion Pro Live (1280x1024 according to its especification).
I've changed MapOutputMode on SamplesConfig.xml to <MapOutputMode xRes="1280" yRes="1024" FPS="30"/>, but capture process aborts with:
Open failed: The value is invalid!
Check whether C:\kinect\Matlab\Config\SamplesConfig.xml is available.
Any ideas?

Many thanks,

23 May 2012 mystpuni

is this working also with microsft sdk 1, not the beta version???

Comment only
16 May 2012 Lloyd Emokpae

Just a quick note, I was able to resolve the "/usr/bin/ld: cannot find -lopenNI" issue with ubuntu 12.04 by performing the following steps:

1. Creating a symbolic link to libOpenNI.so

-> ln -s /path/to/libOpenNI.so.1.0.0 /path/to/libOpenNI.so

2. Temporary update the environmental variable path in matlab to point to openNI library and Include folder by adding the following lines to the top of the compile_cpp_files.m file:

-> setenv('OPEN_NI_LIB', '/path/to/openNI/lib');
-> setenv('OPEN_NI_INCLUDE', '/path/to/openNI/Include');

3. Changing the mex function call in the compile_cpp_files.m to refer to '-lOpenNI' instead of '-lopenNI' since the libOpenNI.so has the letter o capitalized.

10 May 2012 Harm

Harm (view profile)

Great stuff, although it took me some time to get most of it running under Windows 7, 64 bits, but got there in the end.

However, one problem I have now: my Infrared photo returns 0's only. Depth works fine, so the IR-camera should be running... Anybody else faced this problem and has a clue how to overcome it? Could it be something in the KinectHandles / XML setting? Any advice is appreciated!

29 Mar 2012 Alexander Wallar

Hey I keep on getting this error:

??? Error using ==> mxNiSkeleton
No User Node in Kinect Context

Error in ==> ExampleSK at 12
Pos= mxNiSkeleton(KinectHandles);

Any help please?

Comment only
28 Mar 2012 Charles

I managed to get the Kinect working on both my Mac and Windows now so thank you all for your aid.

However I have yet to work out a way to get the information I want from the Kinect into Matlab.

What I want is to be able to grab a set of x,y,z co-ordinates from the Kinect. At this point it doesn't matter for which body part. Hand tracker or skeleton model being the obvious options I have been trying to compile them in a way that allows a real time stream to an expanding variable...

However I am stumped and out of my depth. Any advice or help would be greatly apreshiated.

Comment only
27 Mar 2012 Mario

Mario (view profile)

I found this to be a great contribution. However, I am facing problems when trying to detect skeleton nodes.

I am using Fedora x64 and Matlab 2011a. In my system both OpenNI and NITE are working from the command line (1.5.X versions), but in Matlab wrapper only examples not using skeleton detection are executing correctly.

When I try the ExampleSK I get the error:

??? Error using ==> mxNiSkeleton
No User Node in Kinect Context

Error in ==> ExampleSK at 12
Pos= mxNiSkeleton(KinectHandles);

If I incorporate a User node in the XML configuration file such as:

<Node type="User" name="User1"></Node>,
then the error I get when executing ExampleSK is:

??? Error using ==> mxNiCreateContext
Kinect Error 2

Error in ==> ExampleSK at 9
KinectHandle=mxNiCreateContext(SAMPLE_XML_PATH);

13 Mar 2012 Jhon Quevedo

Please can you help me with the following error can not find the solution thank you very much:

One or more of the Following nodes not could be enumerated:

Device: PrimeSense/SensorV2/5.1.0.41: The device is not connected!

?? Error using ==> mxNiCreateContext
Error Kinect

Error in ==> ExampleIR at 5
KinectHandles = mxNiCreateContext (SAMPLE_XML_PATH);

Software: I use is: win7 64 bit matlab 2011th, visual studio c + + 2010, driver correctly detects the engine, audio and camera, and tried with stable and unstable PrimeSense is the same.

In the examples C: \ Program Files \ OpenNI \ Samples \ Bin64 \ Release shows:
Device: PrimeSense/SensorV2/5.1.0.41: The device is not connected! I do thank you.

12 Mar 2012 Tim

Tim (view profile)

Update to my previous post, I was eventually able to get this software to compile and run. I had to do three main things to make this work on a 64-bit version of Matlab in OS X Lion:

0. Install universal (32/64 bit) versions of Open NI libraries.

1. Provide the explicit location of the Open NI libraries to mex.

2. Tell mex to not downgraded the MX library to 32-bit

To accomplish #1 and #2 above, I made the following changes in the compile_cpp_files script:

a. OpenNiPathInclude='/usr/include/ni/';

b. OpenNiPathLib='/usr/lib';

c. mex('-v',['-DMX_COMPAT_32_OFF -L' OpenNiPathLib],'/usr/lib/libOpenNI.dylib',['-I' OpenNiPathInclude],Filename);

After that, everything just ran fine.

Comment only
06 Mar 2012 Tim

Tim (view profile)

Having trouble with the 'compile_cpp_files' step. I'm using Mac OS X 10.7.3 with Matlab R2011b (64-bit but there's no other option for Mac I think) and Xcode 4.3. I've successfully installed all the Open NI stuff. The trouble comes when mex tries to link against Open NI:

-> gcc -O -Wl,-twolevel_namespace -undefined error -arch x86_64 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -mmacosx-version-min=10.5 -bundle -Wl,-exported_symbols_list,/Applications/MATLAB_R2011b.app/extern/lib/maci64/mexFunction.map -o "mxNiChangeDepthViewPoint.mexmaci64" mxNiChangeDepthViewPoint.o -L/usr/lib -lOpenNI -L/Applications/MATLAB_R2011b.app/bin/maci64 -lmx -lmex -lmat -lstdc++

ld: library not found for -lOpenNI
collect2: ld returned 1 exit status

The Open NI library is located in /usr/lib (and you can see I've provided this path to mex) and it's called libOpenNI.dylib. Does anybody know if I need to do something special because it's a dynamic library? By the way, with Xcode 4.3 I had to tell mexopts.sh where the SDKs where because they are not in the usual old place anymore.

thanks in advance for any help

T

Comment only
22 Feb 2012 Cumhur Erkut

@Charles: I got it working on Mac OSx (SL 10.6.8). I believe that the link @Thomas provides is the right solution. However, I found an easier way: I have called the compilation script with the argument of my OpenNI folder that contains Include and Lib dirs, like this

compile_cpp_files('/PathTo/OpenNI-Bin-Dev-MacOSX-v1.5.2.23/').

Note that the library starts with a capital letter, so I have changed L34 of the script to

mex('-v',['-L' OpenNiPathLib],'-lOpenNI',['-I' OpenNiPathInclude],Filename);

It compiled and linked. Then, in Example.m I needed to change the backward slashes (\) to unix-like forward slashes (/), and it worked. Hope this helps.

BTW, your snippet indicates that, despite you are on 10.7, your MATLAB mex uses 10.6 SDKs. Consider running mex -setup, and editing SDKROOT in
/Users/yourUname/.matlab/R2011b/mexopts.sh

Comment only
02 Feb 2012 kobegan  
26 Jan 2012 Heng JIao

Hi, I have got a problem. I am using Matlab 2009b. the compiler is vs2008 express.(i have vs 2010 professional, but for some reason matlab cannot detect it.)All stuff I installed are 32-bit. I compiled this code. It works fine with the saved data. But I cannot run the Kinect stream. It says
"mage: PrimeSense/SensorKinect/5.1.0.25: Xiron OS failed to connect to a network socket!

??? Error using ==> mxNiCreateContext
Kinect Error"

Please help me.

Many THanks

Comment only
10 Jan 2012 HONGMIN ZHU

the skeleton tracking example seems not work when using camera stream instead of recorded video. I just uncommened
KinectHandles=mxNiCreateContext(SAMPLE_XML_PATH);

new user can be detected, but there's no message:
"Pose Psi detected for user"
"Calibration started for user" "Calibration complete, start tracking user"

Any one have tried this?

Comment only
14 Dec 2011 Fa Fa

Fa Fa (view profile)

hi all,
i have win7 and 64bit matlab R2011b.
can you help me please,
i have error with compiler;
??? Error using ==> mex at 208
Unable to complete successfully.

Error in ==> compile_cpp_files at 34
mex('-v',['-L' OpenNiPathLib],'-lopenNI',['-I' OpenNiPathInclude],Filename).
thanks

Comment only
14 Dec 2011 Charles

Hi all, I'm hoping you can help me.
I seem to have reached a problem that was addressed earlier by Joelle but fail to understand how he managed to overcome it.

I am running Matlab R2011b on a Mac OS X Lion.
I managed to get the Kinect drivers working, proven by being able to run the samples in the NITE and OpenNI folders, however when I try to run the compile_cpp_files code I get the following error.

/Applications/MATLAB_R2011b.app/bin/mex: line 305: gcc-4.2: command not found
-> g++-4.2 -c -I/Users/charlesbartlett/Documents/Kinect_Development/OpenNI-Bin-Dev-MacOSX-v1.4.0.2Include -I/Applications/MATLAB_R2011b.app/extern/include -I/Applications/MATLAB_R2011b.app/simulink/include -DMATLAB_MEX_FILE -fno-common -no-cpp-precomp -fexceptions -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.5 -DMX_COMPAT_32 -O2 -DNDEBUG "mxNiChangeDepthViewPoint.cpp"

/Applications/MATLAB_R2011b.app/bin/mex: line 1285: g++-4.2: command not found

mex: compile of ' "mxNiChangeDepthViewPoint.cpp"' failed.

Error using mex (line 206)
Unable to complete successfully.

Error in compile_cpp_files (line 34)
mex('-v',['-L' OpenNiPathLib],'-lopenNI',['-I'
OpenNiPathInclude],Filename);

For the OpenNIPath I set it to the location I extracted the OpenNI to, so all seems well there. Thus I'm wondering if this is to do with it being a 64bit Matlab or Mac or both. But Ideally I would just like to get the skeleton example working nicely.

Many Thanks for any help you can give!!

Comment only
28 Nov 2011 Thomas

Thomas (view profile)

If anypony is still having trouble using this on Mac OS X (10.7), with a "lOpenNI not found" error, have a look at this stackoverflow question:

http://stackoverflow.com/questions/8140156/gcc-linker-cant-find-library-openni/8294683#8294683

Comment only
22 Nov 2011 Munzir

Munzir (view profile)

Somehow I was hoping for all the functionality of OpenNI to be available in MATLAB via some toolbox.

I basically want to bootstrap the skeleton-tracking algorithm of OpenNI and enable it to find the tip of an object (e.g. a sword) held in the hand of the user. Is this tool good enough for that purpose or should I stick to coding in C++?

I guess if we want to use all the C++ functions of OpenNI, we have to write a C++ file the way u wrote and then bring it to MATLAB (if at all needed). Am I right or is there a better way to go about it, using your tool maybe?

Comment only
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('..');

Comment only
27 Oct 2011 peter chen

Does it work on Asus Xtion Pro Live? Do I need to modify any code to get it working? Thanks~

Comment only
26 Oct 2011 John

John (view profile)

When I ran the ExampleRW.m to get the 3d motion of my object, I got a lot of "noise" as here: http://picturepush.com/public/6834326

<br>Does anybody got the same problem. I dont know why it happens to me.

Comment only
20 Oct 2011 Victor Borjas

Joelle, where did you change __int64 for long long int? Im having the same problems installing it on Mac OS with Matlab R2009b.

ld: library not found for -lOpenNI

But library libOpenNI.dylib is in the /usr/lib/ folder... so I guess it has to do with something similar as what you did.

Comment only
11 Oct 2011 lalit

lalit (view profile)

Can some one please explain in detail how to get it running on 64 bit bit Windows machine? I have tried a lot of combinations but wasnt able to get it done.

Comment only
22 Aug 2011 Bauke

Bauke (view profile)

 
12 Aug 2011 Paulo

Paulo (view profile)

Hi Ujwal. Thanks a lot for sharing your "how-to" document. I will give it a try.

Comment only
11 Aug 2011 Ujwal

Ujwal (view profile)

Hi Matt! Since Paulo said that most ppl here are using windows I didn't bother putting the fix for linux. Anyways I have prepared a documentation for kinect+ubunut+matlab and put it up here:
https://sites.google.com/site/ujwalbonde/kinect_installation.pdf?attredirects=0
Let us know if there is a problem.

Comment only
10 Aug 2011 Paulo

Paulo (view profile)

Hi Ujwal. That's great! I would like to have access to your fix. Since other people will be interested as well, would it be possible for you to make it available here or on a public URL? Thanks!

Comment only
09 Aug 2011 Matt

Matt (view profile)

Ujwal, I'd be really intersted in the fix as well if you don't mind sharing the wealth!

Comment only
09 Aug 2011 Ujwal

Ujwal (view profile)

Hi Paulo, got a fix for that... at least its working for my system. I can drop you a mail if you need the fix.

Comment only
08 Aug 2011 Paulo

Paulo (view profile)

Hi Ujwal. I did not find a solution for that problem yet. I have been working on a different project in the past few weeks though. I was hoping the problem would have been fixed in the recent versions of this OpenNI wrapper. But it seems most people here are using Windows.

Comment only
08 Aug 2011 Ujwal

Ujwal (view profile)

Paulo, I tried what you had advised for ubuntu(10.10, 64bit)... the problem still persists. Was it resolved for you?

Comment only
04 Aug 2011 Carsten  
31 Jul 2011 Soumitry J Ray

Can this tool be used to connect multiple kinects on? I guess not. Can anyone throw some light on this? Thanks!

Comment only
12 Jul 2011 Christian

I am trying to run the package under win7 64 bit. with XP 32bit, it works perfect with the sensor kinect v5.0.1 driver for 32 bit.

but which driver works for 64 bit?
the windows sdk doesn`t seem to work.

Comment only
05 Jul 2011 Dave Holden

line 25,25 of compile_cpp_files.m I believe ought to be:

OpenNiPathLib= fullfile(OpenNiPath, 'Lib');
OpenNiPathInclude= fullfile(OpenNiPath, 'Include');

Comment only
04 Jul 2011 Soumitry J Ray

@John - Recently I conducted experiments with 4 pens mounted on a desk. The depth measurements were off by +/-1 cm or less for distances in the range of 1-2 m.

Comment only
01 Jul 2011 Dirk-Jan Kroon

Dirk-Jan Kroon (view profile)

For people who want to align the depth-image with the photo-image, add the following line to the c.code. (I will add it my self in the next version)
g_DepthGenerator.GetAlternativeViewPointCap().SetViewPoint(g_Image);

Comment only
21 Jun 2011 John

John (view profile)

Can anybody tell me how accurate the depth value retrieve from mxNiDepthRealWorld function. I must be very appreciate.

Comment only
15 Jun 2011 Soumitry J Ray

@John - Go to Config folder and open the file SamplesConfig.xml and try changing this parameter:
<MapOutputMode xRes="640" yRes="480" FPS="30"/> to 320 and 240 as you desire.

NOTE: You will probably have to do that for all "Node Types".

Comment only
13 Jun 2011 John

John (view profile)

I ran ExampleCP.m to record rgb and depth image. How do you change the size of those images from 640 x 480 to 320 x 240?

08 Jun 2011 Soumitry J Ray

The package works perfectly fine with 32 bit matlab! :)

Comment only
06 Jun 2011 Soumitry J Ray

I ran it on Win 7, Matlab 2011a. Followin modifications to compile_cpp_files.m were needed: 1) OpenNiPathLib=getenv('OPEN_NI_LIB64');2) mex('-v',['-L' OpenNiPathLib],'-lopenNI64',['-I' OpenNiPathInclude],Filename);
3)OpenNiPath =getenv('OPEN_NI_INSTALL_PATH64');
-----------------------------------------
I could run the examples with the videos in this package. However, when I try to feed video from the Kinect camera I get this error:
One or more of the following nodes could not be enumerated:

Device: PrimeSense/SensorV2/5.0.1.32: The device is not connected!
IR: PrimeSense/SensorV2/5.0.1.32: Can't create any node of the requested type!

My Kinect is powered on and running, I have also installed the drivers. Please kindly let me know if some else has encountered a similar problem.

Thanks

18 May 2011 Rogelio

Hi, I have done every step to make it work, and in fact it did worke, but then when i try to do it again it stop working, now i have an error that looks like this: Error in ==> ExampleSK at 9
KinectHandle=mxNiCreateContext(SAMPLE_XML_PATH); Why does this happen?, how do i make it run again?, i can run the video example, but i can't run the kinect, if i use an openni example it works, so the drivers are not the issue, any idea?

Comment only
02 May 2011 juan

juan (view profile)

hi, does this work on v2009b?

Comment only
21 Apr 2011 Christian

*Adam H.

for this example I guess the samplesConfig.xml is loaded in the startup process.
If you want to use IR, you have to use the samplesIRconfig.xml. It opens the IR node.

By the way, isn`t it possible to use all nodes with only one XML?

Comment only
20 Apr 2011 Paulo

Paulo (view profile)

Matt, I'm using freenect as well but then we are on our own finding calibration and skeletonization code. So I would like to make this OpenNI wrapper work with Matlab in Linux.

I see you are now having problems linking to the openNI library. I believe you can fix this issue by correctly setting your LD_LIBRARY_PATH environment variable BEFORE running Matlab (I've tried using Matlab's setenv() function but it didn't work for me).

Here's what you can try from the system shell:

$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/openNI/
$ matlab

I don't remember now which folder has libopenNI.so, but you should make sure you point to the correct folder on the first command above.

Let's us know if this solves your problem.

~Paulo

Comment only
19 Apr 2011 Matt

Matt (view profile)

Paulo, I didn't get much further. I edited XnPlatform.h and XnOs.h to include what they would've if they could figure my OS and now I get:

-> g++ -c -I/home/matt/kinect/OpenNI/Include -I/usr/local/MATLAB/R2010b/extern/include -I/usr/local/MATLAB/R2010b/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC -pthread -DMX_COMPAT_32 -O -DNDEBUG "mxNiCreateContext.cpp"

-> g++ -O -pthread -shared -m32 -Wl,--version-script,/usr/local/MATLAB/R2010b/extern/lib/glnx86/mexFunction.map -Wl,--no-undefined -o "mxNiCreateContext.mexglx" mxNiCreateContext.o -L/home/matt/kinect/OpenNI/Lib -lopenNI -Wl,-rpath-link,/usr/local/MATLAB/R2010b/bin/glnx86 -L/usr/local/MATLAB/R2010b/bin/glnx86 -lmx -lmex -lmat -lm

/usr/bin/ld: cannot find -lopenNI
collect2: ld returned 1 exit status

Which is a bit further along but still not working. In the meantime I'll get by using freenect, http://acberg.com/kinect/ , but I'd much rather use this to get access to sensitivity settings and the fancy tracking functions. I plan on getting back to fiddling with this, I'll let you know if I get it going! Cheers

Comment only
19 Apr 2011 Paulo

Paulo (view profile)

To complement my message above: this seems to be a problem when trying to compile in Matlab for Linux (I'm running Ubuntu 10.10).

Comment only
19 Apr 2011 Paulo

Paulo (view profile)

Matt, I am having the same problem. Even when the include folders are set correctly, it seems some OpenNI symbols are not defined when compiling from within Matlab.

Thus, we end up with the unsupported platform error. Did you find a way to fix this problem?

Comment only
18 Apr 2011 Adam Hartshorne

When I run for instance ExampleSK with,

KinectHandles=mxNiCreateContext(SAMPLE_XML_PATH);

active.

I get,

Image Node : Found
Depth Node : Found
Infrared Node :Not found
User Node : Found

I assume IR node should also be found. I have tried restarting / clearing / deleting handle.

Any ideas? I am using the OpenNI drivers that came out a few days ago, could that be the problem?

Comment only
18 Apr 2011 Matt

Matt (view profile)

I'm having some trouble compiling on ubuntu 10.10, I get the following error:

/XnPlatform.h:71: error: #error OpenNI Platform Abstraction Layer - Unsupported Platform!

and

/home/matt/kinect/OpenNI/Include/XnOS.h:52: error: #error OpenNI OS Abstraction Layer - Unsupported Platform!

I know I've got OpenNI, NITE and the drivers working because I've run the demos...

Any help would be greatly appreciated!

Comment only
11 Apr 2011 Sinan Numan

Thank you for this wonderful tool. I'm starting a project on object recognition (using matlab) and I wanted to use Kinect. Before finding your post, I had the idea of saving the stream of images using C++ and the freenect library to the disk so that Matlab can read it (file buffers). But you saved me the effort / efficiency.

Comment only
10 Apr 2011 muhammad Raza

Actually depth image returns you some values with uint16, these values are actually depth information (not in mm), you can get output of mxNiDepthRealworld coordinates in mm. Blue color is only for displaying.

Comment only
07 Apr 2011 khaled emam

how can i get depth information from the blue depth image. I need to get the distance of any pixel and the camera itself .. is there a method of color mapping and if so how can i do this with the blue image even if i change the color map to default or autumn .. there is no large color variation

Comment only
07 Apr 2011 muhammad Raza

Hi, Although i have running posted code with matlab, its giving resolution of 240*320 for both depth and RGB image, but kinect actual resolution is 480*640, How can i get actual resolution?
However Tim Zaman posted MEX files generate 480*640 resolution images. Is it possible with attached files to get full resolution?
one more thing i want to confirm depth and RGB image have sam frame IDs?

Thanks

Comment only
29 Mar 2011 khaled emam

this solved my problem with compile_cpp_files error
http://www.mathworks.com/support/solutions/en/data/1-D5W493/?solution=1-D5W493

Comment only
23 Mar 2011 irad

irad (view profile)

If anyone has a good solution for:
"compile_cpp_files at 34
mex('-v',['-L' OpenNiPathLib],'-lopenNI',['-I' OpenNiPathInclude],Filename)"
While using matlab R2010b(64 bit), Without installing a 32bit version,
I'll be glad to hear it.
thanks.

Comment only
22 Mar 2011 msingh

msingh (view profile)

Hi,

Does anybody know about the compilation errors that I am getting? I am using MATLAB Version 7.1.0.246 (R14) Service Pack 3 with Microsoft Visual C/C++ 7.1.

Since nobody else is getting the rather specific compiler error I am getting, I am suspecting it is related to the specific compilers I am using. Since Matlab 7.1 does not support any compilers newer than Visual Studio .Net 2003, the options are limited.

Perhaps I need to switch to newer Matlab. Please let me know.

Thanks.

========
--> "cl "-IC:\Program Files\OpenNI\Include" -c -Zp8 -G5 -GR -W3 -DMATLAB_MEX_FILE -nologo /FoC:\DOCUME~1\msingh\LOCALS~1\Temp\mxNiCreateContext.obj -I"C:\Program Files\MATLAB71"\extern\include /MD -O2 -Oy- -DNDEBUG mxNiCreateContext.cpp"

mxNiCreateContext.cpp
C:\Program Files\OpenNI\Include\XnCppWrapper.h(4770) : warning C4002: too many actual parameters for macro 'XN_VALIDATE_NEW'
C:\Program Files\OpenNI\Include\XnCppWrapper.h(4770) : warning C4003: not enough actual parameters for macro 'XN_NEW'
C:\Program Files\OpenNI\Include\XnCppWrapper.h(4770) : error C2512: 'xn::StateChangedCallbackTranslator' : no appropriate default constructor available

C:\PROGRAM FILES\MATLAB71\BIN\MEX.PL: Error: Compile of 'mxNiCreateContext.cpp' failed.

??? Error using ==> mex
Unable to complete successfully

Comment only
21 Mar 2011 chotan

chotan (view profile)

Yes, at last it's working for me. Though I used Matlab R2010a, VS2010 (ultimate) c++ compiler. To compile VS2010 C++ I used following link:

http://www.mathworks.com/support/solutions/en/data/1-D5W493/?solution=1-D5W493

Comment only
18 Mar 2011 Simon

Simon (view profile)

An easy solution on 64bits machine is to install a 32bit version of Matlab R2010b with the installer in the following path:
/bin/win32/

It's work great =)

Comment only
17 Mar 2011 chotan

chotan (view profile)

*Pramod: mex -setup is showing following compilers-

Would you like mex to locate installed compilers [y]/n? n

Select a compiler:
[1] Intel C++ 11.1 (with Microsoft Visual C++ 2008 SP1 linker)
[2] Intel C++ 9.1 (with Microsoft Visual C++ 2005 SP1 linker)
[3] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 SP1 linker)
[4] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 Shell linker)
[5] Intel Visual Fortran 10.1 (with Microsoft Visual C++ 2005 SP1 linker)
[6] Lcc-win32 C 2.4.1
[7] Microsoft Visual C++ 6.0
[8] Microsoft Visual C++ 2005 SP1
[9] Microsoft Visual C++ 2008 Express
[10] Microsoft Visual C++ 2008 SP1
[11] Open WATCOM C++

[0] None

Compiler:

which compiler I can select, though I installed VS2010, it's not showing here.

Comment only
16 Mar 2011 Pramod chakrapani

You need to do a "mex -setup" and select VS2010 as compiler.

Comment only
16 Mar 2011 chotan

chotan (view profile)

Hi Dirk, I'm using Win7(32), Matlab 2008b, VS2010 Ultimate. I installed unstable updated OpenNI and NITE according to your suggestion. I'm getting following error which is similar to previous posting's error.

??? Error using ==> mex at 213
Unable to complete successfully.

Error in ==> compile_cpp_files at 34
mex('-v',['-L' OpenNiPathLib],'-lopenNI',['-I' OpenNiPathInclude],Filename);

Shall I show the OpenNI installation directory in the 1st line like "function compile_cpp_files('C:\Program Files\OpenNI\')". I'm littel bit cofused here. In the 'C:\Program Files\OpenNI\Lib\' "openNI.lib" is available. Kindly help me out please.

Comment only
16 Mar 2011 Pramod chakrapani

I wanted to know how to align rgb and depth images using this interface.

09 Mar 2011 Dirk-Jan Kroon

Dirk-Jan Kroon (view profile)

* muhammad Raza
3D hand tracking is indeed possible by simply using some functionality from Primesence Nite

Comment only
09 Mar 2011 muhammad Raza

Hi, I am reading comments about kinect for last month, i am really interested to use it,

Dirk i need your recommendation for its application in 3D hand tracking feasible.

Please guide me, so that i can buy it.

thanks.

Comment only
09 Mar 2011 Dirk-Jan Kroon

Dirk-Jan Kroon (view profile)

*Paulo
You can set the include directory of OpenNI manually (as user input to compile_cpp_files).

Comment only
08 Mar 2011 Paulo

Paulo (view profile)

Has anyone here successfully compiled it on Ubuntu 10.10 (32-bit, OpenNI-1.0.0.25).

I get a bunch of compile warnings and errors, ending with:

mex: compile of ' "mxNiCreateContext.cpp"' failed.

Seems like an include directory is mis-configured.

Comment only
04 Mar 2011 Roberto Herrera-Lara

It worked!
There a user guide for the library????

Comment only
03 Mar 2011 Naoto

Naoto (view profile)

 
27 Feb 2011 oren

oren (view profile)

Hi,
Nice job!
Can you add an example of record into files in ONI format?

Comment only
23 Feb 2011 Simon

Simon (view profile)

Hi, I'm trying to compile those files but i had an error (similar to Joelle's message):

??? Error using ==> mex at 222
Unable to complete successfully.

Error in ==> compile_cpp_files at 34
mex('-v',['-L' OpenNiPathLib],'-lopenNI',['-I' OpenNiPathInclude],Filename);

I have Windows 64bits with Matlab R2010a

Can you help me?

Comment only
23 Feb 2011 Joelle

Joelle (view profile)

 
22 Feb 2011 Tim Zaman

I checked out your code, seems great, although you do have to compile stuff. Small mistake in Example.m and ExampleSK.m; you define "KinectHandle" instead of "KinectHandles"(s), when using Kinect Hardware, when you remove the %. Otherwise, it's a 5 star code once it's up. I'd say for now its better than the other code i have used for matlab before.

22 Feb 2011 Joelle

Joelle (view profile)

The problem was the __int64 which is not defined on Mac Os X. I replaced it with long long int and it worked just fine. Thank you very much for your code!

Comment only
22 Feb 2011 Joelle

Joelle (view profile)

There is no OpenNI.lib file but a libOpenNI.dylib file in that folder.

Comment only
22 Feb 2011 Dirk-Jan Kroon

Dirk-Jan Kroon (view profile)

*Joelle,
Is OpenNI.lib, present in the 'OpenNiPathLib' folder?

Also the OpenNI.lib file has to 32bit if you use Matlab 32.bit and visa-versa.

Comment only
22 Feb 2011 Joelle

Joelle (view profile)

Thanks for the answer. I tried on Mac OS X with Matlab R2008b but I get a message error similar to Enita:
??? Error using ==> mex at 213
Unable to complete successfully.

Error in ==> compile_cpp_files at 27
mex('-v',['-L' OpenNiPathLib],'-lopenNI',['-I' OpenNiPathInclude],Filename);

Does it only work with R2010b or did someone manage to make it work on older version?

Comment only
21 Feb 2011 Dirk-Jan Kroon

Dirk-Jan Kroon (view profile)

* Joelle
The code may work out-of-the-box in Mac OS X, if you give the proper-path to the library in the compile_cpp_files
* Enita
This is a bug in Matlab R2008a
* Tim Zaman,
Using the camera-interface in your link is interesting. But it will not work with skeleton-tracking and hand-detection.

Comment only
21 Feb 2011 Joelle

Joelle (view profile)

Has someone adapted this for Mac OS X?

Comment only
17 Feb 2011 Roberto Herrera-Lara

NITE-Bin-Win32-v1.3.0.18 , hi, where I can download?

I tested on Windows 7 but not work!

Comment only
14 Feb 2011 Tim Zaman

Hi. I've posted the full and easy installation instructions here http://timzaman.wordpress.com/2011/02/01/kinect-on-windows-7-with-matlab/

Comment only
04 Feb 2011 Enita

Enita (view profile)

a special thank for c++ wrapper functions!
i have a problem to compile mex files :
??? Error using ==> mex at 207
Unable to complete successfully.

Error in ==> compile_cpp_files at 27
mex('-v',['-L' OpenNiPathLib],'-lopenNI','-lNiSampleModule',['-I' OpenNiPathInclude],Filename);

i use matlab 7.6 (R2008a) with Windows7.
Is mex compiler changed for this version ?
thx for help!

Comment only
01 Feb 2011 Sebastien PARIS

Sebastien PARIS (view profile)

Not tested, but should be very fun :)

Updates
01 Feb 2011

Don't crash but give error-message if using mxNiInfrared without IR node available.

03 Feb 2011

Added Help, real-world mex code/example and fixed bug in skeleton code.

17 Feb 2011

Fixed 64bit address bug

23 Feb 2011

Added Mac-OS support

10 Mar 2011

Added capture functions and example

01 Jul 2011

Added file of John Darby to align depth-image with photo-image.

06 Jun 2013

Now partly supports OpenNI 2.*

Contact us