This tutorial is “How to use oF 8.1 with OpenNI 2.2 on Android”, using Xtion. If want to use Kinect, use OpenNI 1.x and Sensor Kinect driver. And my build envrionment, I use Mac OS 10.8.5, Android 4.2.2 (device is MK 802 IV HDMI dongle type Android, root user needed) on this tutorial. May be other Android devices OpenNI 2.2 works well(OpenNI ran on Nexus7 in my test).
1. Built OpenNI 2.2
# Download Android NDK
cd $HOME
mkdir work
cd work
wget http://dl.google.com/android/ndk/android-ndk-r8e-darwin-x86_64.tar.bz2
tar -jxvf android-ndk-r8e-darwin-x86_64.tar.bz2
# Download OpenNI 2.2 from git
cd $HOME/work
git clone https://github.com/OpenNI/OpenNI2.git
cd OpenNI2
# change PS1080.ini file path
vi ./Source/Drivers/PS1080/Sensor/XnSensor.cpp
#define XN_GLOBAL_CONFIG_FILE_NAME “PS1080.ini”
to
#define XN_GLOBAL_CONFIG_FILE_NAME “/system/lib/PS1080.ini”
# change OpenNI.ini file path
vi ./Source/Core/OniContext.cpp
static const char* ONI_CONFIGURATION_FILE = “OpenNI.ini”;
to
static const char* ONI_CONFIGURATION_FILE = “/system/lib/OpenNI.ini”;
# build OpenNI 2.2
cd Packaging
python ReleaseVersion.py android
cd Final
tar -xvf OpenNI-android-2.2.tar
cd OpenNI-android-2.2
ls
EventBasedRead OpenNI.ini SimpleRead libOpenNI2.so libPSLink.so
MultipleStreamRead PS1080.ini libOniFile.so libPS1080.so libusb.so
2. oepnFrameworks 8.1 for Android
Download openFrameworks 8.1 for Android from official site, of course Android SDK, Eclipse, JDK is needed. openFrameworks for Android tutorials is here.
# download Android NDK
cd $HOME/work
wget http://dl.google.com/android/ndk/android-ndk-r9d-darwin-x86_64.tar.bz2
tar -jxvf android-ndk-r8d-darwin-x86_64.tar.bz2
# set paths.make. following is my example.
vi libs/openFrameworksCompiled/project/android/paths.make
SDK_ROOT=$HOME/work/android-sdk-macosx
NDK_ROOT=$HOME/work/android-sdk-macosx/android-ndk-r9d
# set OpenNI include files, shard library file oF make file.
“libs/openFrameworksCompiled/project/android/config.android.default.mk” changes diff is following.
MK 802 IV is HDMI dongle type android device(just like a Chromecast by google), easy to use with LED TV. About 60,000 point cloud is drawing in 30fps in this application.