librealsenseでCreative VF0800(F200)を使う

|`環境`     |       |
|----------|--------------------------|
|**OS**     |**ubuntu 14.0.5**         |
|**OS**    |**win10 pro (F200 firmware update用)**|
|**kernel**|**4.4.0-31-generic**     |
|**camera**|**Creative VF0800(F200)** |
|**librealsense**|**v1.12.1**     

##元記事
https://github.com/IntelRealSense/librealsense/blob/v1.12.1/doc/installation.md

#rs_dcm_f200をwin10にインストールする。
https://downloadcenter.intel.com/ja/download/25044/Intel-RealSense-Depth-Camera-Manager
dcmをインストールする際にF200のファームウェアも更新される。

1.動作確認(デバイスマネージャ)

2.skypeでF200の動作確認をする

dcmインストール前は、skypeのビデオ設定画面でF200がコンボボックスに出て来なかったが、インストール後はF200が選択可能になり、映像も出力された。






##1. Ensure apt-get is up to date　
**OSをアップデートする。**　　
`sudo apt-get update && sudo apt-get upgrade`
   Note: Use sudo apt-get dist-upgrade, instead of sudo apt-get upgrade, in case you have an older Ubuntu 
   14.04 version (with deprecated nvidia-331* packages installed), as this prevents the linux 4.4* kernel    to compile properly.

##2. librealsense v1.12.1をgit cloneする。 
`git clone -b v1.12.1 https://github.com/IntelRealSense/librealsense.git`
 
##3. Install libusb-1.0 and pkg-config via apt-get　
**libusbをapt-getでインストールする。**
`sudo apt-get install libusb-1.0-0-dev pkg-config`

##4. glfw3をインストールする。
ubuntu 14.04はapt-get パッケージがないのでgit cloneしたディレクトリへ移動して下記の手順でインストールする。
glfw3 is not available in apt-get on Ubuntu 14.04. Use included installer script:

`./scripts/install_glfw3.sh` 

ubuntu 16.04はapt-getでインストールする。
For 16.04 you can install glfw3 via `sudo apt-get install libglfw3-dev`

GTK+3.0 install 
`sudo apt-get install libgtk-3-dev`

##5. We use QtCreator as an IDE for Linux development on Ubuntu qt_creater
**QtCreaterでlibrealsenseをbuildしたい場合はqt_createrをインストールする。**
Note: QtCreator is presently configured to use the V4L2 backend by default
`sudo apt-get install qtcreator`
`sudo scripts/install_qt.sh` (we also need qmake from the full qt5 distribution)
all.pro contains librealsense and all example applications
From the QtCreator top menu: Clean => Run QMake => Build
Built QtCreator projects will be placed into ./bin/debug or ./bin/release

##6. We also provide a cmake file if you'd prefer to use your own favourite text editor
**QtCreaterを使わない場合はこっち。**
`mkdir build`
`cd build`
`cmake ..`
`make && sudo make install`
The library will be installed in /usr/local/lib and header files in /usr/local/include.
Note: If you would also like to compile the code examples use:
**サンプルもbuildしたい場合のcmakeはこれ**
`cmake .. -DBUILD_EXAMPLES:BOOL=true`

`make && sudo make install`

The example executables will build into ./examples and install into /usr/local/bin.

## Video4Linux backend
**Video4Linuxの設定**
Ensure no cameras are presently plugged into the system.  
Install udev rules
** git cloneしたディレクトからudev rulesをコピーする。
`sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/`
**rouleのreload** 
`sudo udevadm control --reload-rules`
**USB コネクタを抜き差しする代わりにudevadm triggerを実行**
`udevadm trigger`
Next, choose one of the following subheadings based on desired machine configuration / kernel version (and remember to complete step 4 after). 
**Note: ** Multi-camera support is currently NOT supported on 3.19.xx kernels. Please update to 4.4 stable.
####Ubuntu 14.04.[0-4]
Update to 4.4 Stable Kernel  
Run the following script to install necessary dependencies (GCC 4.9 compiler and openssl) and update kernel to v4.4-wily
`./scripts/install_dependencies-4.4.sh`
Run the following script to patch uvcvideo.ko
`./scripts/patch-uvcvideo-4.4.sh v4.4-wily` (note the argument provided to this version of the script)
This script involves shallow cloning the Linux source repository (~100mb), and may take a while
####(OR) Keep 3.19.xx Kernel
Run the following script to patch uvcvideo.ko
./scripts/patch-uvcvideo-ubuntu-mainline.sh
(R200 Only with 3.19.xx Kernel) Install connectivity workaround. Note this script needs to be run from within the scripts folder:
cd scripts
./install-r200-udev-fix.sh
cd ..
This udev fix is not necessary for kernels >= 4.2
Use of 3.19.xx Kernel is not recommended.
####(OR) Ubuntu 14.04.5 or Ubuntu 16.04.xx (Kernel 4.4)
**今回はubuntu 14.0.5なのでこれを実行**
`sudo apt-get install libssl-dev`
**uvcvideoにpatchをあてます。**
`./scripts/patch-uvcvideo-16.04.simple.sh`

####(OR) Arch based distributions
You need to install the base-devel and linux-headers package group.
Then run the following script to patch the uvc module:
./scripts/patch-arch.sh
##Reload the uvcvideo driver 　　
**uvcvideoドライバーをリロースする。**
sudo modprobe uvcvideo

##Check installation by examining the last 50 lines of the dmesg log:　
**カーネルメッセージを確認する。**
`sudo dmesg | tail -n 50`

**The log should indicate that a new uvcvideo driver has been registered. If any errors have been noted, first attempt the patching process again, and then file an issue if not successful on the second attempt (and make sure to copy the specific error in dmesg).**

##動作確認
./build/examples/cpp-enumetate-devicesを実行してF200がみつかればOK