File Exchange

image thumbnail

Kinect Matlab

version 1.9 (6.22 MB) by

Microsoft Kinect, OpenNI wrapper, Skeleton, Depth

4.75862
36 Ratings

133 Downloads

Updated

View License

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

Comments and Ratings (147)

I'm using the solution Akshay Iyangar suggested. I still get the exact same error.:

'Error using mex
/Users/bruger/Documents/MATLAB/Add-Ons/Collections/Kinect
Matlab/code/OpenNI1/Mex/mxNiChangeDepthViewPoint.cpp:3:10: fatal error: 'XnOpenNI.h' file not found
#include <XnOpenNI.h>
         ^
1 error generated.
Error in compile_cpp_files (line 59)
mex('-v',['-L' OpenNiPathLib],'-lOpenNI64',['-I' OpenNiPathInclude ''],Filename);'
 
Does anyone have alternative suggestions to fix this issue?

OSX Sierra operating system
Kinect 360.

Ben Lu

Ben Lu (view profile)

I tried, it can be used with OpenNI2 and Kinect2 in Ubuntu14.04

Ben Lu

Ben Lu (view profile)

 Can it be used with OpenNI2 and Kinect2 in Ubuntu14.04 ?

Hi,
I am having this problem to read .xml files.

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

but this command works well
>>KinectHandles = mxNiCreateContext('SamplesConfig.xml','SkelShort.oni');

What can I do to solve that?
Thanks.

julian tuyin

me again, a friend just told me to change mxniupdatecontext.cpp on line 24, with
//g_Context.WaitAndUpdateAll();
  g_Context.WaitAnyUpdateAll();
it works better this way.
anyway thanks for the code.
its a bit to complex to make it run, but its the best code (i guess).

julian tuyin

im using matlab 2010a x64 on windows 7 x64 with openni 1 x64.
for some reason i cant get my asus 601 to have a descent frame rate, i get a mean of 1~2 fps when runing "Exmanple",what should i do?

Richa Sharma

Hello everyone,
Please help me out, I am getting the following error:

Invalid MEX-file 'C:\Users\Desktop\jrterven-Kin2-f75660d\Mex\Kin2_mex.mexw64': The specified module
could not be found.

Thanks in advance

If you're getting this error
Error using mex
/Users/akshayiyangar/Documents/MATLAB/Kinect_Matlab_version2/OpenNI1/Mex/mxNiChangeDepthViewPoint.cpp:3:10:
fatal error: 'XnOpenNI.h' file not found
#include <XnOpenNI.h>

please uncomment the below code in compile_cpp_files.m.
if(is64)
OpenNiPathLib=[OpenNiPath '/Lib64'];
else
OpenNiPathLib=[OpenNiPath '/Lib'];
end

and just write this code
OpenNiPathLib=[OpenNiPath '/Lib'];
Do this everwhere in the code
and finally
mex('-v',['-L' OpenNiPathLib],'-lopenNI',['-I' OpenNiPathInclude '\'],Filename);
remove '\'

and make it
mex('-v',['-L' OpenNiPathLib],'-lopenNI',['-I' OpenNiPathInclude],Filename);
The program will run
code tested on Mac El Capitan

Sarah

Sarah (view profile)

Which Kind of Kinect is supported?
Can I use this for Kinect XBox 360?

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 '']

:)

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

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);

Juan R. Terven

Juan R. Terven (view profile)

  • 1 file
  • 121 downloads
  • 4.79167

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

hira

hira (view profile)

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?

Ulrich

Ulrich (view profile)

Yes, Microsoft KinectSDK v1.8 works as well.

Ulrich

Ulrich (view profile)

Does it work with Microsoft KinectSDK v1.8?

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

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

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?

Taygun Kekec

@SonerUlun have you tried turning on and off again?

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.

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 ?

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...

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 ??

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

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.

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.

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.

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

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

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.

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

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,

john

john (view profile)

How is the real world depth information actually calculated?

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

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);

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

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

Luis

Luis (view profile)

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

kiam nasri

Michitaka

Great work!

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

Luciano

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

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

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

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/

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

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

 

Does it work with Asus XtionPRO live? Thanks

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
 

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

Lim

Lim (view profile)

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

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

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?

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.

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

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.

Ming

Ming (view profile)

Nice job

le

le (view profile)

thanks

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

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,

mystpuni

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

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.

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!

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?

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.

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);

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.

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.

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

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

kobegan

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

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?

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

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!!

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

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?

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

peter chen

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

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.

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.

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.

Bauke

Bauke (view profile)

Paulo

Paulo (view profile)

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

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.

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!

Matt

Matt (view profile)

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

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.

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.

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?

Carsten

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

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.

Dave Holden

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

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

@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.

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);

John

John (view profile)

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

@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".

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?

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

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

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?

juan

juan (view profile)

hi, does this work on v2009b?

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?

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

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

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).

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?

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?

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!

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.

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.

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

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

khaled emam

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

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.

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

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

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 =)

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.

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

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.

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

Dirk-Jan Kroon

Dirk-Jan Kroon (view profile)

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

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.

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).

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.

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

Naoto

Naoto (view profile)

oren

oren (view profile)

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

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?

Joelle

Joelle (view profile)

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.

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!

Joelle

Joelle (view profile)

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

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.

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?

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.

Joelle

Joelle (view profile)

Has someone adapted this for Mac OS X?

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

I tested on Windows 7 but not work!

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/

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!

Sebastien PARIS

Not tested, but should be very fun :)

Updates

1.9

Now partly supports OpenNI 2.*

1.6

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

1.5

Added capture functions and example

1.4

Added Mac-OS support

1.3

Fixed 64bit address bug

1.2

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

1.1

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

MATLAB Release
MATLAB 7.11 (R2010b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video