-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathopencv-setup.sh
executable file
·116 lines (102 loc) · 2.41 KB
/
opencv-setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/bash
set -o errexit
set -o nounset
readonly REPO="$(readlink -f -- "$(dirname -- "${0}")/..")"
readonly LIB="${REPO}/rock-bot/lib"
readonly USERNAME="`id -un`"
MIRROR='switch'
while (( "$#" )); do
shift
case "${1}" in
-m) shift; MIRROR="${1}" ;;
esac
done
readonly MIRROR
readonly ARTOOLKIT='http://javacv.googlecode.com/files/ARToolKitPlus_2.1.1t.zip'
readonly FREENECT='https://github.com/OpenKinect/libfreenect/zipball/v0.1.1'
readonly JAVACV='http://javacv.googlecode.com/files/javacv-src-20111001.zip'
readonly JAVACPP='http://javacpp.googlecode.com/files/javacpp-src-20111001.zip'
readonly OPENCV="http://${MIRROR}.dl.sourceforge.net/project/opencvlibrary/opencv-unix/2.3.1/OpenCV-2.3.1a.tar.bz2"
sudo apt-get --assume-yes install \
ant \
cmake \
default-jdk \
freeglut3-dev \
libavcodec-dev \
libavdevice-dev \
libavfilter-dev \
libavformat-dev \
libavutil-dev \
libcommons-cli-java \
libdc1394-22-dev \
libgstreamermm-0.10-dev \
libgtk2.0-dev \
libopenexr-dev \
libpostproc-dev \
libqt4-dev \
libswscale-dev \
libusb-1.0.0-dev \
libv4l-dev \
libvdpau-dev \
libxi-dev \
libxmu-dev \
python-numpy \
python-sphinx \
qt4-qmake \
texlive \
x11proto-video-dev
# ARTToolKit
cd /tmp
wget "${ARTOOLKIT}"
unzip ARToolKitPlus_*
cd ARToolKitPlus_*
export ARTKP="$(readlink -f .)"
qmake
make
sudo make install
cd ..
# libfreenect
cd /tmp
wget -O libfreenect.zip "${FREENECT}"
unzip libfreenect.zip
cd OpenKinect-libfreenect-*
cmake .
make
sudo make install
sudo ldconfig /usr/local/lib64/
sudo adduser "${USERNAME}" video
sudo cat << EOF >> /etc/udev/rules.d/51-kinect.rules
# 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"
EOF
cd ..
# OpenCV
cd /tmp
wget -O - "${OPENCV}" | tar -xj
cd OpenCV-*
cmake .
make
sudo make install
# JavaCV
cd /tmp
wget "${JAVACPP}"
unzip javacpp-*
wget "${JAVACV}"
unzip javacv-*
cd javacv
ant
# Build lib
cd /tmp/javacv
mv dist "${LIB}/javacv"
mv src "${LIB}/javacv"
cd "${LIB}/javacv/javadoc"
zip -r ../javadoc.zip *
cd ..
rm -fr javadoc
cd /tmp/javacpp
mv dist "${LIB}/javacpp"
mv src "${LIB}/javacpp"