Code covered by the BSD License  

Highlights from
Kinect_NITE_PointViewer_matlab

image thumbnail
from Kinect_NITE_PointViewer_matlab by HONGMIN ZHU
Kinect, OpenNI wrapper, NITE PointViewer example, Hand Tracking, IR & Depth, matlab interface

compile_cpp_files(OpenNiPath, NITEPath)
function compile_cpp_files(OpenNiPath, NITEPath)
% 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 and NITE path
% 
%   compile_cpp_files('C:\Program Files (x86)\OpenNI\');
%
%
clear all; close all; clc
if(nargin<2)
    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
    
    NITEPathInclude=[getenv('XN_NITE_INSTALL_PATH') '\Include'];
    NITEPathLib=[getenv('XN_NITE_INSTALL_PATH') '\Lib'];
    if(isempty(OpenNiPathInclude)||isempty(OpenNiPathLib))
        error('NITE path not found, Please call the function like compile_cpp_files(''examplepath\NITE\'')');
    end
else
    OpenNiPathLib=[OpenNiPath 'Lib'];
    OpenNiPathInclude=[OpenNiPath 'Include'];
    NITEPathLib=[NITEPath 'Lib'];
    NITEPathInclude=[NITEPath 'Include'];
end

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

Contact us