基于Dragonboard 410c開發(fā)板android平臺上搭建kinect運(yùn)行環(huán)境
在繼上一篇《基于qualcomm平臺的kinect教程一之windows配置篇》,本文我們接著來介紹基于qualcomm的android平臺上搭建kinect的運(yùn)行環(huán)境。
本文引用地址:http://www.ex-cimer.com/article/201710/365548.htm一、總述
本教程是基于qualcomm的android平臺搭建kinect的運(yùn)行環(huán)境,我們采用的是:OpenFramework+OpenNI+Kinect of android,其中Kinect of android是OpenFramework源碼里的一個(gè)子項(xiàng)目;下面是具體的搭建步驟。
二、硬件環(huán)境:Dragonboard 410c + Kinect
圖1 Dragonboard 410c
圖2 Kinect傳感器
三、軟件環(huán)境
OpenFramework+OpenNI+Kinect of android,其中Kinect of android是OpenFramework源碼里的一個(gè)子項(xiàng)目,我的編譯環(huán)境是64位的ubuntu,下面詳細(xì)地介紹各部分的搭建。
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
# 手動(dòng)修改 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
# 把以下幾個(gè)重要的庫文件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 的運(yùn)行:
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源碼,并建立編譯環(huán)境,具體可參照http://openframeworks.cc/setup/android-eclipse/進(jìn)行下載配置。
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設(shè)置OpenFramework的paths.make
vi libs/openFrameworksCompiled/project/android/paths.make
SDK_ROOT=$HOME/work/
NDK_ROOT=$HOME/work/android-ndk-r9d
2.3設(shè)置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應(yīng)用
大家可以通過http://www.hirotakaster.com/download/androidOpenNIExample.tar.gz下載最新的應(yīng)用測試工程并驗(yàn)證結(jié)果。
評論