查找包
aptitude search pkgName
pkgName可以有多个(空格分隔)
ffmpeg
sudo add-apt-repository ppa:kirillshkrogalev/ffmpeg-next sudo apt-get update sudo apt-get install ffmpeg
编译安装opencv和opencv contrib 以及python接口
罗嗦版:
mkdir -p ~/work/gitdowncd $_git clone https://github.com/opencv/opencvgit clone https://github.com/opencv/opencv_contribcd opencvmkdir buildcd buildcmake \-D CMAKE_BUILD_TYPE=Release \-D CMAKE_INSTALL_PREFIX=/usr/local/opencv-git-master \-D WITH_CUDA=OFF \-D WITH_VTK=OFF \-D WITH_MATLAB=OFF \-D BUILD_DOCS=ON \-D OPENCV_EXTRA_MODULES_PATH=/home/chris/work/gitwhat/opencv_contrib/modules \-D PYTHON2_EXECUTABLE=/usr/bin/python \-D PYTHON3_EXECUTABLE=/usr/bin/python3 \-D PYTHON_INCLUDE_DIR=/usr/include/python2.7 \-D PYTHON_INCLUDE_DIR2=/usr/include/x86_64-linux-gnu/python2.7 \-D PYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython2.7.so \-D PYTHON2_NUMPY_INCLUDE_DIRS=/usr/lib/python2.7/dist-packages/numpy/core/include/ \-D PYTHON3_NUMPY_INCLUDE_DIRS=/usr/lib/python3.5/dist-packages/numpy/core/include/ \..
期间容易出现ippicv等第三方包下载不下来的情况。找到对应的.cmake文件,把下载地址拼接出来自行下载,注意替换掉md5的hash值。下载的文件放到<opencv_root>/.cache
目录下,例如:
.cache├── ippicv│ └── 1469ff5ced054be500921d2d46278ef4-ippicv_linux_20151201.tgz├── protobuf│ └── bd5e3eed635a8d32e2b99658633815ef-protobuf-cpp-3.1.0.tar.gz├── tiny_dnn│ └── adb1c512e09ca2c7a6faef36f9c53e59-v1.0.0a3.tar.gz└── xfeatures2d ├── boostdesc │ ├── 0ae0675534aa318d9668f2a179c2a052-boostdesc_lbgm.i │ ├── 0ea90e7a8f3f7876d450e4149c97c74f-boostdesc_bgm.i │ ├── 202e1b3e9fec871b04da31f7f016679f-boostdesc_binboost_064.i │ ├── 232c966b13651bd0e46a1497b0852191-boostdesc_bgm_bi.i │ ├── 324426a24fa56ad9c5b8e3e0b3e5303e-boostdesc_bgm_hd.i │ ├── 98ea99d399965c03d555cef3ea502a0b-boostdesc_binboost_128.i │ └── e6dcfa9f647779eb1ce446a8d759b6ea-boostdesc_binboost_256.i └── vgg ├── 151805e03568c9f490a5e3a872777b75-vgg_generated_120.i ├── 7126a5d9a8884ebca5aea5d63d677225-vgg_generated_64.i ├── 7cd47228edec52b6d82f46511af325c5-vgg_generated_80.i └── e8d0dcd54d1bcfdc29203d011a797179-vgg_generated_48.i
新编译出来的cv2.so位于/usr/local/opencv-git-master/lib/cv2.so
sudo apt-get remove python-opencvsudo ln -sf /usr/local/opencv-git-master/lib/python2.7/dist-packages/cv2.so /usr/lib/python2.7
或者设定PYTHONPATH也可以
编译安装protobuf3.2
apt装的protobuf是2.5版本. pip装的protobuf是3.2版。 使用了python layer的网络,如果用tools/caffe.cpp编译出的工具build/caffe
来执行网络,会报protobuf版本问题,需要protobuf-cpp的版本装3.2版
编译装protobuf3.2
卸载apt的protobub
sudo apt-get remove --purge libprotobuf-dev
如果你是ubuntu-desktop用户,那你的桌面有可能被误删。立即安装(不要重启):
sudo apt-get install ubuntu-desktop -ysudo apt-get install unity -ysudo apt-get install compiz-gnome -ysudo apt-get install libcompizconfig0 -y
静态编译protobuf(产生libprotobuf.a而不是.so文件,否则caffe编译会报错)
sudo apt-get install autoconf automake libtool curl make g++ unzipcd ~/work/gitdowngit clone https://github.com/google/protobufgit checkout -b 3.2.x origin/3.2.xcd protobufvim configure
修改2658行和2661行,引号里面都换成"-fPIC"
./autogen.sh./configure --disable-sharedmake -j8sudo make install
sudo ldconfig
重新编译caffe
cd ~/work/caffe-BVLCmake cleanmake -j8make pycaffe
android-studio
真机调试:需要先设定udev的规则。
参考:exfat无法挂载?
sudo apt-get install exfat-utils
flash
sudo apt-get install flashplugin-installer