Most of the instructions from this section originate from this aricle. Feel free to follow along with this gist or use the article.
Let's start by making sure our machine is up to date.
sudo apt-get update
sudo apt-get upgrade
Then we have to install the necessary dependencies.
sudo apt-get install git-core cmake freeglut3-dev pkg-config build-essential libxmu-dev libxi-dev libusb-1.0-0-dev
Next, we clone the libfreenect project to our machine. Feel free to clone it anywhere you please.
git clone git://github.com/OpenKinect/libfreenect.git
Now install libfreenect
cd libfreenect
mkdir build
cd build
cmake -L ..
make
sudo make install
sudo ldconfig /usr/local/lib64/
If you want to use the kinect as a non-root user then do the following
sudo adduser $USER video
sudo adduser $USER plugdev
Then make a rule file for linux device manager
sudo gedit /etc/udev/rules.d/51-kinect.rules
Add the following to the file:
# ATTR{product}=="Xbox NUI Motor"
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02b0", MODE="0666"
# ATTR{product}=="Xbox NUI Audio"
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02ad", MODE="0666"
# ATTR{product}=="Xbox NUI Camera"
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02ae", MODE="0666"
# ATTR{product}=="Xbox NUI Motor"
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02c2", MODE="0666"
# ATTR{product}=="Xbox NUI Motor"
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02be", MODE="0666"
# ATTR{product}=="Xbox NUI Motor"
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02bf", MODE="0666"
To test your installation, try running this command:
freenect-glview
Now that we have libfreenect on our machine, it is time to make it work with python.
sudo apt-get install cython
sudo apt-get install python-dev
sudo apt-get install python-numpy
Next we need to set up freenect with python. So go to your libfreenect directory .../libfreenect/wrappers/python and run the following command
sudo python setup.py install
If and only if creating 51-kinect.rules does not allow you to run a python script as a non-root user:
vi /etc/udev/rules.d/66-kinect.rules
Add this text to the file:
# ATTR{product}=="Xbox NUI Motor"
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02b0", MODE="0666"\n
# ATTR{product}=="Xbox NUI Audio"\n
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02ad", MODE="0666"\n
# ATTR{product}=="Xbox NUI Camera"\n
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02ae", MODE="0666"\n
https://github.com/MaxConners/Terrain-Classification.git
conda create -n terrain-classification python=2.7
source activate terrain-classification
To install all necessary packages run:
pip install -r requirements.txt
This section details how to set up the terrain classification application.
To train a model open a terminal and run
python train_model.py <model_name> <corpus_path>
where the directory tree is:
- <corpus_path>
- <class_folder_2>
- <image_1.jpg>
- <image_2.jpg>
- ...
- <image_n.jpg>
- <class_folder_2>
- <image_1.jpg>
- <image_2.jpg>
- ...
- <image_n.jpg>
- ...
- <class_folder_n>
- <image_1.jpg>
- <image_2.jpg>
- ...
- <image_n.jpg>
python train_model.py fast_net terrain_images
where the directory tree is:
- terrain_images
- concrete
- image_1.jpg
- image_2.jpg
- ...
- image_n.jpg
- grass
- image_1.jpg
- image_2.jpg
- ...
- image_n.jpg
- ...
- rock
- image_1.jpg
- image_2.jpg
- ...
- image_n.jpg
python terrain_classification.py fast_net
Really helpful, thanks!