ubuntu16.04でkinect_v1

ubuntu16.04でkinect_v1をインストールからサンプルを動かすところまでやります。

ROSでの起動

ROSだと簡単に環境を整えることができます。
ここの通りにやればすぐに動かせます。
ROS → https://staff.aist.go.jp/kanezaki.asako/pdf/SSII2016_AsakoKanezaki.pdf

OpenCVでの起動

opencvが2.3や2.4の人はopencvから呼び出し可能です。
Kinect and OpenNI — OpenCV 2.4.13.2 documentation
ただし、openNiがデフォルトフォルダにインストール済みなことや、
opencvビルド時にWITH_OPENNI=ONを指定していることが前提になります。
環境が揃っている人は、opencv-2.4.13/build/binのcpp-example-openni_captureを実行することでkinectを起動できます。

ライブラリを一つずつ入れていく方法

ほとんど参考HPのままですが、一部変更点があります。
[参考HP]
Accessors Wiki | ROS / InstallingThePrimeSenseKinectSensorOnUbuntu

Install the following libraries


sudo apt-get install freeglut3-dev pkg-config build-essential libxmu-dev libxi-dev libusb-1.0-0-dev doxygen graphviz mono-complete

sudo apt-get install openjdk-8-jre ←追加
sudo apt-get install openjdk-8-jdk ←追加

 

Install OpenNI


#Create a 'kinect' folder in your home directory to store installation source of drivers:
mkdir -p ~/kinect
cd ~/kinect

#Download from the OpenNI modules. Make sure you get the 'unstable' branch:
git clone https://github.com/OpenNI/OpenNI.git
cd OpenNI
git checkout unstable
cd Platform/Linux/CreateRedist
./RedistMaker

#If that succeeds, there a Redist folder should be created with an install script. Run it:
cd ~kinect/OpenNI/Platform/Linux/Redist/OpenNI-Bin-Dev-Linux-x64-v1.5.8.5/
sudo ./install.sh

 

Install the PrimeSense drivers:


#many blogs recommend installing from https://github.com/avin2/SensorKinect.git
#This didn't work for me, but the following the following repo from ph4m worked:
cd ~/kinect
git clone https://github.com/ph4m/SensorKinect.git

#Install it
cd SensorKinect/Platform/Linux/CreateRedist
./RedistMaker

#If that succeeds, there a Redist folder should be created with an install script. Run it:
cd ~/kinect/SensorKinect/Platform/Linux/Redist/Sensor-Bin-Linux-x64-v5.1.2.1/
sudo ./install.sh

Install the NITE middleware


#I downloaded the OpenNI SDK v2.1 for Linux-x64 from http://openni.ru/openni-sdk/openni-sdk-history-2/index.html into ~/kinect.
#The latest NITE SDK from http://openni.ru/files/nite/index.html may be fine as well.
cd ~/kinect
unzip OpenNI-Linux-x64-2.1.0.tar.zip
tar -jxvf OpenNI-Linux-x64-2.1.0.tar.bz2
cd OpenNI-2.1.0-x64
sudo ./install.sh

#Run a sample simple viewer
Samples/Bin/SimpleViewer
cd ~/kinect/OpenNI/Platform/Linux/Bin/x64-Release ←変更
kinectを接続していること確認
./NiViewer ←サンプル起動