处理器/DSP
在继上一篇《基于qualcomm平台的kinect教程一之windows配置篇》,本文我们接着来介绍基于qualcomm的android平台上搭建kinect的运行环境。
本教程是基于qualcomm的android平台搭建kinect的运行环境,我们采用的是:OpenFramework+OpenNI+Kinect of android,其中Kinect of android是OpenFramework源码里的一个子项目;下面是具体的搭建步骤。
图1 Dragonboard 410c
图2 Kinect传感器
OpenFramework+OpenNI+Kinect of android,其中Kinect of android是OpenFramework源码里的一个子项目,我的编译环境是64位的ubuntu,下面详细地介绍各部分的搭建。
1.OpenNI
1.1. 搭建 OpenNI 2.2:
1.1.1下载 android ndk编译工具:
cd $HOME
mkdir work
cd work
wget http://dl.google.com/android/ndk/android-ndk-r8e-linux-x86_64.tar.bz2
tar -jxvf android-ndk-r8e-darwin-x86_64.tar.bz2
1.1.2.从git上 下载OpenNI2.2:
cd $HOME/work
git clone https://github.com/OpenNI/OpenNI2.git
cd OpenNI2
# 手动修改 PS1080.ini 路径
vi ./Source/Drivers/PS1080/Sensor/XnSensor.cpp
#define XN_GLOBAL_CONFIG_FILE_NAME “PS1080.ini” -> #define XN_GLOBAL_CONFIG_FILE_NAME “/system/lib/PS1080.ini”
#修改OpenNI.ini路径
vi 。/Source/Core/OniContext.cpp
static const char* ONI_CONFIGURATION_FILE = “OpenNI.ini”->static const char* ONI_CONFIGURATION_FILE = “/system/lib/OpenNI.ini”;
static const char* ONI_DEFAULT_DRIVERS_REPOSITORY = “OpenNI2” XN_FILE_DIR_SEP “Drivers”- >static const char* ONI_DEFAULT_DRIVERS_REPOSITORY = “/system/lib/”;
1.1.3 编译OpenNI2.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
# 把以下几个重要的库文件push到 Android目录下
adb push OpenNI.ini /system/lib/
adb push PS1080.ini /system/lib/
adb push libOpenNI2.so /system/lib/
adb push libPS1080.so /system/lib/
adb push libusb.so /system/lib/
adb push libOniFile.so /system/lib/
adb push libPSLink.so /system/lib/
adb push SimpleRead /system/lib/
# 检测OpenNI 的运行:
adb shell
cd /system/lib/
SimpleRead
./SimpleRead
[00000000] 585
[00033369] 585
[00066738] 584
[00100107] 584
[00133477] 584
[00166846] 584
[00200215] 584
[00233584] 583
[00266954] 583
……
2.OpenFramework 8.1
2.1.下载openframework源码,并建立编译环境,具体可参照http://openframeworks.cc/setup/android-eclipse/进行下载配置。
2.2.下载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
2.2设置OpenFramework的paths.make
vi libs/openFrameworksCompiled/project/android/paths.make
SDK_ROOT=$HOME/work/
NDK_ROOT=$HOME/work/android-ndk-r9d
2.3设置OpenNI include的library fie 和make file
修改 “libs/openFrameworksCompiled/project/android/config.android.default.mk”文件
ABIS_TO_COMPILE_RELEASE = armv5 armv7 neon — > ABIS_TO_COMPILE_RELEASE = armv5 armv7 neon x86
< PLATFORM_LDFLAGS += –sysroot=$(SYSROOT) -nostdlib -L”$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/$(GCC_VERSION)/libs/$(ABI_PATH)” -L$HOME/work/OpenNI2/Packaging/Final/OpenNI-android-2.2 — > PLATFORM_LDFLAGS += –sysroot=$(SYSROOT) -nostdlib -L”$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/$(GCC_VERSION)/libs/$(ABI_PATH)”
PLATFORM_HEADER_SEARCH_PATHS += “$HOME/work/OpenNI2/Include”
PLATFORM_LIBRARIES += OpenNI2
PLATFORM_LIBRARIES += OniFile
PLATFORM_LIBRARIES += PS1080
3.android应用
大家可以通过http://www.hirotakaster.com/download/androidOpenNIExample.tar.gz下载最新的应用测试工程并验证结果。
全部0条评论
快来发表一下你的评论吧 !