2013年1月16日水曜日

An Installation of OpenNI2 on Raspberry Pi. To use a Xtion.


An Installation of OpenNI2.2 on Raspberry Pi ---> Please see a new post.


New Release OpenNI2 (2.1.0.4 branch:develop)
I've built new OpenNI2 driver and modules as following.
This installation time is an hour.

a Xion, a Webcam, and a Webcam on the Raspberry Pi

(1) Buliding Prerequisites
[root@rcmp-r03 ~]# pacman -Syu
[root@rcmp-r03 ~]# pacman -S gcc
[root@rcmp-r03 ~]# pacman -S make cmake pkg-config
[root@rcmp-r03 ~]# pacman -S libusb
[root@rcmp-r03 ~]# pacman -S python2
[root@rcmp-r03 ~]# pacman -S freeglut
[root@rcmp-r03 ~]# pacman -S doxygen
[root@rcmp-r03 ~]# pacman -S graphviz
or
pacman -S gcc make cmake pkg-config 
pacman -S libusb python2 freeglut doxygen graphviz 

(2) Download  & uncompress OpenNI2 source. (branch:develop 2.1.0.4)
(26 Jan, 2013 : Both the 'master' and 'develop' were up-to-date.
It's necessary to confirm the version of  branches.) 
Please download a source zip file form Here.
  Download > OpenNI 2.0 source code is available on GitHub > branch develop
Assuming an installation directory "~/OpenNI2-develop".

(3) Set  compiler options for the ARM1176JZF-S
ARM compiler option web-site. HERE 

[root@rcmp-r03 ~]# cd OpenNI2-develop/ThirdParty/PSCommon/BuildSystem
[root@rcmp-r03 BuildSystem]# vi Platform.Arm
[root@rcmp-r03 BuildSystem]# cat Platform.Arm

ifeq "$(CFG)" "Release"
    # Hardware specifying flags
    #CFLAGS += -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp #-mcpu=cortex-a8
  CFLAGS += -mtune=arm1176jzf-s -mfloat-abi=hard
    # Optimization level, minus currently buggy optimizing methods (which break bit-exact)
    #CFLAGS += -O3 -fno-tree-pre -fno-strict-aliasing
    # More optimization flags
   # CFLAGS += -ftree-vectorize -ffast-math -funsafe-math-optimizations -fsingle-precision-constant
endif

(4) Build
[root@rcmp-r03 OpenNI2-BuildSystem]# cd ../../..
[root@rcmp-r03 OpenNI2-develop]# make                             20-30 minites

(5) Packaging 
[root@rcmp-r03 OpenNI2-develop]# cd Redist
[root@rcmp-r03 Redist]# vi Redist.py
Line : 534
before
compilation_cmd = "make -j" + calc_jobs_number() + " CFG=" + configuration + " PLATFORM=" + platform + " > " + outfile + " 2>&1"
        if compilationMode == 'Rebuild':
after
compilation_cmd = "make -j1" + " CFG=" + configuration + " PLATFORM=" + platform + " > " + outfile + " 2>&1"
        if compilationMode == 'Rebuild':

[root@rcmp-r03 Redist]# ln -s /usr/bin/python2 /usr/bin/python
[root@rcmp-r03 Redist]# python ReleaseVersion.py arm      3 -5 minites
[root@rcmp-r03 Redist]# cd Final
[root@rcmp-r03 Final]# ls
OpenNI-Linux-Arm-2.1.0.tar.bz2

(6) Installation
[root@rcmp-r03 Final]# tar -jxvf OpenNI-Linux-Arm-2.1.0.tar.bz2
[root@rcmp-r03 Final]# cd OpenNI-2.1.0-arm
[root@rcmp-r03 Final]# sh install.sh


(7) Environment variable

[root@rcmp-r03 Final]# export OPENNI_DIR=/root/OpenNI2-develop
[root@rcmp-r03 Final]# export OPENNI2_INCLUDE=$OPENNI_DIR/Include
[root@rcmp-r03 Final]# export OPENNI2_REDIST=$OPENNI_DIR/Redist


(8) Testing
[root@rcmp-r03 Final]# cd Samples/Bin
[root@rcmp-r03 Bin]# SimpleRead
[00000000]        0
[00033369]        0
[00066738]        0
[00100107]        0
[00133477]        0
[00166846]        0
[00200215]        0
[00233584]        0
[00266954]        0
[00300323]        0
[00333692]        0

Success!

peace!

0 件のコメント:

コメントを投稿