ODROID U3 and OpenNI2/Xtion Pro Live

here is how to use OpenNI2/Xtion Pro live on ODROID-U3. environment is here.

os : xubuntu-13.10-desktop-armhf_odroidu_20140107.img.xz
OpenNI2(build from https://github.com/OpenNI/OpenNI2)

# install library
apt-get update
apt-get upgrade
apt-get install g++ python libusb-1.0-0-dev libudev-dev openjdk-6-jdk freeglut3-dev doxygen graphviz

# build OpenNI2
mkdir work
cd work
git clone https://github.com/OpenNI/OpenNI2
cd OpenNI2

# default OpenNI repository build will fail, so I change following. here is diff.
diff --git a/Packaging/ReleaseVersion.py b/Packaging/ReleaseVersion.py
index e2fdf5f..710f590 100755
--- a/Packaging/ReleaseVersion.py
+++ b/Packaging/ReleaseVersion.py
@@ -163,11 +163,12 @@ elif platform.system() == 'Windows':
 elif platform.system() == 'Linux' or platform.system() == 'Darwin':
 
     devNull = open('/dev/null', 'w')
-    subprocess.check_call(['make', '-C', '../', '-j' + calc_jobs_number(), 'PLATFORM=' + plat, 'clean'], stdout=devNull, stderr=devNull)
+    # subprocess.check_call(['make', '-C', '../', '-j' + calc_jobs_number(), 'PLATFORM=' + plat, 'clean'], stdout=devNull, stderr=devNull)
+    subprocess.check_call(['make', '-C', '../', '-j1', 'PLATFORM=' + plat, 'clean'], stdout=devNull, stderr=devNull)
     devNull.close()
     
     buildLog = open(origDir + '/build.release.' + plat + '.log', 'w')
-    subprocess.check_call(['make', '-C', '../', '-j' + calc_jobs_number(), 'PLATFORM=' + plat, 'release'], stdout=buildLog, stderr=buildLog)
+    subprocess.check_call(['make', '-C', '../', '-j1', 'PLATFORM=' + plat, 'release'], stdout=buildLog, stderr=buildLog)
     buildLog.close()
     
     # everything OK, can remove build log
diff --git a/ThirdParty/PSCommon/BuildSystem/Platform.Arm b/ThirdParty/PSCommon/BuildSystem/Platform.Arm
index c4a112d..cd12569 100644
--- a/ThirdParty/PSCommon/BuildSystem/Platform.Arm
+++ b/ThirdParty/PSCommon/BuildSystem/Platform.Arm
@@ -1,7 +1,8 @@
 ifeq "$(CFG)" "Release"
 
     # Hardware specifying flags
-    CFLAGS += -march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=softfp #-mcpu=cortex-a8
+    # CFLAGS += -march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=softfp #-mcpu=cortex-a8
+    CFLAGS += -march=armv7-a -mtune=cortex-a9 -mfpu=neon -Wno-unused-local-typedefs #-mcpu=cortex-a8
 
     # Optimization level, minus currently buggy optimizing methods (which break bit-exact)
     CFLAGS += -O3 -fno-tree-pre -fno-strict-aliasing


# build OpenNI
cd OpenNI2/Packaging
python ReleaseVersion.py  Arm

# maybe 1 hour needed, check build status "tail -f build.release.Arm.log" 

# install OpenNI
cd Final
tar -jxvf OpenNI-Linux-Arm-2.2.tar.bz2 
cd OpenNI-Linux-Arm-2.2
sh install.sh
source OpenNIDevEnvironment

# run sample application.
cd Samples/Bin
./SimpleRead

# use dual xtion depth stream sample
cd Samples/MultipleStreamRead/
vi main.cpp
#include <OpenNI.h>
#include <iostream>
#include <vector>
#include "OniSampleUtilities.h"

using namespace openni;
using namespace std;

class DepthSensor {
private:
    openni::Device device;
    openni::VideoStream depthStream;
    vector<openni::VideoStream*> streams;
 
public:
    DepthSensor() {}
 
    void open( const char* uri ) {
        Status ret = device.open( uri );
        depthStream.create( device, SENSOR_DEPTH );
        depthStream.start();
        streams.push_back( &depthStream );
    }
 
    void run() {
        int changedIndex;
        openni::OpenNI::waitForAnyStream( &streams[0], streams.size(), &changedIndex );
        if ( changedIndex == 0 ) {
            openni::VideoFrameRef depthFrame;
            depthStream.readFrame( &depthFrame );
            if ( depthFrame.isValid() ) {
            }
        }
    }
};
 
int main() {
    try {
        openni::OpenNI::initialize();
        openni::Array<openni::DeviceInfo> deviceInfoList;
        openni::OpenNI::enumerateDevices( &deviceInfoList );
 
        DepthSensor* sensor = new DepthSensor[deviceInfoList.getSize()];
        for ( int i = 0; i 
make
cd Bin/Arm-Release
./MultipleStreamRead

# like this.


コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください