OpenFrameworks + kinect + Android项目源码

来源:互联网 发布:淘宝代购申诉凭证 编辑:程序博客网 时间:2024/05/23 13:36

OpenFrameworks + kinect + Android项目源码下载


The SIProp project's members finised to make "OpenFrameworks x kinectx Android" Development Environment and to run it on Android(armadillo & beagleboard).
Demo video



Special Thanks:
We used those OSSs. Thank you for great works!
OpenFrameworks
ofxKinect(Kinect for OpenFrameworks)
ofxAndroid(Android for OpenFrameworks)


SIProp members:
Hirotaka Niisato
masaxmasa





How to make:
1.Setup ofxAndroid's Development Environment
Please refer to the following site:
ofxAndroid setup manual
http://www.openframeworks.cc/setup/android-eclipse
If you can read Japanese & want to setup it on Windows, you should refer to this site.
http://blog.goo.ne.jp/tuninghigh/e/637821f5b76b370876e3092e860ce7db



2.Merge ofxKinect to ofxAndroid
2-1.Download & Setup to Eclipse
Please download soruce code from the following site:
https://github.com/ofTheo/ofxKinect

Next, Copy [ofxKinect directory]/src/ofxKinect/ to [ofxAndroid directory]/addons/ .
Final, Add include path to Eclipse's "(ofxAndroid's)addons" project.
Please run Eclipse and add the folloing place & path:

Place: Properties -> C/C++ General -> Pths and Symbols -> Includes tab(GNU C++)
Path: [ofxAndroid directory]/addons/src/ofxKinect/src/



2-2.Fix compile error
If ofxAndroid doesn't have ofxThread::waitForThread(bool) function.
Please add the following source:
[ofxAndroid directory]/addons/ofxThread/src/ofxThread.h
void waitForThread(bool stop = true);


[ofxAndroid directory]/addons/ofxThread/src/ofxThread.c

void ofxThread::waitForThread(bool stop){
if (threadRunning){
// Reset the thread state
if(stop){
threadRunning = false;
if(verbose)printf("ofxThread: stopping thread/n");

if(verbose)printf("ofxThread: waiting for thread to stop/n");
// Wait for the thread to finish
#ifdef TARGET_WIN32
WaitForSingleObject(myThread, INFINITE);
CloseHandle(myThread);
#else
if(pthread_self()==myThread) printf("ofxThread: error, waitForThread should only be called from outside the thread");
pthread_join(myThread, NULL);
#endif
if(verbose)printf("ofxThread: thread stopped/n");
myThread = NULL;
}else{
if(verbose)printf("ofxThread: thread already stopped/n");
}
}





2-3.Do customize source code for Android
Please remove the following code in ofxKinect::threadedFunction() function:
ofSleepMillis(20);

Please add the following code in [ofxKinect directory]/libs/lubusb/io.c file:

#define TIMESPEC_TO_TIMEVAL(tv, ts) /
do { /
(tv)->tv_sec = (ts)->tv_sec; /
(tv)->tv_usec = (ts)->tv_nsec / 1000; /
} while (0)




2-4.Create your application project
Please choose sample programs from the following directory:
[ofxAndroid directory]/apps/androidExamples/

And copy it to the following directory:
[NDK directory]/apps/

Final, export this project on Eclipse.



2-5.Build project
You must build JNI at first.
You execute the following commands:
cd [NDK directory]/apps/[your app directory]
[NDK directory]/ndk-build -B

And, you build android application on Eclipse.

*If you don't know how to use ofxKinect framework, please refer to "[ofxKinect directory]/src/testApp.cpp".



3.Change Android's configuration
Please add the following line to init.rc:
mount usbfs none /proc/bus/usb -o devmode=0666




4.Upgrade Android's kernel
libusb MUST neet "USB FS". And Kinect MUST neet "High Speed USB(USB2.0)".
Therefore, you check the following kernel options:
.config
CONFIG_USB_DEVICEFS=y
CONFIG_USB_EHCI_ARC_OTG_ALLOW_HS=y (only armadillo)



Appendix
If your device can not draw normal Z-camera image and RGB-camera image, you MUST need to build optimized kernel & userland.
I used the following optimization option for building kernel, userland & "OpenFrameworks x kinect x Android".
for armadillo
-O3 -march=armv6 -mtune=arm1136jf-s -mfpu=vfp -ffast-math -fno-math-errno -mfloat-abi=softfp -ftree-vectorize -fomit-frame-pointer -funroll-loops -fstrict-aliasing -funswitch-loops

for beagleboard
-O3 -ffast-math -fno-math-errno -march=armv7-a -mtune=cortex-a8 -mfloat-abi=softfp -mfpu=neon -ftree-vectorize -fomit-frame-pointer -funroll-loops -fstrict-aliasing -funswitch-loops





*Download
Full "OpenFrameworks x kinect x Android" Development Environment for Armadillo
Full "OpenFrameworks x kinect x Android" Development Environment for beagleboard
Only source code "OpenFrameworks x kinect x Android

Full "OpenFrameworks x kinect x Android" Development Environment has:
Android NDK crystax version for Linux
Android SDK for Linux
C/C++ Eclipse for Linux
ofxKinect(Kinect for OpenFrameworks)'s source codes
ofxAndroid(Android for OpenFrameworks)'s source codes
"OpenFrameworks x kinect x Android" 's source codes
sample program Eclipse's workspace

原创粉丝点击